Create a Content resource

POST /v1/Content

A Content resource represents rich messaging content.

Create a Content resource

application/json

Body Required

  • friendly_name string

    User defined name of the content

  • variables object

    Key value pairs of variable name to value

    Hide variables attribute Show variables attribute object
    • * string Additional properties
  • language string Required

    Language code for the content

  • types object Required

    Content types

    Hide types attributes Show types attributes object
    • twilio/text object | null

      Type containing only plain text-based content

      Additional properties are NOT allowed.

      Hide twilio/text attribute Show twilio/text attribute object | null
      • body string Required
    • twilio/media object | null

      twilio/media is used to send file attachments, or to send long text via MMS in the US and Canada. As such, the twilio/media type must contain at least ONE of text or media content.

      Additional properties are NOT allowed.

      Hide twilio/media attributes Show twilio/media attributes object | null
      • body string
      • media array[string] Required
    • twilio/location object | null

      twilio/location type contains a location pin and an optional label, which can be used to enhance delivery notifications or connect recipients to physical experiences you offer.

      Additional properties are NOT allowed.

      Hide twilio/location attributes Show twilio/location attributes object | null
      • latitude number Required
      • longitude number Required
      • label string
      • id string
      • address string
    • twilio/list-picker object | null

      twilio/list-picker includes a menu of up to 10 options, which offers a simple way for users to make a selection.

      Additional properties are NOT allowed.

      Hide twilio/list-picker attributes Show twilio/list-picker attributes object | null
      • body string Required
      • button string Required
      • items array[object] Required
        Hide items attributes Show items attributes object
        • id string Required
        • item string Required
        • description string
    • twilio/call-to-action object | null

      twilio/call-to-action buttons let recipients tap to trigger actions such as launching a website or making a phone call.

      Additional properties are NOT allowed.

      Hide twilio/call-to-action attributes Show twilio/call-to-action attributes object | null
      • body string
      • actions array[object]
        Hide actions attributes Show actions attributes object
        • type string Required

          Values are URL, PHONE_NUMBER, COPY_CODE, VOICE_CALL, or VOICE_CALL_REQUEST.

        • title string Required
        • url string
        • phone string
        • code string
        • id string
    • twilio/quick-reply object | null

      twilio/quick-reply templates let recipients tap, rather than type, to respond to the message.

      Additional properties are NOT allowed.

      Hide twilio/quick-reply attributes Show twilio/quick-reply attributes object | null
      • body string Required
      • actions array[object] Required
        Hide actions attributes Show actions attributes object
        • type string Required

          Value is QUICK_REPLY.

        • title string Required
        • id string
    • twilio/card object | null

      twilio/card is a structured template which can be used to send a series of related information. It must include a title and at least one additional field.

      Additional properties are NOT allowed.

      Hide twilio/card attributes Show twilio/card attributes object | null
      • title string Required
      • subtitle string
      • media array[string]
      • actions array[object]
        Hide actions attributes Show actions attributes object
        • type string Required

          Values are URL, PHONE_NUMBER, QUICK_REPLY, COPY_CODE, or VOICE_CALL.

        • title string Required
        • url string
        • phone string
        • id string
        • code string
    • twilio/catalog object | null

      twilio/catalog type lets recipients view list of catalog products, ask questions about products, order products.

      Additional properties are NOT allowed.

      Hide twilio/catalog attributes Show twilio/catalog attributes object | null
      • title string
      • body string Required
      • subtitle string
      • id string
      • items array[object]
        Hide items attributes Show items attributes object
        • id string
        • section_title string
        • name string
        • media_url string
        • price number
        • description string
      • dynamic_items string
    • twilio/flows object | null

      twilio/flows templates allow you to send multiple messages in a set order with text or select options

      Additional properties are NOT allowed.

      Hide twilio/flows attributes Show twilio/flows attributes object | null
      • body string Required
      • button_text string Required
      • subtitle string Required
      • media_url string Required
      • pages array[object] Required
        Hide pages attributes Show pages attributes object
        • id string Required
        • next_page_id string
        • title string
        • subtitle string
        • layout array[object] Required
          Hide layout attributes Show layout attributes object
          • label string Required
          • type string Required
      • type string Required
    • twilio/schedule object | null

      twilio/schedule templates allow us to send a message with a schedule with different time slots

      Additional properties are NOT allowed.

      Hide twilio/schedule attributes Show twilio/schedule attributes object | null
      • id string Required
      • title string Required
      • timeSlots string Required
    • whatsapp/card object | null

      whatsapp/card is a structured template which can be used to send a series of related information. It must include a body and at least one additional field.

      Additional properties are NOT allowed.

      Hide whatsapp/card attributes Show whatsapp/card attributes object | null
      • body string Required
      • media array[string]
      • header_text string
      • actions array[object]
        Hide actions attributes Show actions attributes object
        • type string Required

          Values are URL, PHONE_NUMBER, QUICK_REPLY, COPY_CODE, or VOICE_CALL.

        • title string Required
        • url string
        • phone string
        • id string
        • code string
    • whatsapp/authentication object | null

      whatsApp/authentication templates let companies deliver WA approved one-time-password button.

      Additional properties are NOT allowed.

      Hide whatsapp/authentication attributes Show whatsapp/authentication attributes object | null
      • add_security_recommendation boolean
      • code_expiration_minutes number
      • actions array[object] Required
        Hide actions attributes Show actions attributes object
        • type string Required

          Value is COPY_CODE.

        • copy_code_text string Required

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • date_created string(date-time) | null

      The date and time in GMT that the resource was created specified in RFC 2822 format.

    • date_updated string(date-time) | null

      The date and time in GMT that the resource was last updated specified in RFC 2822 format.

    • sid string | null

      The unique string that that we created to identify the Content resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^HX[0-9a-fA-F]{32}$.

    • account_sid string | null

      The SID of the Account that created Content resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • friendly_name string | null

      A string name used to describe the Content resource. Not visible to the end recipient.

    • language string | null

      Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.

    • variables object | null

      Defines the default placeholder values for variables included in the Content resource. e.g. {"1": "Customer_Name"}.

    • types object | null

      The Content types (e.g. twilio/text) for this Content resource.

    • url string(uri) | null

      The URL of the resource, relative to https://content.twilio.com.

POST /v1/Content
curl \
 --request POST 'https://content.twilio.com/v1/Content' \
 --user "username:password" \
 --header "Content-Type: application/json" \
 --data '{"friendly_name":"string","variables":{"additionalProperty1":"string","additionalProperty2":"string"},"language":"string","types":{"twilio/text":{"body":"string"},"twilio/media":{"body":"string","media":["string"]},"twilio/location":{"latitude":42.0,"longitude":42.0,"label":"string","id":"string","address":"string"},"twilio/list-picker":{"body":"string","button":"string","items":[{"id":"string","item":"string","description":"string"}]},"twilio/call-to-action":{"body":"string","actions":[{"type":"URL","title":"string","url":"string","phone":"string","code":"string","id":"string"}]},"twilio/quick-reply":{"body":"string","actions":[{"type":"QUICK_REPLY","title":"string","id":"string"}]},"twilio/card":{"title":"string","subtitle":"string","media":["string"],"actions":[{"type":"URL","title":"string","url":"string","phone":"string","id":"string","code":"string"}]},"twilio/catalog":{"title":"string","body":"string","subtitle":"string","id":"string","items":[{"id":"string","section_title":"string","name":"string","media_url":"string","price":42.0,"description":"string"}],"dynamic_items":"string"},"twilio/carousel":{"body":"string","cards":[{"title":"string","body":"string","media":"string","actions":[{"type":"URL","title":"string","url":"string","phone":"string","id":"string"}]}]},"twilio/flows":{"body":"string","button_text":"string","subtitle":"string","media_url":"string","pages":[{"id":"string","next_page_id":"string","title":"string","subtitle":"string","layout":[{"label":"string","type":"string"}]}],"type":"string"},"twilio/schedule":{"id":"string","title":"string","timeSlots":"string"},"whatsapp/card":{"body":"string","footer":"string","media":["string"],"header_text":"string","actions":[{"type":"URL","title":"string","url":"string","phone":"string","id":"string","code":"string"}]},"whatsapp/authentication":{"add_security_recommendation":true,"code_expiration_minutes":42.0,"actions":[{"type":"COPY_CODE","copy_code_text":"string"}]}}}'
Request examples
{
  "friendly_name": "string",
  "variables": {
    "additionalProperty1": "string",
    "additionalProperty2": "string"
  },
  "language": "string",
  "types": {
    "twilio/text": {
      "body": "string"
    },
    "twilio/media": {
      "body": "string",
      "media": [
        "string"
      ]
    },
    "twilio/location": {
      "latitude": 42.0,
      "longitude": 42.0,
      "label": "string",
      "id": "string",
      "address": "string"
    },
    "twilio/list-picker": {
      "body": "string",
      "button": "string",
      "items": [
        {
          "id": "string",
          "item": "string",
          "description": "string"
        }
      ]
    },
    "twilio/call-to-action": {
      "body": "string",
      "actions": [
        {
          "type": "URL",
          "title": "string",
          "url": "string",
          "phone": "string",
          "code": "string",
          "id": "string"
        }
      ]
    },
    "twilio/quick-reply": {
      "body": "string",
      "actions": [
        {
          "type": "QUICK_REPLY",
          "title": "string",
          "id": "string"
        }
      ]
    },
    "twilio/card": {
      "title": "string",
      "subtitle": "string",
      "media": [
        "string"
      ],
      "actions": [
        {
          "type": "URL",
          "title": "string",
          "url": "string",
          "phone": "string",
          "id": "string",
          "code": "string"
        }
      ]
    },
    "twilio/catalog": {
      "title": "string",
      "body": "string",
      "subtitle": "string",
      "id": "string",
      "items": [
        {
          "id": "string",
          "section_title": "string",
          "name": "string",
          "media_url": "string",
          "price": 42.0,
          "description": "string"
        }
      ],
      "dynamic_items": "string"
    },
    "twilio/carousel": {
      "body": "string",
      "cards": [
        {
          "title": "string",
          "body": "string",
          "media": "string",
          "actions": [
            {
              "type": "URL",
              "title": "string",
              "url": "string",
              "phone": "string",
              "id": "string"
            }
          ]
        }
      ]
    },
    "twilio/flows": {
      "body": "string",
      "button_text": "string",
      "subtitle": "string",
      "media_url": "string",
      "pages": [
        {
          "id": "string",
          "next_page_id": "string",
          "title": "string",
          "subtitle": "string",
          "layout": [
            {
              "label": "string",
              "type": "string"
            }
          ]
        }
      ],
      "type": "string"
    },
    "twilio/schedule": {
      "id": "string",
      "title": "string",
      "timeSlots": "string"
    },
    "whatsapp/card": {
      "body": "string",
      "footer": "string",
      "media": [
        "string"
      ],
      "header_text": "string",
      "actions": [
        {
          "type": "URL",
          "title": "string",
          "url": "string",
          "phone": "string",
          "id": "string",
          "code": "string"
        }
      ]
    },
    "whatsapp/authentication": {
      "add_security_recommendation": true,
      "code_expiration_minutes": 42.0,
      "actions": [
        {
          "type": "COPY_CODE",
          "copy_code_text": "string"
        }
      ]
    }
  }
}
Response examples (201)
{
  "sid": "HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "https://content.twilio.com/v1/Content/HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "links": {
    "approval_fetch": "https://content.twilio.com/v1/Content/HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ApprovalRequests",
    "approval_create": "https://content.twilio.com/v1/Content/HXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ApprovalRequests/whatsapp"
  },
  "types": {
    "twilio/text": {
      "body": "Foo Bar Co is located at 39.7392, 104.9903"
    },
    "twilio/location": {
      "label": "Foo Bar Co",
      "latitude": 39.7392,
      "longitude": 104.9903
    }
  },
  "language": "en",
  "variables": {
    "name": "foo"
  },
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "2015-07-30T19:00:00Z",
  "date_updated": "2015-07-30T19:00:00Z",
  "friendly_name": ""
}