Skip to main content

SQS (Simple Queue Service) endpoints

SQS endpoints allow you to send webhook events to AWS SQS queues instead of HTTP endpoints.

This is useful for queuing payloads in a message queue without your customers having to set up any listener endpoint or write any glue code. SQS endpoints are ideal for:

  • Asynchronous processing: Decouple event delivery from processing
  • High throughput: Handle large volumes of events with built-in batching
  • Reliability: Leverage SQS's durability and retry mechanisms
  • Scalability: Auto-scale consumers based on queue depth

Configuration

Create an SQS endpoint by providing your SQS queue URL and AWS credentials. Events will be batched and sent to your queue according to your sink's batch configuration.

curl -X 'POST' \
'https://api.eu.svix.com/api/v1/stream/{your_sink_id}/sink' \
-H 'Authorization: Bearer AUTH_TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"config": {
"queueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/my-queue",
"region": "us-east-1",
"accessKeyId": "xxx",
"secretAccessKey": "xxx"
},
"type": "sqs"
}'

Transformation

SQS endpoints use transformations to format events for the target queue. Here's the transformation function for SQS:

/**
* @param input - The input object
* @param input.events - The array of events in the batch. The number of events in the batch is capped by the Sink's batch size.
* @param input.events[].payload - The message payload (string or JSON).
* @param input.events[].eventType - The message event type (string).
*
* @returns Object containing the response.
* @returns returns.messages - The array of SQS messages to send to the SQS queue.
* @returns returns.messages[].payload - The payload of the message (string).
*/
function handler(input) {
const messages = input.events.map((event) => ({
payload: event,
}));

return {
messages,
};
}

For example, if the endpoint receives the following events:

{
"eventType": "user.created",
"payload": "{\"email\": \"joe@enterprise.io\"}"
}
{
"eventType": "user.login",
"payload": "{\"id\": 12, \"timestamp\": \"2025-07-21T14:23:17.861Z\"}"
}

The default transformation would produce these SQS messages:

{
"messages": [
{
"payload": {
"eventType": "user.created",
"payload": "{\"email\": \"joe@enterprise.io\"}"
}
},
{
"payload": {
"eventType": "user.login",
"payload": "{\"id\": 12, \"timestamp\": \"2025-07-21T14:23:17.861Z\"}"
}
}
]
}

To send only the payload data:

function handler(input) {
const messages = input.events.map((event) => ({
payload: event.payload,
}));

return {
messages,
};
}

This would produce:

{
"messages": [
{
"payload": "{\"email\": \"joe@enterprise.io\"}"
},
{
"payload": "{\"id\": 12, \"timestamp\": \"2025-07-21T14:23:17.861Z\"}"
}
]
}