Updating Subscribers
The updateSubscriber mutation provides the ability to need to change the name and webhookUrl of your Subscriber.
At present webhook Secrets are not able to be changed
Mutation
Mutation
mutation UpdateSubscriber(
$subscriberId: ID!
$subscriberParams: UpdateSubscriberFields!
) {
updateSubscriber(
subscriberId: $subscriberId
subscriberParams: $subscriberParams
) {
subscriber {
id
name
subscriptions {
subscriberId
parentId
parentEntity
eventEntity
eventKey
}
webhookUrl
}
}
}
Variables
Variables
{
"subscriberId": "your-subscriber-id",
"subscriberParams": {
"name": "Example Provider Updated - Example Brand",
"webhookUrl": "https://example.net/subscriptions-updated"
}
}
Arguments
Argument Name | Description |
| The ID for the subscriber to be updated. |
| The input object for updating a Subscriber |
Return Type
Returns a UpdateSubscriberPayload.
Successful Responses
When the updateSubscriber mutation succeeds you can expect the response payload to look in one of two different ways:
If you have created a Subscriber but have not yet created any Subscriptions the
subscriptionsfield value will empty.If you have created
subscriptionsall of them for the Subscriber will be returned.
Response - Without Subscriptions
{
"data": {
"subscribers": [
{
"id": "your-subscriber-id",
"name": "Example Provider Updated - Example Brand",
"subscriptions": [],
"webhookUrl": "https://example.net/subscriptions-updated"
}
]
}
}
Response - With Subscriptions
{
"data": {
"subscribers": [
{
"id": "your-subscriber-id",
"name": "Example Provider Updated - Example Brand",
"subscriptions": [
{
"eventEntity": "Order",
"eventKey": "accepted",
"parentEntity": "Caterer",
"parentId": "ezcater-caterer-id",
"subscriberId": "your-subscriber-id"
}
],
"webhookUrl": "https://example.net/subscriptions-updated"
}
]
}
}
Failure Responses
When updateSubscriber mutation fails you can expect the response payload to look like:
Response
{
"errors": [
{
"message": "Subscriber could not be updated.",
"path": [
"updateSubscriber"
],
"extensions": {
"type": "summary",
"serviceName": "external-events",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "Subscriber could not be updated.",
"locations": [
{
"line": 1,
"column": 107
}
],
"path": [
"updateSubscriber"
]
}
}
}
],
"data": {
"updateSubscriber": null
}
}