Webhooks let other applications subscribe to be notified when certain events happen in your Mode organization. You can use webhooks to do automate workflows and trigger other applications. For example:

  • Trigger a Zap in Zapier
  • Send a customized Slack alert when a Mode report finishes running
  • Log usage of your Mode organization

When you set up a webhook, Mode will send a POST message to a URL of your choice in real-time. The message payload contains the name of the event and a link to the API endpoint associated with that event. Mode’s webhooks are designed to be light weight and secure, since the payload itself does not contain sensitive information.

We’ll periodically add support for new webhook events. If you have ideas for new events you’d like to see in Mode, please let our success team know. You can learn more about what’s possible by viewing sample code in our webhooks example repo and refer to Mode’s API documentation.

Create and subscribe to a webhook

  1. On the top left of Mode home page, click on your account and select Organization Settings.
  2. Select Webhooks from the left navigation panel and then click Add New Webhook.
  3. Add a Target URL, Description, and an event to subscribe to.
  4. When you click Create Webhook, Mode will send a test event to the target URL to make sure the response is successful.

Event types and payload structures

Each subscription will send a simple POST message to the subscribed URL containing a JSON object with information about the event. The body of each POST message is succinct, but varies according to the event type. You can access the included URL to learn more about the included resource.

New report is created

{ "event": "report_created", "report_run_url": "https://modeanalytics.com/api/[ORG_TOKEN]/reports/[REPORT_TOKEN]" }

Report starts running

{ "event": "report_run_started", "report_run_url": "https://modeanalytics.com/api/[ORG_TOKEN]/reports/[REPORT_TOKEN]/runs/[RUN_TOKEN]" }

Report finishes running

{ "event": "report_run_completed", "report_run_url": "https://modeanalytics.com/api/[ORG_TOKEN]/reports/[REPORT_TOKEN]/runs/[RUN_TOKEN]" }

Definition is created

{ "event": "definition_created", "definition_url": "https://modeanalytics.com/api/[ORG_TOKEN]/definitions/[DEFINITION_TOKEN]" }

Definition is updated

{ "event": "definition_updated", "definition_url": "https://modeanalytics.com/api/[ORG_TOKEN]/definitions/[DEFINITION_TOKEN]" }

Database is connected

{ "event": "new_database_connection", "connection_url": "https://modeanalytics.com/api/[ORG_TOKEN]/data_sources/[DATA_SOURCE_TOKEN]" }

Someone joins your organization

{ "event": "member_joined_organization", "member_url": "https://modeanalytics.com/api/[ORG_TOKEN]/memberships/[MEMBERSHIP_TOKEN]?embed[user]=1" }

Someone leaves your organization

{ "event": "member_removed_from_organization", "member_url": "https://modeanalytics.com/api/[ORG_TOKEN]/memberships/[MEMBERSHIP_TOKEN]?embed[user]=1" }

Last updated May 17, 2018