Skip to content

Commit

Permalink
chore: add Discord notification template (#29311)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Feb 28, 2025
1 parent f1ec05c commit fcfae07
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 12 deletions.
24 changes: 24 additions & 0 deletions posthog/cdp/templates/discord/template_discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,29 @@
}
},
),
HogFunctionSubTemplate(
name="Post to Discord on issue created",
description="",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].filters,
input_schema_overrides={
"content": {
"default": "**🔴 {event.properties.name} created:** {event.properties.description}",
}
},
),
HogFunctionSubTemplate(
name="Post to Discord on issue reopened",
description="",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].filters,
input_schema_overrides={
"content": {
"default": "**🔄 {event.properties.name} reopened:** {event.properties.description}",
}
},
),
],
)
12 changes: 12 additions & 0 deletions posthog/cdp/templates/hog_function_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,16 @@ def derive_sub_templates(templates: list[HogFunctionTemplate]) -> list[HogFuncti
type="internal_destination",
filters={"events": [{"id": "$activity_log_entry_created", "type": "events"}]},
),
"error-tracking-issue-created": HogFunctionSubTemplate(
id="error-tracking-issue-created",
name="Issue created",
type="internal_destination",
filters={"events": [{"id": "$error_tracking_issue_created", "type": "events"}]},
),
"error-tracking-issue-reopened": HogFunctionSubTemplate(
id="error-tracking-issue-reopened",
name="Issue reopened",
type="internal_destination",
filters={"events": [{"id": "$error_tracking_issue_reopened", "type": "events"}]},
),
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,23 @@
},
),
HogFunctionSubTemplate(
id="error-tracking-issue-created",
name="Post to Microsoft Teams on issue created",
description="",
filters={"events": [{"id": "$error_tracking_issue_created", "type": "events"}]},
type="internal_destination",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].filters,
input_schema_overrides={
"text": {
"default": "**🔴 {event.properties.name} created:** {event.properties.description}",
}
},
),
HogFunctionSubTemplate(
id="error-tracking-issue-reopened",
name="Post to Microsoft Teams on issue reopened",
description="",
filters={"events": [{"id": "$error_tracking_issue_reopened", "type": "events"}]},
type="internal_destination",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].filters,
input_schema_overrides={
"text": {
"default": "**🔄 {event.properties.name} reopened:** {event.properties.description}",
Expand Down
12 changes: 6 additions & 6 deletions posthog/cdp/templates/slack/template_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@
},
),
HogFunctionSubTemplate(
id="error-tracking-issue-created",
name="Post to Slack on issue created",
description="",
filters={"events": [{"id": "$error_tracking_issue_created", "type": "events"}]},
type="internal_destination",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-created"].filters,
input_schema_overrides={
"blocks": {
"default": [
Expand Down Expand Up @@ -246,11 +246,11 @@
},
),
HogFunctionSubTemplate(
id="error-tracking-issue-reopened",
name="Post to Slack on issue reopened",
description="",
filters={"events": [{"id": "$error_tracking_issue_reopened", "type": "events"}]},
type="internal_destination",
id=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].id,
type=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].type,
filters=SUB_TEMPLATE_COMMON["error-tracking-issue-reopened"].filters,
input_schema_overrides={
"blocks": {
"default": [
Expand Down

0 comments on commit fcfae07

Please sign in to comment.