Subscriptions and Unsubscribes

Subscription that triggered a service

The following variables are available in a service after it is triggered by a subscription or subscription-related broadcast.

There are two scopes (session and request) that can refer to the subscription that triggered the service. This includes services triggered by a valid reply to a broadcast with "Response Routing" (also known as "broadcast sessions"), where temporary routing is set up to capture replies to a broadcast message. More information about Response Routing is available from your account manager.

The session scope variables all begin with session.initialsubscription while the request scope variables all begin with request.subscription. The types of details you can access are the same, and the variables share the same end part of the key name.

Values accessed using the session scope are accessible throughout an entire session. Values accessed using the request scope exists only for the duration of a specific request within a session. This means that if a session begins a second request then a variable that uses the request scope will return a Null value. For this reason, we recommend that you use the session scope to reference keyword details.

Variable

Description

Type

request.subscription.

description

or

session.initialsubscription.

description

The description of the subscription. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast.

You can reference this variable in the Services tab only.

String

request.subscription.id

or

session. initialsubscription.id

 

The unique alphanumeric ID of the subscription; for example, 0A45A7175F80C3F. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast. The ID is also visible in the subscription’s UI page in MEP.

You can reference this variable in the Services tab only.

String

request.subscription. name

or

session. initialsubscription.
name

The name of the subscription. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast.

You can reference this variable in the Services tab only.

String

request.subscription. subscriptionCollection. description

or

session. initialsubscription. subscriptionCollection. description

The description of the collection that the subscription belongs to. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast.

You can reference this variable in the Services tab only.

String

request.subscription. subscriptionCollection.id

or

session. initialsubscription. subscriptionCollection.id

 

The unique alphanumeric ID of the collection that the subscription belongs to; for example, 75F80C390A45A71. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast.

You can also retrieve this value using the Subscriptions API.

You can reference this variable in the Services tab only.

String

request.subscription. subscriptionCollection. name

or

session. initialsubscription. subscriptionCollection. name

 

The name of the collection that the subscription belongs to. This variable is available in a service after it is triggered by a subscription or subscription-related broadcast.

You can reference this variable in the Services tab only.

String

Subscription subscribes and unsubscribes

You can use the following variables to identify a subscription when an end user subscribes to or unsubscribes from the subscription during a service. These variables are available regardless of whether a subscription triggered the service.

The subscribe variables all begin with session.lastsubscribed. These variables can only return a value after the end user has triggered either of these handlers:

  • Creates or Activate subscription
  • Subscribe user
  • Subscribe user to auto-generated mailing list

The unsubscribe variables all begin with session.lastunsubscribed. These variables return a value after the end user has triggered the Unsubscribe User handler. Do not use these variables after other unsubscribe handlers—the variable can only return one value and these handlers can unsubscribe users from multiple subscriptions, making the returned value hard to predict.

The types of details you can access with the session.subscribed and session.unsubscribed variables are the same, and the variables share the same end part of the key name.

Variable

Description

Type

session.lastsubscribed.
description

or

session.
lastunsubscribed.
description

The description of the subscription. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service.

You can reference this variable in the Services tab only.

String

session.
lastsubscribed.id

or

session. lastunsubscribed.id

The unique alphanumeric ID of the subscription; for example, 0A45A7175F80C3F. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service. The ID is also visible in the subscription’s UI page in MEP.

You can reference this variable in the Services tab only.

String

session. lastsubscribed.name

or

session. lastunsubscribed.name

The name of the subscription. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service.

You can reference this variable in the Services tab only.

String

session.lastsubscribed. subscriptionCollection. description

or

session.
lastunsubscribed. subscriptionCollection. description

The description of the collection that the subscription belongs to. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service.

You can reference this variable in the Services tab only.

String

session.lastsubscribed. subscriptionCollection.id

or

session.
lastunsubscribed. subscriptionCollection.id

 

The unique alphanumeric ID of the collection that the subscription belongs to; for example, 75F80C390A45A71. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service.

You can also retrieve this value using the Subscriptions API.

You can reference this variable in the Services tab only.

String

session.lastsubscribed. subscriptionCollection. name

or

session.
lastunsubscribed. subscriptionCollection. name

The name of the collection that the subscription belongs to. This variable is available in a service when an end user has subscribed/unsubscribed to a subscription during the service.

You can reference this variable in the Services tab only.

String

Unsubscribe notifications

The following variables are valid only when a service was triggered (by a STOP message) via unsubscribe notification routing.

Unsubscribe notification routing is a separate, configurable option found with your keyword routing. It is particularly useful for STOP notifications received via shared short codes (shared short codes are available in some parts of the world such as the UK, but are not available in the US).

Variable

Description

Type

session.notification.
source

This variable is valid only when the service was triggered via unsubscribe notification routing. This type of routing is a separate configurable option found with your keyword routing.

This variable identifies the source of the notification. This indicates the end user has unsubscribed via:

  • STOP — the user has unsubscribed via an SMS STOP message
  • UnknownSubscriber — after receiving a message from your service to the end user, the mobile operator has responded that the user is no longer available
  • UNKNOWN — the message came from an alternative source

You can reference this variable only in the Services tab.

String

session.notification.date

This variable is valid only when the service was triggered via unsubscribe notification routing. This type of routing is a separate configurable option found with your keyword routing.

This variable returns the date and time that MEP received the message. The format is yyyy-MM-dd hh:mm:ss.

You can reference this variable only in the Services tab.

String

session.notification. shortCode

This variable is valid only when the service was triggered via unsubscribe notification routing. This type of routing is a separate configurable option found with your keyword routing.

This variable returns the short code that received the message.

You can reference this variable only in the Services tab.

Integer