Verify webhook signatures
Check the <code>Relay-Signature</code> header with your endpoint secret to make sure the event came from Relay.
Check the Relay-Signature header with your endpoint secret to make sure the event came from Relay. Here is exactly what to do.
Steps#
Tip
Always verify against the raw request body, before parsing JSON.
Example#
curl https://api.relay.example/v3/messages \
-H "Authorization: Bearer $RELAY_KEY" \
-d channel=sms \
-d to=+15550100001 \
-d body="Your code is 482913"import Relay from '@relay/node';
const relay = new Relay(process.env.RELAY_KEY);
const msg = await relay.messages.create({
channel: 'sms',
to: '+15550100001',
body: 'Your code is 482913',
});
console.log(msg.status); // queuedimport os, relay
client = relay.Client(os.environ["RELAY_KEY"])
msg = client.messages.create(
channel="sms", to="+15550100001", body="Your code is 482913"
)
print(msg.status) # queuedStill stuck?#
Include the request ID from the Relay-Request-Id response header — it lets us find your call in seconds.
Was this article helpful?
Thanks for letting us know!