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.
WARNING
In accordance with personal data protection policies, developers are required to provide a valid callback address and listen for the corresponding Webhook messages to ensure compliance with government privacy requirements.
Each app published through the Genstore App Store must subscribe to the following compliance webhook topics:
- customers/data_request: Customer data request
- customers/redact: Customer deleted (GDPR specification)
- shop/redact: Shop data redaction
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:
curl -d '{"webhook":{"address":"https://appURL:topicName","topic":"orders/create"}}' \
-X POST "https://{shop}.genmystore.com/api/202412/app/webhooks" \
-H "X-Genstore-Access-Token: {access_token}" \
-H "Content-Type: application/json"Example of a successful response:
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 |
Receiving Webhook messages
When the app receives a Webhook message, it should promptly return a 200 OK response to confirm successful receipt of the message. Any response outside the 200 range (including 3XX HTTP redirect codes) indicates the Webhook message was not successfully received, and Genstore will treat it as an error response.
Manage webhooks via embedded apps
This section will be detailed in future versions. Stay tuned.