younifyd
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

  1. Add a step and choose the Commercetools connector.
  2. Pick the createSubscription action (under Create).
  3. 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.

graphql
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.

draftobjectrequired
keystring
destinationobjectrequired7 fields
messagesarray<object>2 fields
changesarray<object>1 fields
eventsarray<object>2 fields
formatobject2 fields
json
{
  "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}}.

keystring
destinationobject
typestring
messagesarray<object>
resourceTypeIdobject
typesobject
changesarray<object>
resourceTypeIdobject
eventsarray<object>
resourceTypeIdobject
typesobject
formatobject
typestring
statusstring

One ofConfigurationErrorConfigurationErrorDeliveryStoppedHealthyManuallySuspendedTemporaryError

idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields
lastModifiedByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields

Need more? See the Commercetools guide for connection setup and behaviour shared by every action.

Was this page helpful?