Webhooks Guide

Learn how to get notified of any changes in your users' data.

Overview

Webhooks let you stay up-to-date with any new data added, updated, or deleted in real-time. For example, when the user links a new work account, Argyle will immediately call an http endpoint on your system to let you know about the event.

You can find the full list of webhook events in the Webhooks reference.

Argyle webhooks are delivered from a static IP address: 35.188.163.115

How to subscribe to webhooks

The webhook events you subscribe to are delivered for all accounts. Each time a new account is connected or an existing one is updated, a corresponding webhook will notify your system.

You can subscribe to webhooks by sending a POST request to Argyle's webhooks endpoint with the event name you want to subscribe to. Webhooks reference contains the list of examples for all webhook subscription calls.

You have to choose a random value for the secret parameter when subscribing to webhooks. You will use this value during signature validation to determine the authenticity of the webhook.

For example, if you subscribe to the activities.fully_synced event, every time all activities have finished syncing during the initial scan, the specified url will be invoked with the json payload specific to that event.

Here is an example payload for activities:

Signature validation

You will get a webhook payload body digest in the headers. To verify the authenticity of the webhook payload, you need to digest the received payload body by using HMAC-SHA512 and your secret as a key. Received body must be digested verbatim — no parsing and rerendering before providing bytes to the digest. If your digest matches the one that you received in headers, then the payload is authentic.

Example

For the following body:

the signature header would be:

where the secret to calculate the signature was:

Below is an example in Node:

Argyle webhooks are currently delivered from a single static IP address: 35.188.163.115

Verifying the authenticity via this IP is not recommended and should be used only as a fallback method because the IP address can change in the future.

Use case: keeping all activities on your system in sync

Here is how webhooks can help you to have all activity data downloaded on your own servers, and keep it in sync with our API:

  1. Subscribe to activities.fully_synced to get notified when the initial account sync of all historical data is finished. Whenever the webhook is invoked, query the activities from the API with the following query: /activities?from_start_date=available_from&account=account_id&to_start_date=available_to where account is the account ID, and available_from and available_to are timestamps from the webhook payload.
  2. Subscribe to activities.added to get notified when new activities are added after the initial sync. Argyle scans all accounts periodically for new activities and other changes in data. Use the same API call, but with added_from and added_to timestamps from the webhook payload.
  3. Subscribe to activities.updated to get notified when existing activities change. An example of this would be when additional information about a completed activity is passed along at a later time (e.g. tips for a completed delivery or ride). The webhook payload provides the date range that was updated (updated_from and updated_to) along with an array of activity IDs that were updated (updated_activities) to make syncing of the data more convenient.