# Content objects

Schemas for [Content](/developer/rest-api/ua/operations/content/) templates and per-channel `content` payloads.


## App and web content template object {#appandwebtemplatesobject}

The app and web push fields for a template.

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

- **`alert`** `string` **REQUIRED**

  The text that will display in your push notification.

- **`icon`** `string`

  A string representing a URL or an image file included in the application's resources.

- **`summary`** `string`

  Supplemental text displayed with the notification.

- **`title`** `string`

  A heading that appears above the notification text when applicable.


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example app and web template object*

```json
{
    "title": "Shoe sale on {{level}} floor!",
    "alert": "All the shoes are on sale {{name}}!",
    "summary": "Don't miss out!",
    "icon": "shoes"
}

```

---

## Content template object {#contenttemplateobject}

A reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.

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

- **`content`** `object` **REQUIRED**

  The content of the given type, using the associated model object below.

  **One of:**

  - [Email content template object]({{< ref "/developer/rest-api/ua/schemas/content-objects/" >}}#emailtemplatesobject)

    The email-specific fields for a template.

  - [SMS content template object]({{< ref "/developer/rest-api/ua/schemas/content-objects/" >}}#smstemplatesobject)

    The SMS-specific fields for a template.

  - [Open channel content template object]({{< ref "/developer/rest-api/ua/schemas/content-objects/" >}}#openchanneltemplatesobject)

    The open channel-specific fields for a template.

  - [App and web content template object]({{< ref "/developer/rest-api/ua/schemas/content-objects/" >}}#appandwebtemplatesobject)

    The app and web push fields for a template.

  - [Message Center content template object]({{< ref "/developer/rest-api/ua/schemas/content-objects/" >}}#messagecentertemplatesobject)

    The Message Center-specific fields for a template.


- **`created_at`** `string`

  The [date-time](#date-time-format) when this template was created.

  Format: `date-time`

  Read only: true

- **`description`** `string`

  The description of the template.

- **`external_id`** `string`

  An optional ID for referencing this template in future API calls. Must be unique within your project.

- **`feed_references`** `object` <[Feed references object]({{< ref "/developer/rest-api/ua/schemas/external-data-feeds-references/" >}}#feedreferences)>

  An object used to indicate that an external data feed should be invoked, the name of the feed to invoke, and the way in which to invoke it. You can only include a feed if you include a `templates` object in the payload or set the `personalization` option to `true`.

- **`id`** `string`

  The unique ID assigned to the template. Used to retrieve or reference the template in other endpoints.

  Format: `uuid`

  Read only: true

- **`modified_at`** `string`

  The [date-time](#date-time-format) when this template was last modified.

  Format: `date-time`

  Read only: true

- **`name`** `string` **REQUIRED**

  The human-readable name of the template.

- **`snippet_references`** `object` <[Snippet references object]({{< ref "/developer/rest-api/ua/schemas/push/" >}}#snippetreferences)>

  An object used to indicate that a set of snippets should be loaded for use in message content. Use the following syntax in your payload: `{{> your_snippet_name }}` to reference the snippet content within a notification or rich message.

See [Snippets](/docs/guides/personalization/content/snippets/) to see how to create a snippet in the Airship dashboard.


- **`type`** `string` **REQUIRED**

  The type of message.

  Possible values: `email`, `sms`, `open`, `app`, `web`, `message_center`


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example content template object*

```json
{
    "id": "ef34a8d9-0ad7-491c-86b0-aea74da15161",
    "external_id": "customer-defined-id",
    "name": "Welcome Message",
    "description": "Our welcome message",
    "type": "email",
    "content": {
        "subject": "Welcome!",
        "html_body": "<html><body>Hi, {{first_name}}!</body></html> {{>copyright}}",
        "plaintext_body": "Hi, {{first_name}}!"
    },
    "created_at": "2020-08-17T11:10:02Z",
    "modified_at": "2020-08-17T11:10:02Z",
    "feed_references": {
        "feeds": [
          {
            "name": "featured_product"
          }
        ],
        "defaults": {
          "featured_product": {
            "category": "featured"
          }
        }
    },
    "snippet_references": {
        "snippets": [
          {
            "name": "copyright"
          }
        ]
    }
}

```

---

## Email content template object {#emailtemplatesobject}

The email-specific fields for a template.

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

- **`html_body`** `string` **REQUIRED**

  The HTML content of the email.

- **`plaintext_body`** `string` **REQUIRED**

  The plaintext content of the email.

- **`subject`** `string` **REQUIRED**

  The email subject.


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example email template object*

```json
{
    "subject": "Welcome!",
    "html_body": "<html><body>Hi, {{first_name}}!</body></html>",
    "plaintext_body": "Hi, {{first_name}}!"
}

```

---

## Message Center content template object {#messagecentertemplatesobject}

The Message Center-specific fields for a template.

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

- **`html_body`** `string` **REQUIRED**

  The body of the message. This can be a full HTML message.

- **`title`** `string`

  A heading that appears above the message and in the Message Center inbox.


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example Message Center template object*

```json
{
    "html_body": "<h2>Richtext body goes here</h2><p><a data-ua-unsubscribe=\"1\" title=\"unsubscribe\" href=\"http://unsubscribe.urbanairship.com/email/success.html\">Unsubscribe</a></p>",
    "title": "Message Center Notification"
}

```

---

## Open channel content template object {#openchanneltemplatesobject}

The open channel-specific fields for a template.

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

- **`alert`** `string` **REQUIRED**

  The text that will display in your open channel message.

- **`media_attachment`** `string`

  The URL for media you want to include in your message.

- **`summary`** `string`

  Supplemental text displayed with the notification.

- **`title`** `string`

  A heading that appears above the notification text when applicable.


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example open channel template object*

```json
{
    "title": "SMS Alert!",
    "alert": "A shorter alert for SMS users",
    "summary": "A longer summary of text alongside the notification",
    "media_attachment": "https://example.com/cat_standing_up.jpeg"
}

```

---

## SMS content template object {#smstemplatesobject}

The SMS-specific fields for a template.

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

- **`alert`** `string` **REQUIRED**

  The SMS content.


**Used in:**

- [Create content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#createcontenttemplate)
- [Create or update content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplatebyexternalid)
- [List content templates]({{< ref "/developer/rest-api/ua/operations/content/" >}}#listcontenttemplates)
- [Look up a content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplate)
- [Look up a content template by external ID]({{< ref "/developer/rest-api/ua/operations/content/" >}}#getcontenttemplatebyexternalid)
- [Update content template]({{< ref "/developer/rest-api/ua/operations/content/" >}}#updatecontenttemplate)

**Examples**

*Example SMS template object*

```json
{
    "alert": "My SMS message"
}

```

---

