Testing webhooks in Nylas v2
You can monitor webhooks with the Nylas CLI. The tunnel
command allows you to test webhooks against your local server. Learn more about this process in the Webhooks guide. There are two ways to test webhooks using the CLI. You can use the CLI or you can set up a local server.
nylas webhook [command] [flag]
Create Webhooks
Currently, API requests to POST
webhooks are not supported through the CLI.
CLI
Use the command nylas webhook tunnel --print
. The print command is optional. It will print the webhook object to the terminal.
Triggers Flag
The --triggers
flag limits the webhook scope for the Nylas CLI in testing. Pass the notification triggers after the flag. These triggers are separated with a ,
only and no spaces.
Triggers Flag Example
The example below has event.created
and event.updated
as flag options for --triggers
in the CLI command.
nylas webhook tunnel --print --triggers event.created,event.updated
Local Server
If you prefer, you can test webhooks using the CLI and the local server. Just tunnel the webhooks to the server URL.
Use the command nylas webhook tunnel -f [domain]
and replace domain, with your domain.
If using a local server, make sure you have the following:
Video Walkthrough
Prefer video? You can watch our LiveStream Coding with Nylas.
What's Next
- Webhooks guides.
- Webhooks API documentation.
- Read the blog post Testing Webhooks Using the Nylas CLI and Ruby.
- Read the blog post Testing Webhooks Using the Nylas CLI and PHP.
- Read the blog post Testing Webhooks using the Nylas CLI and Python.