Webhooks allow you to build or set up integrations which subscribe to certain events on the Shippify engine. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL.

Webhook Handling

Subscribing an URL to a webhook

Endpoint POST /hooks/companies/:company_id

  • Creates a webhook by subscribing an url to an specific event from the Shippify engine.

Schema

Request

{
"url" // Subscription URL string. (string),
"action" // Subscription event id from Shippify. See table below. (integer)
}

Example

curl
-X POST
-H 'Accept-Charset: utf-8'
-u '**APIKeyId**:**APISecretId*'
-d 'url=https://my_website_url.com'
-d 'action=2'
"https://api.shippify.co/hooks/companies/34"

Fetching all subscribed URLs

Endpoint GET /hooks/companies/:company_id

  • Fetches all urls subscribed through webhooks to a company's events.

Schema

Response

[
{ // Hook object
"url" // Subscription URL string. (string),
"action" // Subscription event id from Shippify. See table below. (integer)
"status" // Subscription URL status, active or blacklisted. (string)
}
]

Example

curl
-X GET
-u '**APIKeyId**:**APISecretId*'
"https://api.shippify.co/hooks/companies/54"

Payload

[
{
"action": 2,
"url": "https://my_website_webhook.com/url",
"status": "Active"
},
{
"action": 3,
"url": "https://my_faulty_website_webhook.com/url",
"status": "Banned"
}
]

Unsubscribing an URL to a webhook

Endpoint DELETE /hooks/companies/:company_id

  • Destroys a webhook by unsubscribing an url from an specific event from the Shippify engine.

Schema

Request

{
"url" // Subscription URL string. (string),
"action" // Subscription event id from Shippify. See table below. (integer)
}

Example

curl
-X DELETE
-H 'Accept-Charset: utf-8'
-u '**APIKeyId**:**APISecretId*'
-d 'url=https://my_website_url.com'
-d 'action=3'
"https://api.shippify.co/hooks/companies/34"

Shippify webhook event codes

Specification of event codes available for webhooks:

Status

Name

Description

1

Create task

Fires whenever a new task is created.

2

Create route

Files whenever a new route is created.

3

Update task

Fires whenever a task's fields is updated.

Create task

Payload

{
"id" // Task id. (string)
"distance" // Total task distance in kilometers. (double)
"price" // Shipping price. (double)
"currencySign" // Currency symbol used in the task's price. (string)
}

Create route

Payload

{
"route_id" // Route id. (string)
"distance" // Total route distance in kilometers. (double)
"date" // Route creation date. (string) (unix_timestamp)
"prices" [ // Ordered list of tasks composed in the rotue. (array)
"id" // Task id. (string)
"price" // Task discounted price. (string)
]
}

Update task

Payload

{
"id" // Task id. (string)
"status" // Task current status. (string) (task_status)
"company_id" // Company id assigned to task. (string)
"city_id" // City id assigned to task. (string)
}