This is the documentation for 2021-02-23 but the latest version is 2022-02-01. You can switch versions in the menu.

Webhooks

You can configure webhook endpoints via the API to be notified about events that happen in Smake.

You can create up to 10 webhooks per event.

Available Events

Currently, these are all events you can listen to:

  • order.shipped
  • order.cancelled
  • shipping-rate.calculated
  • variant.designed
  • id-tag.updated

List

Request

GET /webhooks HTTP/1.1

Response

{
    "data": [
        {
            "id": 1,
            "is_test": true,
            "url": "https://requestb.in/xjggz4xj",
            "event_types": [
                {
                    "id": 1,
                    "name": "order.shipped"
                }
            ]
        },
        {
            "id": 2,
            "is_test": true,
            "url": "https://requestb.in/1hd29kc1",
            "event_types": [
                {
                    "id": 1,
                    "name": "order.shipped"
                }
            ]
        }
    ],
    "links": {
        "first": "https://api.smake.io/v2/webhooks?page=1",
        "last": "https://api.smake.io/v2/webhooks?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://api.smake.io/v2/webhooks",
        "per_page": 25,
        "to": 2,
    }
}

Get

Request

GET /webhooks/1 HTTP/1.1

Response

{
    "id": 1,
    "is_test": true,
    "url": "https://requestb.in/xjggz4xj",
    "event_types": [
        {
            "id": 1,
            "name": "order.shipped"
        }
    ]
}

Create

Attributes

Field Type Description Required
url string The URL to listen for incoming POST notification containing event information. yes
token string A token to secure your url
event_types array An array of Event-Type Objects yes

Event-Type Object

Back to Attributes

Field Type Description Required
name string name yes

Request

POST /webhooks HTTP/1.1

{
    "url": "https://requestb.in/1hd29kc1",
    "token": "my-secret-token",
    "event_types": [
        {
            "name": "order.shipped"
        }
    ]
}

Response

{
    "id": 2,
    "is_test": true,
    "url": "https://requestb.in/1hd29kc1",
    "event_types": [
        {
            "id": 1,
            "name": "order.shipped"
        }
    ]
}

Update

Request

PUT /webhooks/1 HTTP/1.1

{
    "url": "http://example.com"
}

Response

{
    "id": 1,
    "is_test": true,
    "url": "http://example.com",
    "event_types": [
        {
            "id": 1,
            "name": "order.shipped"
        }
    ]
}

Delete

Request

DELETE /webhooks/1 HTTP/1.1