webhooks
Webhook endpoints, deliveries and replay. The `machinemail webhooks` commands: arguments, flags, examples and the API routes they call.
Webhook endpoints, deliveries and replay. Also spelled webhook.
| Command | Summary |
|---|---|
webhooks create | Create webhook |
webhooks delete | Delete webhook |
webhooks deliveries | List deliveries |
webhooks get | Get webhook |
webhooks list | List webhooks |
webhooks replay | Replay delivery |
webhooks test | Send test event |
webhooks update | Update webhook |
Every command also takes the global flags.
webhooks create
Create webhook.
The response includes secret (whsec_…), the key of the X-MachineMail-Signature HMAC. See the webhooks section of this document for the request MachineMail sends for each event type.
Under /v0/pods/{pod_id} or /v0/inboxes/{inbox_id}, or with a pod- or inbox-scoped credential, the webhook belongs to that pod or inbox (—pod, —inbox) and never receives events outside it.
A webhook delivers no event its creator could not read: each listed event type needs its read permission (message.* needs message_read, inbox.* inbox_read, domain.* domain_read, draft.* draft_read, webhook.test webhook_read), else 403. An empty —event-types from a credential without all of them is stored as the types it may read (403 when there are none).
Custom delivery headers are not supported.
Requires the webhook_create permission.
Flags
--inbox <inbox-id>string--pod <pod-id>string--url <url>string-e, --event-typesstring[]--client-id <id>string-d, --data <json|@file|->stringExamples
API
POST /v0/webhooksPOST /v0/inboxes/{inbox_id}/webhookswith--inboxPOST /v0/pods/{pod_id}/webhookswith--pod
webhooks delete
Delete webhook.
Also: machinemail webhooks rm.
Requires the webhook_delete permission.
Arguments
<webhook-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>stringExamples
API
DELETE /v0/webhooks/{webhook_id}DELETE /v0/inboxes/{inbox_id}/webhooks/{webhook_id}with--inboxDELETE /v0/pods/{pod_id}/webhooks/{webhook_id}with--pod
webhooks deliveries
List deliveries.
Delivery attempts of the webhook, one per event (a replay is a new delivery).
Requires the webhook_read permission.
Arguments
<webhook-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>string--limit <n>integer--page-token <value>string--ascendingboolean--statuspending | delivered | failed--allbooleanExamples
API
GET /v0/webhooks/{webhook_id}/deliveriesGET /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/deliverieswith--inboxGET /v0/pods/{pod_id}/webhooks/{webhook_id}/deliverieswith--pod
webhooks get
Get webhook.
Requires the webhook_read permission.
Arguments
<webhook-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>stringExamples
API
GET /v0/webhooks/{webhook_id}GET /v0/inboxes/{inbox_id}/webhooks/{webhook_id}with--inboxGET /v0/pods/{pod_id}/webhooks/{webhook_id}with--pod
webhooks list
List webhooks.
Also: machinemail webhooks ls.
With an organization credential, every webhook of the organization, paginated. With a pod or inbox credential (or under a scoped path), the webhooks in that scope from the newest 500, in one page without next_page_token.
Requires the webhook_read permission.
Flags
--inbox <inbox-id>string--pod <pod-id>string--limit <n>integer--page-token <value>string--ascendingboolean--allbooleanExamples
API
GET /v0/webhooksGET /v0/inboxes/{inbox_id}/webhookswith--inboxGET /v0/pods/{pod_id}/webhookswith--pod
webhooks replay
Replay delivery.
Queues a new delivery of the same event to the webhook and attempts it right away, even when the webhook is disabled. Returns the new delivery after that attempt.
Requires the webhook_update permission.
Arguments
<webhook-id>stringRequired<delivery-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>stringExamples
API
POST /v0/webhooks/{webhook_id}/deliveries/{delivery_id}/replayPOST /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/deliveries/{delivery_id}/replaywith--inboxPOST /v0/pods/{pod_id}/webhooks/{webhook_id}/deliveries/{delivery_id}/replaywith--pod
webhooks test
Send test event.
Records a webhook.test event and delivers it to this webhook only (whatever its event_types, even when disabled), then returns the delivery after the first attempt.
Requires the webhook_update permission.
Arguments
<webhook-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>stringExamples
API
POST /v0/webhooks/{webhook_id}/testPOST /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/testwith--inboxPOST /v0/pods/{pod_id}/webhooks/{webhook_id}/testwith--pod
webhooks update
Update webhook.
Fields you omit are unchanged. Webhooks are never disabled automatically after failed deliveries; —enabled=false is the only way to disable one. New —event-types follow the same permission rule as POST /v0/webhooks, and changing —url needs the read permission of every event type the webhook delivers (403 otherwise).
Requires the webhook_update permission.
Arguments
<webhook-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>string-e, --event-typesstring[]--enabledboolean--add-inbox-ids <id>string[]--remove-inbox-ids <id>string[]--add-pod-ids <id>string[]--remove-pod-ids <id>string[]--url <url>string-d, --data <json|@file|->string