# SMS compliance events

Contains event body information specific to SMS compliance events.


## SMS API initiated opt-in event {#api-initiate-opt-in}

Occurs when an SMS user is registered via the [SMS Channel Registration API](/docs/developer/rest-api/ua/#operation-api-channels-sms-post) without an `opted_in` value — indicating that the user has initiated, but not completed, the registration process. While this event contains a `channel_id`, you cannot send messages to this channel until the associated user completes the opt-in process (indicated by a `mobile_opt_in` event).


[Jump to examples ↓](#api-initiate-opt-in-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Indicates a registration was started via the Airship API without an opt-in date,
and a message was sent to the end user with instructions on how to opt in.


    Possible values: `api_initiate_opt_in`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS API-initiated opt-in event*

```json
{
    "id": "a11d6d6b-bdd1-4f3d-97d3-591993945425",
    "offset": "1000005312986",
    "occurred": "2019-07-10T17:11:48.923Z",
    "processed": "2019-07-10T17:11:49.151Z",
    "device": {
        "channel": "35eb0446-0c75-44ec-ba9e-81d7250e0e06",
        "device_type": "SMS"
    },
    "body": {
        "event_type": "api_initiate_opt_in",
        "identifiers": {
            "sender": "18338647425",
            "msisdn": "15035508427"
        }
    },
    "type": "COMPLIANCE"
}

```

---

## SMS carrier deactivation event {#carrier-deactivation}

Occurs when an MSISDN is deactivated by a carrier. This event type does not contain additional `properties`.

[Jump to examples ↓](#carrier-deactivation-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    The carrier deactivated the address.

    Possible values: `carrier_deactivation`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS carrier_deactivation event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "carrier_deactivation",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS Create and Send event {#smscreateandsend}

An event that occurs for SMS channels used as a part of a [Create and Send](/docs/guides/audience/segmentation/bulk-sending/).

[Jump to examples ↓](#smscreateandsend-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Possible values: `create_and_send`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Properties for an SMS [Create and Send](/docs/guides/audience/segmentation/bulk-sending/) event.

    **OBJECT PROPERTIES**

    - **`channel_registered`** `boolean` **REQUIRED**

      If true, a new channel was created to represent the identifiers in the event. If false, the address was already registered to Airship.

    - **`opted_in`** `string`

      The date-and-time when the `msisdn` opted into messages from the `sender`.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS Create and Send event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "create_and_send",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "opted_in": "2018-12-03T19:31:10.000Z",
      "channel_registered": "true"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS custom keyword response event {#custom-keyword-response}

Occurs when a mobile-originated keyword is matched, and elicits a custom response.

[Jump to examples ↓](#custom-keyword-response-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Occurs when a mobile-originated keyword generates a custom response.

    Possible values: `custom_keyword_response`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`inbound_message`** `string`

      The body of the inbound (to Airship) text message. This is the message a user sent to opt into or out of messages. This text corresponds to the `keyword` if present.

    - **`outbound_message`** `string`

      The message you sent to the user represented in the event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS custom keyword response event*

```json
{
    "id": "34464823-b48c-4ed3-8849-03933f29d057",
    "offset": "1000005313855",
    "occurred": "2019-07-11T00:24:39.203Z",
    "processed": "2019-07-11T00:24:40.128Z",
    "device": {
        "channel": "ec71312b-42e4-4bcd-b742-581a84941793",
        "device_type": "SMS",
        "delivery_address": "15035508427",
        "identifiers": {
            "sender": "18338647425"
        }
    },
    "body": {
        "event_type": "custom_keyword_response",
        "identifiers": {
            "sender": "18338647425",
            "msisdn": "15035508427"
        },
        "properties": {
            "inbound_message": "coupon",
            "outbound_message": "Thanks! Here is your coupon! https:\/\/wallet-api.urbanairship.com\/v1\/pass\/adaptive\/M1kTVOcyXm"
        }
    },
    "type": "COMPLIANCE"
}

```

---

## SMS mobile create channel event {#mobile-create-channel}

If a channel does not exist for the MSISDN/sender combination and your account is configured
to create a channel if none exists in such instances, we will emit this event. The resulting channel will necessarily be opted out, awaiting an opt-in action by the user.


[Jump to examples ↓](#mobile-create-channel-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Indicates that a channel for the `sms` event type was created.

    Possible values: `mobile_create_channel`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`opted_in`** `string`

      The date and time when the channel was registered.

    - **`registration_type`** `string`

      Indicates that the channel was registered with Airship.

      Possible values: `create`

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_create_channel event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "mobile_create_channel",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "inbound_message": "JOIN",
      "outbound_message": "Your order number is #123456789. Text 'JOIN' to learn about new offers from us.",
      "keyword": "JOIN"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS mobile keyword matched event {#mobile-keyword-matched}

Occurs when a mobile-originated message contains a recognized keyword.


[Jump to examples ↓](#mobile-keyword-matched-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Occurs when a mobile-originated event contains a recognized keyword.

    Possible values: `mobile_keyword_matched`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`inbound_message`** `string`

      The body of the inbound (to Airship) text message. This is the message a user sent to opt into or out of messages. This text corresponds to the `keyword` if present.

    - **`keyword`** `string`

      Indicates that a mobile-originated message contained a recognized keyword.

    - **`outbound_message`** `string`

      The message you sent to the user represented in the event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_keyword_matched event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "mobile_keyword_matched",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "inbound_message": "join",
      "outbound_message": "Wanna join the club?",
      "keyword": "JOIN"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS mobile keyword unmatched event {#mobile-keyword-unmatched}

Occurs when a mobile-originated message *does not* contain a recognized keyword.


[Jump to examples ↓](#mobile-keyword-unmatched-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Occurs when a mobile-originated event does not contain a recognized keyword.

    Possible values: `mobile_keyword_unmatched`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`inbound_message`** `string`

      The body of the inbound (to Airship) text message. This is the message a user sent to opt into or out of messages. This text corresponds to the `keyword` if present.

    - **`outbound_message`** `string`

      The message you sent to the user represented in the event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_keyword_unmatched event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "mobile_keyword_unmatched",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "inbound_message": "@%#!&@&#",
      "outbound_message": "Wanna join the club?"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS mobile opt in event {#mobile-opt-in}

Occurs when a user opts in to text messages via a keyword.

[Jump to examples ↓](#mobile-opt-in-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Indicates that the event represents a newly registered address.

    Possible values: `mobile_opt_in`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`inbound_message`** `string`

      The body of the inbound (to Airship) text message. This is the message a user sent to opt into or out of messages. This text corresponds to the `keyword` if present.

    - **`keyword`** `string`

      The keyword the user sent to opt in.

    - **`outbound_message`** `string`

      The message you sent to the user represented in the event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_opt_in event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "mobile_opt_in",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "inbound_message": "y",
      "outbound_message": "Do you want to get text alerts from us?",
      "keyword": "Y"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS mobile opt out event {#mobile-opt-out}

Occurs when a user sends a MO message that matches a keyword with an opt-out action. If present, this event would supplant a `mobile_keyword_matched` event.


[Jump to examples ↓](#mobile-opt-out-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    The event represents a user who opted out of notifications.

    Possible values: `mobile_opt_out`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`inbound_message`** `string`

      The body of the inbound (to Airship) text message. This is the message a user sent to opt into or out of messages. This text corresponds to the `keyword` if present.

    - **`keyword`** `string`

      Indicates that the user responded to opt out of messages. The enumerated values represent default keywords, but any custom keywords that you configure to allow mobile opt-outs can also appear here.

      Possible values: `STOP`, `STOPALL`, `UNSUBSCRIBE`, `CANCEL`, `END`, `QUIT`, `ARRET`

    - **`outbound_message`** `string`

      The message you sent to the user represented in the event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_opt_out event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663"
  },
  "body": {
    "event_type": "mobile_opt_out",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "inbound_message": "STOP",
      "outbound_message": "Text STOP to opt out of text messages from us.",
      "keyword": "STOP"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS mobile terminated message event {#mobile-terminated-message}

Occurs when Airship sends an SMS message to a user. The message represented by this event could be a response to an individual mobile-originated (MO) message, or a message initiated from the Airship UI/API.


[Jump to examples ↓](#mobile-terminated-message-examples)

- **`body`** `object` **REQUIRED**

  Contains the Compliance event subtype and properties specific to the event subtype.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Airship has emitted a mobile-terminated message.

    Possible values: `mobile_terminated_message`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS mobile_terminated_message event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS"
  },
  "body": {
    "event_type": "mobile_terminated_message",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS opted out event {#opted-out}

Occurs when a user is opted out of an SMS audience via the Airship API, i.e., not via an opt-out keyword. This event type does not contain additional `properties`.

[Jump to examples ↓](#opted-out-examples)

**All of:**

  - **`device`** `object`

    Holds information about an SMS `device` (an individual SMS channel).

    **OBJECT PROPERTIES**

    - **`channel`** `string`

      The unique, platform-agnostic channel identifier for a device.

    - **`delivery_address`** `string`

      The phone number for the channel.

      Format: `msisdn`

    - **`device_type`** `string` **REQUIRED**

      SMS compliance events use the `SMS` device type.

      Possible values: `SMS`

    - **`identifiers`** `object`

      If present, the `identifiers` object holds the value for the `sender` property.

      **OBJECT PROPERTIES**

      - **`sender`** `string` **REQUIRED**

        The sender that the `delivery_address` received a message from.

  - **`id`** `string`

    Uniquely identifies an event. The data stream will occasionally send duplicate events. Duplicate events will have the same `id`, `type`, `occurred`, `device`, and `body` values but different `offset` and `processed` values. You should use the `id` to deduplicate.

  - **`occurred`** `string`

    When the event occurred.

  - **`offset`** `string` **REQUIRED**

    An identifier of a location in the stream; used to resume the stream after severing a connection. If you open a stream using the offset value, the stream will resume with the next element in the stream. You should store this value as a string so that you can easily resume the stream if it ends for any reason.

  - **`processed`** `string`

    When the event was ingested by Airship. There may be some latency between when the event occurred, and when it was processed.

  - **`type`** `string`

    Compliance events are the only types of events returned by this event stream.


    Possible values: `COMPLIANCE`

  - **`body`** `object` **REQUIRED**

    Contains the event subtype, identifiers, and additional properties about the event.

    **OBJECT PROPERTIES**

    - **`event_type`** `string` **REQUIRED**

      The address opted out of notifications.

      Possible values: `opted_out`

    - **`identifiers`** `object` **REQUIRED**

      Contains the sender and MSISDN for the event.

      **OBJECT PROPERTIES**

      - **`msisdn`** `string` **REQUIRED**

        The phone number of the user involved in the compliance event.

      - **`sender`** `string` **REQUIRED**

        The phone number or short code of the sender involved in the compliance event.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS opted_out event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663",
    "identifiers": { "sender": "15558675309" }
  },
  "body": {
    "event_type": "opted_out",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS registration event {#smsregistered}

Occurs when a user opts in to receive SMS messages from you, via a call to the [SMS registration API](/docs/developer/rest-api/ua/#operation-api-channels-sms-post).

[Jump to examples ↓](#smsregistered-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Indicates that the event represents a newly registered address.

    Possible values: `registration`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`opted_in`** `string` **REQUIRED**

      The ISO 8601 date-time (UTC) when the channel opted-in to notifications.

    - **`registration_type`** `string` **REQUIRED**

      Indicates whether the channel was created or updated.

      Possible values: `create`, `update`

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS registration event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS"
  },
  "body": {
    "event_type": "registration",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "opted_in": "2018-12-03T19:31:10.000Z",
      "registration_type": "create"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS uninstalled event {#sms-uninstalled}

Occurs when the [SMS uninstall API](/docs/developer/rest-api/ua/#operation-api-channels-sms-uninstall-post) is called.

[Jump to examples ↓](#sms-uninstalled-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    The address was uninstalled.

    Possible values: `uninstall`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS uninstalled event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663",
    "identifiers": {
      "sender": "15558675309"
    }
  },
  "body": {
    "event_type": "uninstall",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    }
  },
  "type": "COMPLIANCE"
}

```

---

## SMS update event {#smsupdated}

When an SMS event update occurs.

[Jump to examples ↓](#smsupdated-examples)

- **`body`** `object` **REQUIRED**

  Contains the event subtype, identifiers, and additional properties about the event.

  **OBJECT PROPERTIES**

  - **`event_type`** `string` **REQUIRED**

    Indicates that the event represents a newly registered address.

    Possible values: `registration`

  - **`identifiers`** `object` **REQUIRED**

    Contains the sender and MSISDN for the event.

    **OBJECT PROPERTIES**

    - **`msisdn`** `string` **REQUIRED**

      The phone number of the user involved in the compliance event.

    - **`sender`** `string` **REQUIRED**

      The phone number or short code of the sender involved in the compliance event.

  - **`properties`** `object` **REQUIRED**

    Contains properties specific to the `event_type`.

    **OBJECT PROPERTIES**

    - **`opted_in`** `string` **REQUIRED**

      The ISO 8601 date-time (UTC) when the channel opted-in to notifications.

    - **`registration_type`** `string` **REQUIRED**

      Indicates the channel was updated.

      Possible values: `update`

- **`device`** `object` **REQUIRED**

  Holds information about an SMS `device` (an individual SMS channel).

  **OBJECT PROPERTIES**

  - **`channel`** `string`

    The unique, platform-agnostic channel identifier for a device.

  - **`delivery_address`** `string`

    The phone number for the channel.

    Format: `msisdn`

  - **`device_type`** `string` **REQUIRED**

    SMS compliance events use the `SMS` device type.

    Possible values: `SMS`

  - **`identifiers`** `object`

    If present, the `identifiers` object holds the value for the `sender` property.

    **OBJECT PROPERTIES**

    - **`sender`** `string` **REQUIRED**

      The sender that the `delivery_address` received a message from.


**Used in:**

- [Open a compliance event stream]({{< ref "/developer/rest-api/connect/operations/compliance-event-stream/" >}}#opencomplianceeventstream)
- [Open an event stream]({{< ref "/developer/rest-api/connect/operations/event-stream/" >}}#openeventstream)

**Examples**

*Example SMS update event*

```json
{
  "id": "a7086338-0473-46fe-8d9b-cb61305c3c0d",
  "offset": "1000000701505",
  "occurred": "2018-12-03T19:31:10.000Z",
  "processed": "2018-12-03T19:31:11.302Z",
  "device": {
    "channel": "a828de17-b315-4e80-9d2d-35a906afeacf",
    "device_type": "SMS",
    "delivery_address": "15558968663",
    "identifiers": {
      "sender": "15558675309"
    }
  },
  "body": {
    "event_type": "registration",
    "identifiers": {
      "sender": "15558675309",
      "msisdn": "15558968663"
    },
    "properties": {
      "registration_type": "update"
    }
  },
  "type": "COMPLIANCE"
}

```

---

