[Beta] Event Subscriptions

Subscribe to events through webhooks

🚧

This Feature is in Beta

This means it is subject to change before full release. We won't make payload changes to existing events without versioning so feel free to use the feature for production-ready use cases. The reason we are in Beta is we want to add additional events to our catalog before a wider release.

📘

Submit Feedback

We are alway open to product feedback - whether it's more webhooks you want to see, enhancements to existing webhooks, or anything webhooks related! Submit feedback here.

With Event Subscriptions:

  • We're allowing you to subscribe directly to Samsara platform events without having to create an Alert first.
  • We're releasing a Webhooks REST API that allows you to automate the process of managing your webhooks - complete with full CRUD support.

If you're not familiar with our current webhooks framework, please read the Webhooks guide.

If you want to enable this feature, toggle this on for your Samsara Org via the Feature Management page.

Subscribing to events

You can now subscribe directly to Samsara platform events without having to create an Alert first.

Subscribing via the Dashboard

Visit the Settings > Webhooks page, and add events to an existing or new Webhook:

Subscribing via API

Use the Webhooks APIs to create webhook definitions and subscribe them to events.

For example, the following POST request creates a new webhook and subscribes it to the DocumentSubmitted event:

curl --request POST 'https://api.samsara.com/webhooks' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Test Event Subscriptions",
    "url": "https://webhook.site/80f1fbfb-2721-4d7f-a8a6-ba314f0b6fed",
    "eventTypes": [
        "DocumentSubmitted"
    ]
}'

You can update the webhook's event subscriptions by using a PATCH request to update the eventTypes array. Note that PATCH requests replace the existing value for a given array, so you'll need to include the full list of desired subscriptions in the eventTypes array with each request. The example below adds the VehicleCreated event subscription to the webhook created above. (Note that we must still include the original DocumentSubmitted subscription as well).

curl --request PATCH 'https://api.samsara.com/webhooks/<id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "eventTypes": [
        "DocumentSubmitted",
        "VehicleCreated"
    ]
}'

Event Schemas

See all currently available Event Schemas under Webhooks 2.0 Reference.