Skip to content

About webhook

Access scope

Multiple access scopes needed — refer to each endpoint for access scope requirements.

Genstore provides webhook subscriptions to help developers receive platform event notifications. Applications can receive these events by subscribing to specific webhook topics. Genstore offers a set of REST APIs for managing webhook subscriptions, including registration, deletion, updating, and querying.

Core Features

  • Register webhooks and callback URLs
  • Delete webhook subscriptions
  • Update webhook subscriptions
  • Query webhook lists and details
  • Get webhook subscription count

WARNING

  • Webhook notifications do not guarantee the order of events.

  • After 8 consecutive failures, the system will cease attempts to send notifications, which may result in data loss.

Use Cases

  • Order Data Sync: When applications need real-time order data from a store, they can subscribe to the orders/create topic to receive new order data instantly.
  • Customer Data Sync: When applications need real-time customer data from a store, they can subscribe to the customers/create topic to receive new member data instantly.

Webhook Object

Create and manage webhook subscription.

Properties

webhookobject
The Webhook object generated by the subscription message.
- Hide child properties
idnumber
Unique numeric identifier for the webhook subscription.
topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
createTimestring
Date and time when the webhook subscription was created. The API returns this value in ISO 8601 format.
updateTimestring
Date and time when the webhook subscription was updated. The API returns this value in ISO 8601 format.
bash
{
  "webhook": {
    "address": "https://apple.com/uninstall",
    "createTime": "2024-10-25T11:06:48+08:00",
    "topic": "blazeTest/event1",
    "updateTime": "2024-10-31T10:55:12+08:00",
    "id": "123456"
  }
}

POST Create webhook

Create a new webhook subscription by specifying both an address and a topic.

Access scope

Requires ANY of the following access scopes: write_apps

Endpoint

POST /api/202412/app/webhooks 

Request Params

webhookobject
- Hide child properties
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
topicstring
Event that triggers the webhook. You can retrieve data in JSON.

Response Data

webhookobject
- Hide child properties
idnumber
Unique numeric identifier for the webhook subscription.
topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
createTimestring
Date and time when the webhook subscription was created. The API returns this value in ISO 8601 format.
updateTimestring
Date and time when the webhook subscription was updated. The API returns this value in ISO 8601 format.
bash
curl -X POST \ 
https://{shop}.genmystore.com/api/202412/app/webhooks" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"webhook":{
		"address":"blazeTest/event1",
		"topic":"https://apple.com/uninstall"
	}
}'
json
HTTP/1.1 200 OK
{
  "webhook": {
    "address": "https://apple.com/uninstall",
    "createTime": "2024-10-25T11:06:48+08:00",
    "topic": "blazeTest/event1",
    "updateTime": "2024-10-31T10:55:12+08:00",
    "id": "123456"
  }
}

PUT Update webhook

Update a webhook subscription's topic or address URIs.

Access scope

Requires ANY of the following access scopes: write_apps

Endpoint

PUT /api/202412/app/webhooks/{webhookId} 

Request Params

webhookIdnumber
Unique numeric identifier for the webhook subscription.
webhookobject
Request body.
+ Show child properties

Response Data

webhookobject
- Hide child properties
idnumber
Unique numeric identifier for the webh...
topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
createTimestring
Date and time when the webhook subscription was created. The API returns this value in ISO 8601 format.
updateTimestring
Date and time when the webhook subscription was updated. The API returns this value in ISO 8601 format.
bash
curl -X PUT \ 
https://{shop}.genmystore.com/api/202412/app/webhooks/{webhookId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"webhookId":"123456",
	"webhook":{
		"address":"https://apple.com/uninstall",
		"id":"123456"
	}
}'
json
HTTP/1.1 200 OK
{
  "webhook": {
    "address": "https://apple.com/unins...",
    "createTime": "2024-10-25T11:06:48+08:00",
    "topic": "blazeTest/event1",
    "updateTime": "2024-10-31T10:55:12+08:00",
    "id": "123456"
  }
}

DELETE Delete webhook

Delete a webhook subscription.

Access scope

Requires ANY of the following access scopes: write_apps

Endpoint

DELETE /api/202412/app/webhooks/{webhookId} 

Request Params

webhookIdnumber
Unique numeric identifier for the webhook subscription.

Response Data

{}
bash
curl -X DELETE \ 
https://{shop}.genmystore.com/api/202412/app/webhooks/{webhookId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{}

GET Get webhook list

Retrieves a list of webhooks.

Access scope

Requires ANY of the following access scopes: write_apps read_apps

Endpoint

GET /api/202412/app/webhooks 

Request Params

addressstring
Retrieve webhook subscriptions that send the POST request to this URI.
createTimeMaxstring
Retrieve webhook subscriptions that were created before a given date and time (format: 2014-04-25T16:15:47-04:00).
createTimeMinstring
Retrieve webhook subscriptions that were created after a given date and time (format: 2014-04-25T16:15:47-04:00).
limitnumber
Maximum number of webhook subscriptions that should be returned. Setting this parameter outside the maximum range will return an error.
sinceIdnumber
Restrict the returned list to webhook subscriptions whose id is greater than the specified since_id.
topicstring
Show webhook subscriptions with a given topic. For valid values, refer to the list of event topics.
updateTimeMaxstring
Retrieve webhooks that were updated after a given date and time (format: 2014-04-25T16:15:47-04:00).
updateTimeMinstring
Retrieve webhooks that were updated before a given date and time (format: 2014-04-25T16:15:47-04:00).

Response Data

webhooksarray
- Hide child properties
idnumber
Unique numeric identifier for the webhook subscription.
topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
createTimestring
Date and time when the webhook subscription was created. The API returns this value in ISO 8601 format.
updateTimestring
Date and time when the webhook subscription was updated. The API returns this value in ISO 8601 format.
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/app/webhooks" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "webhooks": [
    {
      "address": "https://apple.com/uninstall",
      "createTime": "2024-10-25T11:06:48+08:00",
      "topic": "blazeTest/event1",
      "updateTime": "2024-10-31T10:55:12+08:00",
      "id": "123456"
    }
  ]
}

GET Get webhook details

Retrieve a single webhook subscription. The properties desired in the result can be specified.

Access scope

Requires ANY of the following access scopes: write_apps read_apps

Endpoint

GET /api/202412/app/webhooks/{webhookId} 

Request Params

webhookIdnumber
Unique numeric identifier for the webhook subscription.

Response Data

webhookobject
- Hide child properties
idnumber
Unique numeric identifier for the webhook subscription.
topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.
createTimestring
Date and time when the webhook subscription was created. The API returns this value in ISO 8601 format.
updateTimestring
Date and time when the webhook subscription was updated. The API returns this value in ISO 8601 format.
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/app/webhooks/{webhookId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "webhook": {
    "address": "https://apple.com/uninstall",
    "createTime": "2024-10-25T11:06:48+08:00",
    "topic": "blazeTest/event1",
    "updateTime": "2024-10-31T10:55:12+08:00",
    "id": "123456"
  }
}

GET Get webhook count

Retrieve a count of existing webhook subscriptions. The results can be filtered by address or by topic.

Access scope

Requires ANY of the following access scopes: write_apps read_apps

Endpoint

GET /api/202412/app/webhooks/count 

Request Params

topicstring
Event that triggers the webhook. You can retrieve data in JSON.
addressstring
Destination URI to which the webhook subscription should send the POST request when an event occurs.

Response Data

countnumber
A count of existing webhook subscriptions.
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/app/webhooks/count" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "count": "21"
}