Skip to content

Webhook Quickstart: create and read webhooks

This guide walks you through the process of creating a sample web app that receives webhooks from Nylas whenever you get a new email.

Before you begin

Make sure you have done the following

  1. Create a Nylas account- Nylas offers a free Sandbox account where you can test APIs and set up webhook triggers. Sign up to create a Nylas account.
  2. Made an endpoint accessible to the web, so that Nylas can make a request to your webhook. If you’re on localhost you should use a tunneling service, we recommend using the VS Code tunnel. Keep in mind that Ngrok may rate limit you and should be avoided if possible.

Set up webhooks in your app

First, we’ll set up the foundation for creating and receiving webhooks in your web app.

Configure Nylas SDKs and webhook endpoint

Prepare to log webhook notifications

Use webhooks with Nylas

Now that you have a webhook server set up, it’s time to start sending email events by setting up your webhooks on the dashboard.

You can click on “Create Webhook” and input the call back url hosted on the server you just created and select message.created trigger. Once created, the dashboard will display your webhook secret just once, that you need to store and pass as an environment variable under WEBHOOK_SECRET.

Webhook page on Nylas dashboard

If all of these steps went smoothly, you’ll now get a webhook notification every time you send or receive an email!