Skip to content

Webhook subscriptions

Webhooks allow you to receive real-time notifications when specific events occur. This guide will introduce how to subscribe to and manage webhooks through Genstore's REST APIs or via embedded app configurations.

Use REST API to subscribe to webhook topics

You can easily create and manage webhook subscriptions using REST APIs. The following example demonstrates how to create a new webhook subscription for the event of order creation.

Create a webhook subscription

To create a new webhook subscription, you need to provide the destination address and the topic name you are interested in:

bash
curl -d '{"webhook":{"address":"https://appURL:topicName","topic":"orders/create"}}' \
-X POST "https://{shop}.genmystore.com/api/202412/webhooks.json" \
-H "X-Genstore-Access-Token: {access_token}" \
-H "Content-Type: application/json"

Example of a successful response:

json
HTTP/1.1 201 Created
{
  "webhook": {
    "id": 8589934859,
    "address": ""https://appURL:topicName",
    "topic": "orders/create",
    "createTime": "2024-10-30T16:19:13-04:00",
    "updateTime": "2024-10-30T16:19:13-04:00",
  }
}

Manage webhook subscriptions

Below are some common REST API operations that can help you manage your webhook subscriptions:

REST APIVERSIONMETHODURI
Create webhook202412POST/app/webhooks
Delete webhook202412DEL/app/webhooks/
Update webhook202412PUT/app/webhooks/
List webhook202412GET/app/webhooks
Retrieve webhook202412GET/app/webhooks/
Count webhook202412GET/app/webhooks/count

Manage webhooks via embedded apps

This section will be detailed in future versions. Stay tuned.