Creating Subscribers
A Subscriber represents the integration itself. The Subscriber will manage where event notifications are sent to as well as what events you want to subscribe to.
We currently only support creating one Subscriber per API user. If you are seeing errors that your subscriber could not be created, it may be that one has already been set up. Try running the Subscriber List query to see if any already exist.
Mutation
To create the Subscriber, simply make a createSubscriber mutation request as seen in the example below.
Make sure you include the webhookSecret fields in the mutation, it will only be returned when initially creating a subscription, so be sure to save the value!
You will also need the Subscriber id in subsequent steps, so we recommend keeping track of it now
Mutation
mutation CreateSubscriber($subscriberParams: CreateSubscriberFields!) {
createSubscriber(subscriberParams: $subscriberParams) {
subscriber {
id
name
subscriptions {
eventEntity
eventKey
parentEntity
parentId
subscriberId
}
webhookSecret
webhookUrl
}
}
}
Variables
Variables
{
"subscriberParams": {
"name": "Example Provider - Example Brand",
"webhookUrl": "https://example.net/subscriptions"
}
}
Arguments
Argument Name | Description |
| The input object for making a new subscriber. |
Return Type
Returns a CreateSubscriberPayload.
Successful Responses
When the createSubscriber mutation succeeds you can expect the response payload to look like:
Response
{
"data": {
"createSubscriber": {
"subscriber": {
"id": "your-subscriber-id",
"name": "Example Provider - Example Brand",
"subscriptions": [],
"webhookSecret": "be6efd0f8e88fec0d51364559ca9a258e70031f7f38448ea2e9705928a929a8d",
"webhookUrl": "https://example.net/subscriptions"
}
}
}
}
Failure Responses
When the createSubscriber mutation fails you can expect the response payload to look like:
Response
{
"errors": [
{
"message": "Subscriber could not be created.",
"path": [
"createSubscriber"
],
"extensions": {
"type": "summary",
"serviceName": "external-events",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "Subscriber could not be created.",
"locations": [
{
"line": 1,
"column": 90
}
],
"path": [
"createSubscriber"
]
}
}
}
],
"data": {
"createSubscriber": null
}
}