Menu
createSubscription
Create a message Subscription that delivers change events to an external queue (SQS, Pub/Sub, EventBridge, Azure Service Bus).
Use it in a workflow
- Add a step and choose the Commercetools connector.
- Pick the createSubscription action (under Create).
- Fill in the fields below, then reference the result from later steps as
{{createsubscription.response.data}}.
Query
This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.
mutation CreateSubscription($draft: SubscriptionDraft!) {
createSubscription(draft: $draft) {
key
destination {
type
}
messages {
resourceTypeId
types
}
changes {
resourceTypeId
}
events {
resourceTypeId
types
}
format {
type
}
status
id
version
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"draft": {
"destination": {
"SQS": {
"queueUrl": "string",
"region": "string",
"accessKey": "string",
"accessSecret": "string",
"authenticationMode": "string"
},
"SNS": {
"topicArn": "string",
"accessKey": "string",
"accessSecret": "string",
"authenticationMode": "string"
},
"AzureServiceBus": {
"connectionString": "string"
},
"EventGrid": {
"uri": "string",
"accessKey": "string"
},
"GoogleCloudPubSub": {
"projectId": "string",
"topic": "string"
},
"EventBridge": {
"region": "string",
"accountId": "string"
},
"ConfluentCloud": {
"bootstrapServer": "string",
"apiKey": "string",
"apiSecret": "string",
"acks": "string",
"topic": "string",
"key": "string"
}
},
"key": "string",
"messages": [
{
"resourceTypeId": "string",
"types": "string"
}
],
"changes": [
{
"resourceTypeId": "string"
}
],
"events": [
{
"resourceTypeId": "string",
"types": "string"
}
],
"format": {
"Platform": {
"dummy": "string"
},
"CloudEvents": {
"cloudEventsVersion": "string"
}
}
}
}
Response
Read the result with {{createsubscription.response.data.data.createSubscription}}. If the API returns errors, the step fails and they are at {{createsubscription.response.data.errors}}.
Need more? See the Commercetools guide for connection setup and behaviour shared by every action.
Was this page helpful?