AWS SQS Trigger icon

AWS SQS Trigger

Consumer AWS SQS

Overview

This node acts as a trigger to consume messages from an AWS SQS (Simple Queue Service) queue. It periodically polls the specified SQS queue for new messages and emits each received message as output. This is useful in automation workflows where you want to react to events or data pushed into an SQS queue, such as processing tasks asynchronously, integrating with other systems, or triggering downstream processes based on queue messages.

Common scenarios include:

  • Processing job requests submitted via SQS.
  • Integrating AWS services with n8n workflows by consuming messages from queues.
  • Building event-driven architectures where SQS acts as a buffer or decoupling layer.

Example: A workflow that triggers whenever a new order message arrives in an SQS queue, then processes the order details.

Properties

Name Meaning
Queue Input Method Choose how to specify the SQS queue: either select from a list of available queues or enter the URL manually.
Queue Name or ID Select the SQS queue to monitor from a dynamically loaded list (shown if "Select from List" is chosen).
Queue URL Enter the full URL of the SQS queue to monitor (shown if "Enter URL Manually" is chosen).
Interval Frequency of polling the queue for new messages. Independent of call duration.
Unit Unit of the interval value: seconds or minutes.
Delete Messages Whether to delete messages after receiving them. Enable only if you want to consume (remove) messages.
Visibility Timeout Duration in seconds that received messages are hidden from subsequent retrieve requests.
Max Messages Maximum number of messages to retrieve per poll (1-10).
Wait Time Seconds How long each individual call waits for messages (0 = instant return, up to 20 seconds for efficiency).

Output

The node outputs each received SQS message as a JSON object with the following structure:

{
  "MessageId": "string",
  "Body": "string",
  "ReceiptHandle": "string",
  "MD5OfBody": "string",
  "MessageAttributes": { /* key-value pairs of message attributes */ },
  "Attributes": { /* additional message attributes */ },
  "QueueUrl": "string"
}
  • MessageId: Unique identifier of the message.
  • Body: The content of the message.
  • ReceiptHandle: Token used to delete or change the visibility of the message.
  • MD5OfBody: MD5 hash of the message body for integrity verification.
  • MessageAttributes: Custom attributes attached to the message.
  • Attributes: Standard message attributes.
  • QueueUrl: The URL of the queue from which the message was received.

If "Delete Messages" is enabled, messages are deleted from the queue after being emitted.

No binary data output is produced by this node.

Dependencies

  • Requires valid AWS credentials with permissions to access SQS queues.
  • Needs configuration of AWS API credentials in n8n (access key, secret key, region).
  • Uses AWS SDK for JavaScript v3 internally to interact with SQS.

Troubleshooting

  • Failed to load queues: Occurs if AWS credentials are invalid or lack permission to list queues. Verify credentials and permissions.
  • Error polling SQS: Could be due to network issues, incorrect queue URL, or insufficient permissions. Check connectivity, queue URL correctness, and IAM policies.
  • Failed to delete message: Happens if "Delete Messages" is enabled but the node lacks permission to delete messages or the receipt handle is invalid. Ensure proper permissions and that messages are not already deleted.
  • If no messages are received, verify that the queue contains messages and that the polling parameters (interval, max messages, wait time) are set appropriately.

Links and References

Discussion