New Programmatic Webhooks - Nylas

New Programmatic Webhooks

3 min read
    Tags:

    Staying up to date with the latest email, calendar and contacts data just became easier today. Now, you can automatically detect if your webhook is down, and auto re-enable the webhook in seconds without ever logging in to the Nylas dashboard.

    We’ve added support for PUT , POST, and DELETE on our webhooks endpoints, allowing you to create, delete, enable, or disable webhooks programmatically:

    • POST a new webhook using code, rather than manually creating them by hand in the Nylas dashboard
    • Update an existing webhooks state to “active” or “inactive”
    • DELETE webhooks through the Nylas API, rather than having to visit the Dashboard to do so

    This is particularly helpful in cases where your servers experience extended downtime, causing your webhook to de-activate. Now, you can now programmatically detect and re-enable the webhook without your customers even noticing a disruption.

    Let’s take a look at some examples; the first shows how to create a webhook that is triggered whenever a message is opened.

    curl -X POST \
      https://api.nylas.com/a/{client_id}/webhooks/ \ 
      -H 'Authorization: Basic mYSuP3rSecR3tB4s1cAutHtOk3n=' \ 
      -H 'Content-Type: application/json' \ 
      -d '{
        "callback_url": "https://example.com/webook",
        "triggers": ["message.opened"],
        "state": "active" 
      }'

    The next example shows how to update the status of a webhook.

    curl -X PUT \
      https://api.nylas.com/a/{client_id}/webhooks/{id} \
      -H 'Authorization: Basic mYSuP3rSecR3tB4s1cAutHtOk3n=' \
      -H 'Content-Type: application/json' \ 
      -d '{
        "state": "inactive" 
      }'

    You can find more information about programmatic webhooks in our docs:

    Happy building!

    Related resources

    Dev code sample

    Key Takeaways This post will provide a complete walkthrough for integrating an email API focused…

    Nylas’ 2024 predictions: Navigating AI, connectivity, and the future of work

    Explore the transformative impact of AI, the evolution of global connectivity, and the reshaping of workplace culture in the digital era in Nylas’ 2024 predictions.

    Grouping email threads with Ruby and Nylas

    Use the Nylas Email API and Ruby to group email threads into a single view, and easily access complete conversations within your app.