Unsubscribe a user

Make a call to this endpoint to unsubscribe a user from a subscription type or channel. If no subscriptions are present in the request, the user is unsubscribed from all subscriptions. If subscriptions are present in the request, the user is unsubscribed from the requested type or channel combination(s). By default, if a subscription exists, but the user is already unsubscribed, it records the attempt to unsubscribe the subscription(s) again. For TEXT subscriptions, a message is sent to the person indicating that they are unsubscribed.

For the user object, the email data point determines which email subscriptions a user has and the phone data point determines which text (or sms) subscriptions a user has. Passing in an email does not locate, nor unsubscribe, a user from any sms subscriptions. Similarly, passing in a phone does not locate, nor unsubscribe, a user from any email subscriptions.

The following input fields are provided:

user - Required. The user being subscribed. Note that this is a visitor to the site and does not need to be actively subscribed to Attentive. An email, phone, or both can be provided.

subscriptions - Optional. Array of type/channel combinations indicating the desired subscriptions to remove.

notification - Optional notification properties to override. disable: true can be used to prevent a notification. Language can override english as the notification language. Takes standard language tags as defined by the ISO. Currently only supports en-US and fr-CA. Case sensitive, must match exactly.

The response will provide a list of channel/type combinations of the removed subscriptions.

Example query

Copy
Copied
mutation {
  unsubscribe($input: UnsubscribePayload) {
    unsubscribeResults {
      channel
      type
    }
  }
}

Example Input Variable:

Copy
Copied
    input: {
      user: {
        email: "test@gmail.com"
        phone: "5555555555"
      }
      subscriptions: [
        {,
            channel: CHANNEL_TEXT,
            type: TYPE_TRANSACTIONAL
        }
        {
            channel: CHANNEL_EMAIL,
            type: TYPE_TRANSACTIONAL
        }
      ]
    }