AWS SNS Trigger With Policy Trigger

Handle AWS SNS events via webhooks

AWS SNS Trigger With Policy Trigger

AI-generated

Overview

This node acts as a trigger for AWS SNS (Simple Notification Service) events via webhooks. It listens for messages published to a specified SNS topic and triggers workflows in n8n when such messages are received. It supports filtering incoming messages based on a user-defined JSON filter policy, which can be applied either to the message attributes or the message body. This node is useful for automating workflows that depend on real-time notifications from AWS SNS topics, such as alerting systems, data processing pipelines, or integration with other services.

Use Case Examples

  1. Trigger a workflow when a new message is published to a specific AWS SNS topic.
  2. Filter incoming SNS messages to only trigger workflows for messages matching certain attributes or content in the message body.

Properties

Name Meaning
Topic The AWS SNS topic to listen to for incoming messages. It can be selected from a list, specified by URL, or directly by ARN.
Filter Policy A JSON configuration defining the filter policy to apply to incoming SNS messages. Only messages matching this policy will trigger the workflow.
Filter Policy Scope Determines whether the filter policy applies to the message attributes or the message body.

Output

JSON

  • Type - The type of the SNS message received (e.g., Notification, SubscriptionConfirmation).
  • MessageId - The unique identifier for the SNS message.
  • TopicArn - The ARN of the SNS topic from which the message was received.
  • Message - The content of the SNS message.
  • Timestamp - The time the message was published.
  • SignatureVersion - The version of the signature used to sign the message.
  • Signature - The cryptographic signature of the message.
  • SigningCertURL - The URL to the certificate used to sign the message.
  • UnsubscribeURL - The URL to unsubscribe from the SNS topic.

Dependencies

  • AWS SNS service
  • AWS credentials (access key ID and secret access key)

Troubleshooting

  • Ensure the AWS credentials provided have sufficient permissions to subscribe to the SNS topic and confirm subscriptions.
  • The node name must not contain spaces, as this will cause an error when creating the webhook subscription.
  • If the webhook subscription is not confirmed, the node will not receive messages. Check for SubscriptionConfirmation messages and confirm them automatically.
  • Invalid topic ARN or URL will cause validation errors; ensure the topic is correctly specified.

Links

Discussion