Create a webhook
Creates a new webhook for a specific
type
and url
. Your application will be notified of updates to the chosen event type.Parameters
type
enum
The event type to be sent to this url. See webhook event types.
Required
url
string
The HTTPS URL receiving the webhook event.
Required
auth_token
string,null
Secret token for request validation. Will be sent as a
base64
encoded string in the Authorization
header of the webhook.Optional
Returns
Returns a webhook object.
- cURL
- Node.js
- Python
POST
/webhooks
curl https://production.methodfi.com/webhooks \
-X POST \
-H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
-H "Content-Type: application/json" \
-d '{
"type": "payment.update",
"url": "https://api.example.app/webhook",
"auth_token": "md7UqcTSmvXCBzPORDwOkE"
}'
POST
/webhooks
const webhook = await method.webhooks.create({
type: 'payment.update',
url: 'https://api.example.app/webhook',
auth_token: 'md7UqcTSmvXCBzPORDwOkE',
});
POST
/webhooks
webhook = method.webhooks.create({
'type': 'payment.update',
'url': 'https://api.example.app/webhook',
'auth_token': 'md7UqcTSmvXCBzPORDwOkE'
})
RESPONSE
{
"id": "whk_cSGjA6d9N8y8R",
"type": "payment.update",
"url": "https://api.example.app/webhook",
"auth_token": "md7UqcTSmvXCBzPORDwOkE",
"metadata": null,
"created_at": "2020-12-09T00:41:05.647Z",
"updated_at": "2020-12-09T00:41:05.647Z"
}