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 API | VERSION | METHOD | URI |
---|---|---|---|
Create webhook | 202412 | POST | /app/webhooks |
Delete webhook | 202412 | DEL | /app/webhooks/ |
Update webhook | 202412 | PUT | /app/webhooks/ |
List webhook | 202412 | GET | /app/webhooks |
Retrieve webhook | 202412 | GET | /app/webhooks/ |
Count webhook | 202412 | GET | /app/webhooks/count |
Manage webhooks via embedded apps
This section will be detailed in future versions. Stay tuned.