Access is invite-only during beta. Once invited, create a key to personalize these examples. Production sending requires a separate review.
Forward webhooks to Amazon EventBridge
Check the signature in Lambda, then call PutEvents.
This guide shows you how to put delivery webhooks on an Amazon EventBridge bus.
PostShiba POSTs a JSON array to an https URL. A Lambda function URL is that URL. The function checks the signature, then calls PutEvents. Rules on the bus route each event.
Create the bus
Create an event bus in the same Region as the function. The sample uses the name postshiba.
Allow PutEvents
Add this statement to the function's execution role. Replace the Region, account, and bus name.
Write the function
Use the Node.js 22 runtime. Install @aws-sdk/client-eventbridge in the function directory and deploy it with the handler.
Mark the package as a module so index.js can use import.
Set POSTSHIBA_WEBHOOK_SECRET to the endpoint secret. Set EVENT_BUS_NAME to the bus name.
The signed string is {timestamp}.{raw body}. Check that string before parsing JSON. A HEAD with no signature is the liveness check. Return 204 for HEAD. A status of 500 or higher marks the endpoint down.
PutEvents accepts 10 entries per call. Return 2xx after every entry is accepted. Return 500 when FailedEntryCount is greater than zero so PostShiba retries. A retry sends the same body again. Use sg_event_id as the idempotency key. See Retries and replays.
Return within 10 seconds.
Open a function URL
Create a function URL with auth type NONE, payload format 2.0, and buffered invoke mode. The function returns 401 when the signature check fails.
Copy the https:// URL. Production webhook URLs must be https.
Create the webhook
- Create an endpoint with that URL in the dashboard or with the API. See Managing webhooks.
- Copy
secretfrom the create response intoPOSTSHIBA_WEBHOOK_SECRET. - Enable the endpoint and pick event types. See Event types.
Add a rule
On the postshiba bus, match source postshiba. Set the detail type to the event name, such as delivered or bounce.
Detail is one object from the array. Fields are listed on Event types.
Inbox webhooks use the same headers with webhook_secret. See Receiving webhooks.