Skip to content

Commit 67ff8c2

Browse files
committed
Update readme
1 parent 2d50f63 commit 67ff8c2

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

src/webhooks/README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,36 @@
33
* Webhooks in "production" are deployed to a Google Cloud Run instance, in the project `super-big-data`. Why? (TODO insert why)
44
* The webhook points to `https://product-eng-webhooks-vmrqv3f7nq-uw.a.run.app`
55

6+
## Generic Event Notifier
7+
8+
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.
9+
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.
11+
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:
13+
14+
```json
15+
{
16+
"source": "example-service", // This must match the mapping string you define in the EVENT_NOTIFIER_SECRETS obj
17+
"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"]
29+
}
30+
}
31+
}
32+
```
33+
34+
Additionally, you must compute the HMAC SHA256 hash of the raw payload string computed with the secret key, and attach it to the `Authorization` header. EX: `Authorization: <Hash here>`
35+
636
## Adding a webhook to GoCD event emitter
737

838
* goto [gocd](deploy.getsentry.net)
@@ -30,7 +60,3 @@ Make sure to write the appropriate tests for the new webhook as well, by creatin
3060
## Authentication
3161

3262
Auth is handled via HMAC SHA256 signing. Each webhook expects a HMAC SHA hash sent in the `x-` header. Requests are validated by locally computing the expected HMAC SHA hash using a local secret (from an env variable) and comparing the values. `@/utils/auth/extractAndVerifySignature.ts` provides a utility function for authenticating requests.
33-
34-
## Generic Event Notifier
35-
36-
Handlers in the folder `notifier` can be used to send messages to be sent to Sentry Slack channels.

0 commit comments

Comments
 (0)