Step 3: create a webhook
Let's try creating a webhook. For this, you can choose to use either the webhook event type's name or its ID.
In this example, we're creating an AccountActivated
webhook by providing the webhookEventTypeName
.
SandboxProduction
curl -i -X POST \
https://api-sandbox.equalsmoney.com/v2/webhooks \
-H 'Authorization: ApiKey {apiKey}' \
-H 'Content-Type: application/json' \
-d '{
"enabled": true,
"accountId": "{accountId}",
"webhookEventTypeName": "AccountActivated",
"url": "{webhookUrl}"
}'
curl -i -X POST \
https://api.equalsmoney.com/v2/webhooks \
-H 'Authorization: ApiKey {apiKey}' \
-H 'Content-Type: application/json' \
-d '{
"enabled": true,
"accountId": "{accountId}",
"webhookEventTypeName": "AccountActivated",
"url": "{webhookUrl}"
}'
If your request is successful, you'll receive a 201
response.
{
"id": "542609c1-8bf9-46b1-830f-4b87d09d3cf1", # The ID of the newly-created webhook
"enabled": true,
"accountId": "F12345",
"url": "https://webhook.site/07a975c2-3f9d-4952-8ea5-98dc688cab7c",
"productId": "d926625b-5e11-4ec1-b4cd-0af2a8021efc",
"webhookEventTypeId": "a4dcc403-41aa-4f2e-acf6-32dbaec78e72", # The ID of the webhook event type
"updatedAt": "2024-01-09T10:33:33.095Z",
"createdAt": "2024-01-09T10:33:33.095Z",
"webhookEventTypeName": "AccountActivated"
}