/webhooks
Use this resource to view and create new webhooks. Webhooks consist of the event type that the webhook should execute on, and the URL that TMS will POST to when the webhook executes.
TMS will POST data to the URL you provide using the application/x-www-form-urlencoded
Content-Type. Below is an example of the payload that TMS will POST:
completed_at=2015-08-05+18%3A47%3A18+UTC&message_type=sms&message_url=https%3A%2F%2Ftms.govdelivery.com%2Fmessages%2Fsms%2F295117&recipient_url=https%3A%2F%2Ftms.govdelivery.com%2Fmessages%2Fsms%2F295117%2Frecipients%2F373810&sid=e6c48d6d2e4ad639ac4ef6cadd386ed7&status=sent
Lists your webhooks
Responses with more than 50 records will be paginated to 50 records per response, unless otherwise specified.
Headers
Name | Required | Type | Description |
---|---|---|---|
X-AUTH-TOKEN | * | string |
An authentication token provided to you by GovDelivery. |
Headers
Name | Type | Description |
---|---|---|
Link | string |
Appropriate pagination link relations. Can include “first”, “last”, “prev”, and “next” relations. Example
|
Body
Example
[
{
"url": "http://youragencysite.com/api/message_events",
"event_type": "failed",
"created_at": "2015-04-10T19:12:31Z",
"_links": {
"self": "/webhooks/21768"
}
},
{
"url": "http://youragencysite.com/api/message_events",
"event_type": "sent",
"created_at": "2015-02-02T18:55:15Z",
"_links": {
"self": "/webhooks/18949"
}
}
]
Schema
Name | Type | Description |
---|---|---|
url | string |
The URL that the webhook will POST to when it executes. Example
|
event_type | string |
The type of message delivery event the webhook will execute on. Each event represents the state that a specific recipient has entered (e.g. the ‘failed’ event_type indicates that the recipient has entered the ‘failed’ state).
Valid Values:
Example
|
created_at | string |
The date and time when the webhook was created. Example
|
_links | object |
An object that defines links to related objects. Properties
|
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Webhooks",
"description": "Create a new webhook to have TMS execute while delivering a message.",
"type": "array",
"items": {
"title": "Webhook",
"type": "object",
"properties": {
"url": {
"description": "The URL that the webhook will POST to when it executes.\n",
"type": "string",
"example": "http://youragencysite.com/api/message_events"
},
"event_type": {
"description": "The type of message delivery event the webhook will execute on.\nEach event represents the state that a specific recipient has \nentered (e.g. the 'failed' event_type indicates that the recipient\nhas entered the 'failed' state).\n\n- sending: TMS is attempting to send the message to the recipient.\n- sent: TMS has successfully delivered the message to the recipient.\n- blacklisted: The recipient is on the delivery blacklist, thus the \n message was not delivered to the recipient.\n- canceled: Delivery of this message was canceled, thus the message\n was not delivered to the recipient.\n- failed: TMS encountered an error while attempting to deliver the\n message to the recipeint.\n- inconclusive: TMS has attempted to deliver the message to the\n recipient, but has not received notification of a successful \n nor failed delivery.\n",
"type": "string",
"enum": [
"sending",
"sent",
"canceled",
"blacklisted",
"failed",
"inconclusive"
],
"example": "sent"
},
"created_at": {
"description": "The date and time when the webhook was created.",
"type": "string",
"example": "2015-04-10T19:12:31Z"
},
"_links": {
"title": "Relational Links",
"description": "An object that defines links to related objects.",
"type": "object",
"properties": {
"self": {
"description": "Relative URI of the object",
"type": "string",
"example": "/webhooks/10040"
}
}
}
}
}
}
Body
Example
{
"error": "Invalid authentication token"
}
Create a new webhook to have TMS execute while delivering a message.
Headers
Name | Required | Type | Description |
---|---|---|---|
X-AUTH-TOKEN | * | string |
An authentication token provided to you by GovDelivery. |
Body
Example
{
"url": "http://youragencysite.com/api/message_events",
"event_type": "failed"
}
Schema
Name | Required | Type | Description |
---|---|---|---|
url | * | string |
The URL that the webhook will POST to when it executes. Example
|
event_type | * | string |
The type of message delivery event the webhook will execute on. Each event represents the state that a specific recipient has entered (e.g. the ‘failed’ event_type indicates that the recipient has entered the ‘failed’ state).
Valid Values:
Example
|
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "/webhooks",
"description": "Create a new webhook to have TMS execute while delivering a message.\n",
"type": "object",
"properties": {
"url": {
"description": "The URL that the webhook will POST to when it executes.\n",
"type": "string",
"example": "http://youragencysite.com/api/message_events"
},
"event_type": {
"description": "The type of message delivery event the webhook will execute on.\nEach event represents the state that a specific recipient has \nentered (e.g. the 'failed' event_type indicates that the recipient\nhas entered the 'failed' state).\n\n- sending: TMS is attempting to send the message to the recipient.\n- sent: TMS has successfully delivered the message to the recipient.\n- blacklisted: The recipient is on the delivery blacklist, thus the \n message was not delivered to the recipient.\n- canceled: Delivery of this message was canceled, thus the message\n was not delivered to the recipient.\n- failed: TMS encountered an error while attempting to deliver the\n message to the recipeint.\n- inconclusive: TMS has attempted to deliver the message to the\n recipient, but has not received notification of a successful \n nor failed delivery.\n",
"type": "string",
"enum": [
"sending",
"sent",
"canceled",
"blacklisted",
"failed",
"inconclusive"
],
"example": "sent"
}
},
"required": [
"url",
"event_type"
]
}
Form Parameters
Name | Required | Type | Description |
---|---|---|---|
url | * | string |
The URL that the webhook will POST to when it executes. Example
|
event_type | * | string |
The type of message delivery event the webhook will execute on. Each event represents the state that a specific recipient has entered (e.g. the ‘failed’ event_type indicates that the recipient has entered the ‘failed’ state).
Valid Values:
Example
|
Body
Example
{
"url": "http://youragencysite.com/api/message_events",
"event_type": "failed",
"created_at": "2015-04-10T19:12:31Z",
"_links": {
"self": "/webhooks/21768"
}
}
Description
Unprocessable Entity
Body
Example
{
"url":"",
"event_type": "struck_gold",
"created_at":null,
"errors":{
"url":[
"can't be blank"
],
"event_type": [
"struck_gold is not a valid event type"
]
}
}
Body
Example
{
"error": "Invalid authentication token"
}