AWS SNS Trigger With Policy Trigger

Handle AWS SNS events via webhooks

Overview

This n8n node acts as a trigger for AWS SNS (Simple Notification Service) topics, allowing workflows to start when messages are published to a specified SNS topic. It supports advanced filtering using SNS filter policies, enabling you to process only relevant events based on message attributes or body content.

Common scenarios:

  • Reacting to specific events in your AWS infrastructure (e.g., S3 uploads, CloudWatch alarms).
  • Integrating third-party systems with AWS event notifications.
  • Filtering incoming SNS messages so that only those matching certain criteria trigger the workflow.

Practical example:
You can use this node to listen for "deal-created" events from an SNS topic and automatically create a record in your CRM system whenever such an event occurs.

Properties

Name Meaning
Topic The SNS topic to subscribe to. You can select it from a list, provide its AWS Console URL, or enter its ARN directly.
Options:
- From List: Select a topic from your AWS account.
- By URL: Paste the AWS Console URL of the topic.
- ID: Enter the topic's ARN (e.g., arn:aws:sns:us-east-1:123456789012:my_topic).
Filter Policy The JSON configuration for the SNS filter policy. This determines which messages will trigger the workflow. Example:
{ "eventType": ["deal-created"] }
Only messages with eventType attribute set to "deal-created" will be processed.
Filter Policy Scope Determines whether the filter policy applies to message attributes or the message body.
Options:
- Attributes: Apply the filter to message attributes.
- Body: Apply the filter to the message body.

Output

The node outputs the full SNS message received as JSON. The structure typically includes fields such as:

{
  "Type": "Notification",
  "MessageId": "...",
  "TopicArn": "...",
  "Subject": "...",
  "Message": "...",
  "Timestamp": "...",
  "SignatureVersion": "...",
  "Signature": "...",
  "SigningCertURL": "...",
  "UnsubscribeURL": "...",
  // ...other SNS fields
}
  • For subscription confirmation events, the node handles the handshake automatically and does not output data to the workflow.
  • For unsubscribe confirmations, the node returns an empty object.
  • No binary data is produced by this node.

Dependencies

  • AWS Account: You must have access to an AWS account with permission to manage SNS topics and subscriptions.
  • AWS Credentials: The node requires valid AWS credentials (Access Key ID and Secret Access Key) configured in n8n.
  • n8n Configuration: The node must be accessible via a public URL for AWS SNS to deliver HTTP(S) notifications.

Troubleshooting

Common issues:

  • Invalid Topic ARN/URL: If the topic ARN or URL is incorrectly formatted, the node will display a validation error.
  • SNS Trigger Node Name Contains Spaces: If the node name contains spaces, subscription creation will fail with an error:
    "The name of the SNS Trigger Node is not allowed to contain any spaces!"
    Solution: Rename the node to remove spaces.
  • Missing Permissions: If the AWS credentials lack permissions for SNS actions, the node may fail to subscribe or receive messages.
  • Webhook Not Reachable: Ensure your n8n instance is publicly accessible; otherwise, AWS SNS cannot deliver messages.

Error messages:

  • "Not a valid AWS SNS Topic URL" or "Not a valid AWS SNS Topic ARN": Check the format of the input.
  • Subscription confirmation failures: Ensure the webhook URL is correct and reachable.

Links and References

Discussion