Skip to main content

Subscriber Update

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

subscriberId: ID!

The ID for the subscriber to be updated.

subscriberParams: UpdateSubscriberFields!

The input object for updating a Subscriber

Return Type

Successful Responses

When the updateSubscriber mutation succeeds you can expect the response payload to look in one of two different ways:

  1. If you have created a Subscriber but have not yet created any Subscriptions the subscriptions field value will empty.

  2. If you have created subscriptions all 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
}
}
Did this answer your question?