This is the documentation for 2022-02-01.

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.completed
  • order.prepared
  • order.failed
  • order.cancelled
  • variant.completed
  • variant.failed
  • logo.completed
  • logo.failed
  • shipment.prepared

List

Request

GET /webhooks HTTP/1.1

Response

{
    "data": [
        {
            "id": 1,
            "description": {
                "en": "This is webhook listens to the order completed event."
            },
            "version": "2022-02-01",
            "state": "active",
            "url": "https://requestb.in/xjggz4xj",
            "events": [
                {
                    "id": 3,
                    "name": "order.completed"
                }
            ],
            "created_at": "2022-02-01T00:00:00+00:00",
            "updated_at": "2022-02-01T00:00:00+00:00"
        },
        {
            "id": 2,
            "description": {
                "en": "This is webhook listens to the order cancelled event."
            },
            "version": "2022-02-01",
            "state": "inactive",
            "url": "https://requestb.in/1hd29kc1",
            "events": [
                {
                    "id": 2,
                    "name": "order.cancelled"
                }
            ],
            "created_at": "2022-02-01T00:00:00+00:00",
            "updated_at": "2022-02-01T00:00:00+00:00"
        }
    ],
    "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,
    "description": {
        "en": "This is webhook listens to the order completed event."
    },
    "version": "2022-02-01",
    "state": "active",
    "url": "https://requestb.in/xjggz4xj",
    "events": [
        {
            "id": 3,
            "name": "order.completed"
        }
    ],
    "created_at": "2022-02-01T00:00:00+00:00",
    "updated_at": "2022-02-01T00:00:00+00:00"
}

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.
version string The version in which the information should be transformed to. Default: current api version
description json A json object of localized description.
state string State of the endpoint. Default: inactive
events array An array of Event Objects. yes

States

Back to Attributes

name Default
inactive yes
active

Event Object

Back to Attributes

Field Type Description Required
name string The internal name yes

Request

POST /webhooks HTTP/1.1

{
    "url": "https://requestb.in/1hd29kc1",
    "token": "my-secret-token",
    "description": {
        "en": "This is a description"
    },
    "state": "active",
    "events": [
        {
            "name": "order.completed"
        }
    ]
}

Response

{
    "id": 2,
    "description": {
        "en": "This is a description"
    },
    "version": "2022-02-01",
    "state": "active",
    "url": "https://requestb.in/1hd29kc1",
    "events": [
        {
            "id": 3,
            "name": "order.completed"
        }
    ],
    "created_at": "2022-02-01T00:00:00+00:00",
    "updated_at": "2022-02-01T00:00:00+00:00"
}

Update

Request

PUT /webhooks/1 HTTP/1.1

{
    "url": "http://example.com",
    "state": "inactive"
}

Response

{
    "id": 1,
    "description": {
        "en": "This is a description"
    },
    "version": "2022-02-01",
    "state": "inactive",
    "url": "http://example.com",
    "events": [
        {
            "id": 3,
            "name": "order.completed"
        }
    ],
    "created_at": "2022-02-01T00:00:00+00:00",
    "updated_at": "2022-02-01T00:00:00+00:00"
}

Delete

Request

DELETE /webhooks/1 HTTP/1.1