# Create and Send

Objects and samples for [`/create-and-send`](/developer/rest-api/ua/operations/bulk-sending/#createandsend)
endpoints. A full object can contain parts of schedule, template, audience, and platform override objects (for `email`, `sms`, or `open::` platforms).

The `notification` payload for Create and Send objects supports both
stored and inline templates. Using inline templates, you can define and
populate variables to personalize notifications to your new channels.


{{< note >}}
You cannot update channel information or opt-in status using Create and Send. If you want to update channels, refer to the appropriate email, SMS, or open channel endpoints.
{{< /note >}}

## Create and Send MMS notification {#mms}

The payload for a Create and Send operation that sends a multimedia payload (MMS) to SMS channels. When sending an MMS payload, `device_types` must be set to `mms`.

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

- **`audience`** `object` **REQUIRED**
  **One of:**

  - **SMS audience for Create and Send payloads** `object`

    The SMS information and opt-in parameters for the audience you want to send to. Unknown MSISDNs are registered as new channels.

    - **`create_and_send`** `array[object]` **REQUIRED**

      Each object in the array represents an MSISDN you want to send to. Unknown MSISDNs are registered as new channels. Channel registration fields are prefixed with `ua_` and have the same requirements as the [SMS channel registration endpoint](/docs/developer/rest-api/ua/operations/sms/#registersmschannel).


All other fields represent variables if `notification` specifies a `template`.

      Max items: 1000

  -
    - **`bulk_id`** `string` **REQUIRED**

      A unique string obtained from the [Create bulk send audience operation](/docs/developer/rest-api/ua/operations/bulk-sending/#bulkuploadcreateandsendplatform) to target an audience for bulk sending.


      Format: `uuid`


- **`device_types`** `array[string]` **REQUIRED**

  The platform you want to send notifications to.

  Possible values: `email`, `mms`, `sms`, `open::<open_platform_name>`

- **`notification`** `object` **REQUIRED**
  **OBJECT PROPERTIES**

  - **`mms`** `object` **REQUIRED**

    A platform override for MMS messages; `device_types` must be set to `mms`. A notification with a platform override that does not match your `device_types` will result in a 400 error.

    **One of:**

    - [MMS platform overrides]({{< ref "/developer/rest-api/ua/schemas/platform-overrides/" >}}#mmsoverrideobject)

      Provides the content for a push to MMS channels. If `sms` is in the `device_type` array, your request may include this object.
It cannot be combined with an SMS Platform Override as a single push can only include either an SMS or MMS payload.


    - [MMS notification with inline template]({{< ref "/developer/rest-api/ua/schemas/platform-overrides-with-templates/" >}}#mmsoverridewithtemplate)

      Template and notification overrides for a Create and Send payload with `device_types` set to `mms`. With a template, you can provide and populate variables and conditional statements based on those variables. Conditionals begin with `{{#operator}}` and end with `{{/operator}}`. For more information, see [Handlebars](/docs/guides/personalization/handlebars/).




**Used in:**

- [Create and Send a message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#createandsend)
- [Schedule a Create and Send message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulecreateandsendoperations)
- [Schedule message with bulk ID]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulebulksendpush)
- [Validate Create and Send payload]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#validatecreateandsendpayload)

**Examples**

*Example Create and Send for MMS without template*

```json
{
  "audience": {
    "create_and_send": [
        {
            "ua_msisdn": "15558675309",
            "ua_sender": "15551234567",
            "ua_opted_in": "2020-11-11T18:45:30",
        }
    ]
  },
  "device_types": [
    "mms"
  ],
  "notification": {
    "mms": {
      "fallback_text": "Delivery failed, but you should still check this out.",
      "subject" : "Hey, thanks for subscribing!",
      "slides": [
        {
          "text": "Check this out!",
          "media": {
              "url": "https://i.example.com/1t466Om.jpg",
              "content_type": "image/jpeg",
              "content_length": 52918
            }
          }
        ]
      }
    }
  }

```

---

## Create and Send to email channels {#email}

The payload for a Create and Send operation to email channels. When sending to email channels, `device_types` must be set to `email`.

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

- **`audience`** `object` **REQUIRED**
  **One of:**

  - **Email audience for Create and Send payloads** `object`

    The email addresses and opt-in agreements for the audience you want to send to. Unknown addresses are registered as new channels.

    - **`create_and_send`** `array[object]` **REQUIRED**

      Each object in the array represents an email address you want to send to. Unknown addresses are registered as new channels. Channel registration fields are prefixed with `ua_` and have the same requirements as the [email registration endpoint](/docs/developer/rest-api/ua/operations/email/#registeremailchannel).


You cannot provide optional channel registration fields using this endpoint (like `locale_language` for email channels). All other fields represent variables if `notification` specifies a `template`.

      Max items: 1000

  -
    - **`bulk_id`** `string` **REQUIRED**

      A unique string obtained from the [Create bulk send audience operation](/docs/developer/rest-api/ua/operations/bulk-sending/#bulkuploadcreateandsendplatform) to target an audience for bulk sending.


      Format: `uuid`


- **`campaigns`** `object` <[Campaigns object]({{< ref "/developer/rest-api/ua/schemas/push/" >}}#campaignsobject)>

  An object specifying custom campaign categories related to the notification.

- **`device_types`** `array[string]` **REQUIRED**

  The platform you want to send notifications to.

  Possible values: `email`, `mms`, `sms`, `open::<open_platform_name>`

- **`notification`** `object` **REQUIRED**

  An `alert` notification or a platform override matching the value in `device types`. A notification with a platform override that does not match your `device_types` will result in a 400 error.

  **OBJECT PROPERTIES**

  - **`email`** `object`

    You can either provide the standard object that you would provide when performing a `/api/push` to an email platform, or you can provide some of the email platform override fields along with an inline template.

    **One of:**

    - [Email overrides]({{< ref "/developer/rest-api/ua/schemas/platform-overrides/" >}}#emailoverrideobject)

      Notification fields specific to email messages. This object is required when `email` is specified in the payload's `device_types` field.

    - [Email notification with template]({{< ref "/developer/rest-api/ua/schemas/platform-overrides-with-templates/" >}}#emailoverridewithtemplate)

      Notification fields specific to email messages with an inline template for use in a [Create and Send](/docs/developer/rest-api/ua/operations/bulk-sending/#createandsend) payload. Using a template enables you to provide and populate variables in your notification. You can also add conditional statements based on those variables, determining message text that to send to each member of your audience. Conditionals begin with `{{#operator}}` and end with `{{/operator}}`. For more information, see [Handlebars](/docs/guides/personalization/handlebars/).



**Used in:**

- [Create and Send a message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#createandsend)
- [Schedule a Create and Send message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulecreateandsendoperations)
- [Schedule message with bulk ID]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulebulksendpush)
- [Validate Create and Send payload]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#validatecreateandsendpayload)

**Examples**

*Example object*

```json
{
  "audience": {
    "create_and_send" : [
      {
        "ua_address": "new@example.com",
        "ua_commercial_opted_in": "2020-11-29T10:34:22"
      },
      {
        "ua_address" : "ben@example.com",
        "ua_commercial_opted_out": "2020-11-29T12:45:10"
      },
      {
        "ua_address" : "mary@example.com",
        "ua_email_suppression_state": "BOUNCE"
      }
    ]
  },
  "device_types" : [ "email" ],
  "notification" : {
    "email": {
      "subject": "Welcome to the Winter Sale! ",
      "html_body": "<h1>Seasons Greetings</h1><p>Check out our winter deals!</p><p><a data-ua-unsubscribe=\"1\" title=\"unsubscribe\" href=\"http://unsubscribe.urbanairship.com/email/success.html\">Unsubscribe</a></p>",
      "plaintext_body": "Greetings! Check out our latest winter deals! [[ua-unsubscribe href=\"http://unsubscribe.urbanairship.com/email/success.html\"]]",
      "message_type": "transactional",
      "sender_name": "Airship",
      "sender_address": "team@airship.com",
      "reply_to": "no-reply@airship.com",
      "click_tracking": false,
      "open_tracking": false,
      "attachments": [
        {
          "id": "0e10a6b9-725c-4f6b-9af2-9ef5b31328c0",
        },
        {
          "id": "5503b5fe-ed69-4609-bef6-6fef0e6e428f"
        }
      ]
    }
  },
  "campaigns": {
      "categories": ["winter sale", "west coast"]
  }
}

```

---

## Create and Send to open channels {#open}

The payload for a Create and Send operation to open channels. When sending to open channels, the `device_type` must be set to `open::<open_channel_name>`.

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

- **`audience`** `object` **REQUIRED**
  **One of:**

  - **Open audience for Create and Send payloads** `object`

    The Open channel addresses and opt-in information for the audience you want to send to. Unknown addresses are registered as new channels.

    - **`create_and_send`** `array[object]` **REQUIRED**

      Each object in the array represents an Open channel address you want to send to. Unknown addresses are registered as new channels. Channel registration fields are prefixed with `ua_` and have the same requirements as open channel registration.

      Max items: 1000

  -
    - **`bulk_id`** `string` **REQUIRED**

      A unique string obtained from the [Create bulk send audience operation](/docs/developer/rest-api/ua/operations/bulk-sending/#bulkuploadcreateandsendplatform) to target an audience for bulk sending.


      Format: `uuid`


- **`campaigns`** `object` <[Campaigns object]({{< ref "/developer/rest-api/ua/schemas/push/" >}}#campaignsobject)>

  An object specifying custom campaign categories related to the notification.

- **`device_types`** `array[string]` **REQUIRED**

  The platform you want to send notifications to.

  Possible values: `email`, `mms`, `sms`, `open::<open_platform_name>`

- **`notification`** `object` **REQUIRED**

  An `alert` notification or a platform override matching the value in `device types`. A notification with a platform override that does not match your `device_types` will result in a 400 error.

  **OBJECT PROPERTIES**

  - **`open::open_platform_name`** `object` <[Open channel overrides with template]({{< ref "/developer/rest-api/ua/schemas/platform-overrides-with-templates/" >}}#openchanneloverridewithtemplate)>

    Use a `template` with an open channel-specific message. You can reference a template by ID, or use `{{handlebars}}` directly in your message.



**Used in:**

- [Create and Send a message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#createandsend)
- [Schedule a Create and Send message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulecreateandsendoperations)
- [Schedule message with bulk ID]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulebulksendpush)
- [Validate Create and Send payload]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#validatecreateandsendpayload)

**Examples**

*Example object*

```json
{
  "audience" : {
    "create_and_send": [
      {
        "ua_address" : "36d5a261-0454-40f5-b952-942c4b2b0f22",
        "name": "Perry"
      }
    ]
  },
  "device_types" : [ "open::smart_fridge" ],
  "notification" : {
      "open::smart_fridge": {
          "alert" : "Hey {{name}}, you're out of ice cream!"
      }
  },
  "campaigns": {
      "categories": ["needs_ice_cream", "cookies_and_cream"]
  }
}

```

---

## Create and Send to SMS channels {#sms}

The payload for a Create and Send operation to SMS channels. When sending to SMS channels, `device_types` must be set to `sms`.

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

- **`audience`** `object` **REQUIRED**
  **One of:**

  - **SMS audience for Create and Send payloads** `object`

    The SMS information and opt-in parameters for the audience you want to send to. Unknown MSISDNs are registered as new channels.

    - **`create_and_send`** `array[object]` **REQUIRED**

      Each object in the array represents an MSISDN you want to send to. Unknown MSISDNs are registered as new channels. Channel registration fields are prefixed with `ua_` and have the same requirements as the [SMS channel registration endpoint](/docs/developer/rest-api/ua/operations/sms/#registersmschannel).


All other fields represent variables if `notification` specifies a `template`.

      Max items: 1000

  -
    - **`bulk_id`** `string` **REQUIRED**

      A unique string obtained from the [Create bulk send audience operation](/docs/developer/rest-api/ua/operations/bulk-sending/#bulkuploadcreateandsendplatform) to target an audience for bulk sending.


      Format: `uuid`


- **`campaigns`** `object` <[Campaigns object]({{< ref "/developer/rest-api/ua/schemas/push/" >}}#campaignsobject)>

  An object specifying custom campaign categories related to the notification.

- **`device_types`** `array[string]` **REQUIRED**

  The platform you want to send notifications to.

  Possible values: `email`, `mms`, `sms`, `open::<open_platform_name>`

- **`notification`** `object` **REQUIRED**

  An `alert` notification or a platform override matching the value in `device types`. A notification with a platform override that does not match your `device_types` will result in a 400 error.

  **OBJECT PROPERTIES**

  - **`sms`** `object`
    **One of:**

    - [SMS platform overrides]({{< ref "/developer/rest-api/ua/schemas/platform-overrides/" >}}#smsoverrideobject)

      Provides override options when `sms` is one of the `device_types` specified in the payload.

    - [SMS notification with template]({{< ref "/developer/rest-api/ua/schemas/platform-overrides-with-templates/" >}}#smsoverridewithtemplate)

      Notification fields specific to SMS messages with an inline template for use in a [Create and Send](/docs/developer/rest-api/ua/operations/bulk-sending/#createandsend) payload. Using a template enables you to provide and populate variables in your notification. You can also add conditional statements based on those variables, determining message text that to send to each member of your audience. Conditionals begin with `{{#operator}}` and end with `{{/operator}}`. For more information, see [Handlebars](/docs/guides/personalization/handlebars/).




**Used in:**

- [Create and Send a message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#createandsend)
- [Schedule a Create and Send message]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulecreateandsendoperations)
- [Schedule message with bulk ID]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#schedulebulksendpush)
- [Validate Create and Send payload]({{< ref "/developer/rest-api/ua/operations/bulk-sending/" >}}#validatecreateandsendpayload)

**Examples**

*Example object*

```json
{
 "audience": {
    "create_and_send" : [
      {
        "ua_msisdn": "15558675309",
        "ua_sender": "12345",
        "ua_opted_in": "2020-11-11T18:45:30"
      }
    ]
  },
  "device_types" : [ "sms" ],
  "notification" : {
    "sms": {
      "alert": "Check out our winter sale! https://www.example.com/amazingly/long/url-that-I-want-to-shorten",
      "expiry": 172800,
      "shorten_links": true
    }
  },
  "campaigns": {
      "categories": ["winter sale", "west coast"]
  }
}

```

---

