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:
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:
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.
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:
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.
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:
activities.fully_syncedto 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:
accountis the account ID, and
available_toare timestamps from the webhook payload.
activities.addedto 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_totimestamps from the webhook payload.
activities.updatedto 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_to)along with an array of activity IDs that were updated (
updated_activities) to make syncing of the data more convenient.