Skip to content

Commit b4961f7

Browse files
committed
Update docs
1 parent 1b37bbf commit b4961f7

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

src/config/secrets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This file contains secrets used for verifying incoming events from different HTT
66

77
export const EVENT_NOTIFIER_SECRETS = {
88
// Follow the pattern below to add a new secret
9+
// The secret will also need to be added in the deploy.sh script and in
10+
// Google Secret manager
911
// 'example-service': process.env.EXAMPLE_SERVICE_SECRET,
1012
};
1113
if (process.env.ENV !== 'production')

src/webhooks/README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,35 @@
77

88
The folder `generic-notifier` provides a generic webhook which can be used to send messages to Sentry Slack channels and Sentry Datadog. Using this webhook is VERY simple.
99

10-
Simply, go to `@/config/secrets.ts` and add an entry to the `EVENT_NOTIFIER_SECRETS` object. This entry should contain a mapping from the name of your service (for example, `example-service`) to an environment variable. [TODO: Fill in how to set the prod env var here]. Make a PR with this change and get it approved & merged.
10+
Simply, go to `@/config/secrets.ts` and add an entry to the `EVENT_NOTIFIER_SECRETS` object. This entry should contain a mapping from the source of the message (for example, `example-service`) to an environment variable. As of now, you will also need to edit `bin/deploy.sh` to add the new secret to the deployment and also add the secret to Google Secret Manager. Make a PR with this change and get it approved & merged.
1111

12-
Once this has been deployed, all you have to do is send a POST request to `https://product-eng-webhooks-vmrqv3f7nq-uw.a.run.app/event-notifier/v1` with a JSON payload in the format of the type `GenericEvent` defined in `@/types/index.ts`. Example:
12+
Once this has been deployed, all you have to do is send a POST request to `https://product-eng-webhooks-vmrqv3f7nq-uw.a.run.app/event-notifier/v1` with a JSON payload in the format of the type `GenericEvent` defined in `@/types/index.ts`. Currently, only Datadog and Slack messages are supported. Example:
1313

1414
```json
1515
{
1616
"source": "example-service", // This must match the mapping string you define in the EVENT_NOTIFIER_SECRETS obj
1717
"timestamp": 0,
18-
"service_name": "official_service_name",
19-
"data": {
20-
"title": "This is an Example Notification",
21-
"message": "Random text here",
22-
"tags": [
23-
"source:example-service", "sentry-region:all", "sentry-user:bob"
24-
],
25-
"misc": {},
26-
"channels": {
27-
"slack": ["C07EH2QGGQ5"],
28-
"jira": ["TEST"]
18+
"data": [
19+
{
20+
"type": "slack", // Basic Slack message
21+
"text": "Random text here",
22+
"channels": ["#aaaaaa"],
23+
// Optionally, include Slack Blocks
24+
"blocks": []
25+
}, {
26+
"type": "service_notification", // Slack message using service registry information
27+
"service_name": "eng_pipes_gh_notifications",
28+
"text": "Random text here",
29+
// Optionally, include Slack Blocks
30+
"blocks": []
31+
}, {
32+
"type": "datadog", // Datadog message
33+
"title": "This is an Example Notification",
34+
"text": "Random text here",
35+
"tags": ["source:example-service", "sentry-region:all", "sentry-user:bob"],
36+
"alertType": "info"
2937
}
30-
}
38+
]
3139
}
3240
```
3341

0 commit comments

Comments
 (0)