What Followr sends
The company’s secret, as is, in theX-Company-Secret header:
- Not a signature. The body isn’t signed and has no timestamp. Compare the header with your stored secret, and parse the JSON as usual.
- 32 letters and digits, the same on every request, unique to the company.
- Find it in Company settings > Webhooks, or in
webhook_secretfromGET /companies/{id}.
Verify a request
1
Read the header
Reject the request if
X-Company-Secret is missing or empty.2
Compare in constant time
A plain
== or === stops at the first different character, which leaks how much of a guess was right.3
Answer
No match:
401, and ignore the body. Match: 200, then process the event.FOLLOWR_WEBHOOK_SECRET environment variable.
One URL for several companies
Compare the header with each company’s secret in constant time. The match tells you the company; no match means401.
Python
Test your endpoint
ReplaceYOUR_WEBHOOK_SECRET with your secret. Expect 200, and 401 with any other value.
Troubleshooting
The header is empty
The header is empty
The URL was set when the company was created, so there’s no secret. Remove the URL (Remove in the app, or
"webhook_posts_url": null in PUT /companies/{id}), set it again, then read webhook_secret.The header never matches
The header never matches
Check you stored this company’s secret. Copy it again, with no spaces or line breaks around it.
The secret leaked
The secret leaked
Contact support. Until it’s replaced, read the post with
GET /posts/{id} before you act on a request.