Skip to content
Skip to main content

Receive notifications with Amazon SNS

You run on AWS, and standing up a public HTTPS endpoint just to catch Nylas webhooks adds infrastructure you’d rather not own. If your services already consume from SNS and SQS, it’s cleaner to drop events onto a topic and fan them out from there.

Nylas can deliver notifications to an Amazon SNS topic as an alternative to an HTTP webhook. You subscribe to the same triggers, but each event is published to your SNS topic instead of posted to a URL you host.

How do I send notifications to an SNS topic?

Section titled “How do I send notifications to an SNS topic?”

Create an SNS channel with a POST /v3/channels/sns request. You pass the SNS topic ARN, a role_arn for the IAM role Nylas assumes to publish, a list of trigger_types, and optional notification_email_addresses for downtime alerts. It then publishes 1 message to the topic per matching event, and your SNS subscribers take it from there.

The request below creates an SNS channel subscribed to one trigger.

When should I use SNS instead of webhooks?

Section titled “When should I use SNS instead of webhooks?”

SNS fits when you’re on AWS and want native fan-out: one topic can push the same event to SQS queues, Lambda functions, and HTTP subscribers at once, with retries handled by AWS. That decoupling matters during a burst, such as the up to 72 hours of events replayed when a grant recovers. Both channels carry the same notification payloads.

Reach for a standard HTTPS webhook instead when you aren’t on AWS or want the simplest setup, since a webhook needs only 1 reachable URL.

A couple of AWS-specific details matter. Nylas publishes using the IAM role you name in role_arn, so that role must grant sns:Publish on the topic, and the topic must be the full ARN. The channel subscribes to the same trigger_types as an HTTP webhook, so every event becomes 1 message on the topic with an identical payload; only the delivery target changes.

If you’re on Google Cloud instead of AWS, use a Pub/Sub channel, which works the same way against a Google Cloud topic. See SNS notification channels for the IAM setup.