The Webhook API enables integrators to subscribe to specific events on the Synctera platform.
POST
request to the predefined URL about the transaction. With webhooks, Synctera will push updates to the integrator instead of the integrator pulling updates.
event_types
field. The following example shows how to subscribe to account updates and customer events. Use the request body of POST /v0/webhooks
to create a webhook. enabled_events
specifies that this webhook should be invoked whenever an account is updated, or when anything happens to a customer. Once such an event occurs, the Webhook API sends a POST
request to https://example.com
.
<resource>.[<sub-resource>.]<action>
naming convention. For example, ACCOUNT.UPDATED
means an account was updated. Resources can have sub-resources: TRANSACTIONS.POSTED.CREATED
means to subscribe to changes of the sub-resource TRANSACTION.POSTED
. You can also use a wildcard *
for convenience purposes. For example, you can use it after a <resource>
like CUSTOMER.*
, which allows you to receive notifications for all the customer events without explicitly listing all of them. Note that Synctera will continuously add more events, so the webhook will automatically subscribe to any new events added to <resource>
and send requests.
Create a Signature Secret for Request Validation
POST /v0/webhook_secrets
with an empty request body:PUT /v0/webhook_secrets
to deprecate the old secret and generate a new one. Set the is_rolling_secret
field to true
to generate the new secret without deleting the old secret right away.DELETE /v0/webhook_secrets?old_secret_only=true
Implement a Server to Receive Webhook Requests
webhook_request_object
.Request HeadersThe request uses the POST
method and contains the following headers:Synctera-Signature
- This is the signature of the request. Use the signature secret generated from step 2 to verify the request body.Request-Timestamp
- The time when Synctera’s platform sent the request, as a POSIX timestamp: seconds since 1970-01-01 00:00:00 UTC.Content-Type
- Has the value application/json
.id
- The current event IDurl
- The URL that you specified in your webhook, also the endpoint you will receive this request.webhook_id
- The ID of the webhook that sends out this requesttype
- The event typemetadata
- The same value as the metadata
defines in the webhookevent_resource
Escaped JSON string representing the <resource>
of the event. If the type has <sub-resource>
, then the string represents the sub-resource.event_resource_changed_fields
Escaped JSON string representing the top level fields that have been updated by the event, containing the value prior to the event. Only update event includes this field.{"a": 1, "b": 2, "c": 3, "n": {"m": 1}}
{"a": 4, "c": 3, "d": 5, "n": {"m": 1, "p": 2}}
event_resource
is just the “object after change” itself.event_resource_changed_fields
is {"a": 1, "b": 2, "d": null, "n": {"m": 1}}
because:a
has value changed, value in before-change object
is 1b
is deleted from the object, value in before-change object
is 2c
is not changed, so it is not included in event_resource_changed_fields
d
is added to the object, value is null because before-change object
does not have itn
is a nested object where sub-field p
is added. Note that the old value of the entire top level field (n)
is included in the old value, and that added sub-fields (e.g. p
) are not included.event_resource_changed_fields
from the original request body means the account resource has been updated. The account status was changed from RESTRICTED
to ACTIVE_OR_DISBURSED
.Request ValidationThe Synctera-Signature
is generated via HMAC with SHA256 hash and the signature secret as the key. The expected value of the Synctera-Signature
is HMAC256({request_timestamp} + '.' + {request_body}, {signature_secret_key})
. Your service should validate the header matches what you expect.Furthermore, Synctera-Signature
may include two signature strings delimited by .
during the rolling secret period, which the old and new signature secrets generate.now()
200
response to indicate that the application processed the request successfully. Any 4xx
or 5xx
level code will be considered a failure on the application side. The Webhook API will retry the same request with exponential backoff until a successful response is received or 55 hours have passed. Events (successful or failed) are retained for 60 days.Request timeoutWebhook requests will timeout after 5 seconds. Should a webhook request timeout, Synctera will automatically retry with exponential back off.Create a Webhook Subscription for Events
POST /v0/webhooks
endpoint to create a webhook subscription. For example, If you have deployed your new service so it is accessible on the public Internet at https://api.example.com/webhook
:url
is the endpoint that Synctera’s webhook service will send requests todescription
is a brief string that you use to describe the purpose of this webhook (mainly as a reminder to yourself)enabled_events
is the list of events that the webhook should subscribe tometadata
is an arbitrary string which will be included in every request body as the field metadata
is_enabled
means the webhook should send requests for matching events; if false, events will be ignoredACCOUNT.*
, will send all webhooks for all events that match that pattern. Note that this can include new event types added after the subscription was created.Triggering Events
POST /v0/webhooks/trigger
fires a mock event on the Synctera platform, which triggers all the webhooks that match the event (specified in the request body) to send out a request. This will help debug the application without having to CRUD on the actual resource. However, note that the webhook response body will NOT contain event_resource
in this case.GET /v0/webhooks/<webhook_id>/events/<event_id>
returns the event with the history of the request sent, including those failed attempts with the response body.POST /v0/webhooks/<webhook_id>/events/<event_id>/resend
will trigger it to send the webhook request with the same event again, without waiting for the next automatic retry attempt.