# &#x20;Create Templates&#x20;

## Create a basic Template (without tags)

<mark style="color:yellow;">`POST`</mark> `https://www.channel360.co.za/v1.1/org/:orgId/whatsapp/templates`

#### Headers

| Name          | Value             |
| ------------- | ----------------- |
| Content-type  | applications/json |
| Authorization | Bearer \<token>   |

#### **Body**

| Name        | Type                                                                             | Description                                                               |
| ----------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| name        | `string` <sup><mark style="color:red;">required<mark style="color:red;"></sup>   | This is the name of your template                                         |
| description | `string` <sup><mark style="color:red;">required<mark style="color:red;"></sup>   | An explanation of what the template is used for                           |
| namespace   | `string` <sup><mark style="color:red;">required<mark style="color:red;"></sup>   |                                                                           |
| language    | `string` <sup><mark style="color:red;">required<mark style="color:red;"></sup>   | The language code of the template                                         |
| enabled     | `boolean` <sup><mark style="color:red;">required<mark style="color:red;"></sup>  | Whether the template is enabled                                           |
| category    | `string` <sup><mark style="color:red;">required<mark style="color:red;"></sup>   | The categories we provide are `AUTHENTICATION`, `MARKETING` and `UTILITY` |
| components  | `object[]` <sup><mark style="color:red;">required<mark style="color:red;"></sup> | Defines the message structure (header, body, buttons)                     |

{% tabs %}
{% tab title="Template without tags" %}

```json
{
    "name": "summer_sale_announcement",
    "description": "Marketing template used to promote seasonal specials",
    "namespace": "default",
    "language": "en_US",
    "enabled": true,
    "category": "MARKETING",
    "components": [
        {
            "type": "HEADER",
            "format": "TEXT",
            "text": "Summer Sale!"
        },
        {
            "type": "BODY",
            "text": "Enjoy our biggest discounts of the season! Shop your favourite items and save up to 40%. Hurry—limited time only."
        },
        {
            "type": "FOOTER",
            "text": "Shop now"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Dynamic Button Template

<mark style="color:yellow;">`POST`</mark> `https://www.channel360.co.za/v1.1/org/:orgId/whatsapp/templates`

{% tabs %}
{% tab title="Template with Dynamic Button Tags" %}

```json
{
    "name": "template_with_dynamic_buttons",
    "description": "This is a template with dynamic buttons",
    "namespace": "default",
    "language": "en_US",
    "enabled": true,
    "category": "MARKETING",
    "components": [
        {
            "type": "BODY",
            "text": "Hi, this is a template with an interactive template"
        },
        {
            "type": "BUTTONS",
            "buttons": [
                {
                    "type": "URL",
                    "url": "https://channel360.co.za/organization/{{1}}",
                    "text": "View Dashboard"
                }
            ]
        }
    ],
    "tags": {
        "head": [
            {
                "type": "image",
                "url": "https://channel360-template-tags.s3.af-south-1.amazonaws.com/2024-03-26T08%3A26%3A03.438Z-Manage-Deals-More-Efficiently.jpg"
            }
        ],
        "body": [],
        "buttons": [
            {
                "type": "on-campaign-creation",
                "value": "organization Id",
                "_id": "6602ce75eee334f4fb700a27"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Text & Media Templates with Tags

{% hint style="info" %}
Templates only support videos encoded with H.264 video codec and AAC audio codec, and they must have either a single audio stream or no audio stream.
{% endhint %}

| Media Template Type | Acceptable Formats            | Media Size |
| ------------------- | ----------------------------- | ---------- |
| Video               | `video/mp4`                   | 15 mb      |
| Image               | `image/jpeg`, `image/png`     | 15 mb      |
| Document            | `application/pdf`, `text/csv` | 15 mb      |

{% tabs %}
{% tab title="Text Template" %}

```json
{
    "name": "basic_text_template",
    "description": "Simple text template",
    "namespace": "default",
    "language": "en_US",
    "enabled": true,
    "category": "MARKETING",
    "components": [
        {
            "type": "BODY",
            "text": "Hello {{1}}, thank you for contacting us.",
            "example": {
                "body_text": [
                    [
                        "Customer"
                    ]
                ]
            }
        }
    ]
}
```

{% endtab %}

{% tab title="Video Template" %}

```json
{
    "name": "video_intro_template",
    "description": "Marketing template demonstrating a video header",
    "namespace": "default",
    "language": "en_US",
    "enabled": true,
    "category": "MARKETING",
    "components": [
        {
            "type": "HEADER",
            "format": "VIDEO",
            "example": {
                "header_url": [
                    "https://channel360-template-tags.s3.af-south-1.amazonaws.com/Zendesk+Overview+Demo.mp4"
                ]
            }
        },
        {
            "type": "BODY",
            "text": "Hi {{1}}, check out this quick video we made for you!",
            "example": {
                "body_text": [
                    [
                        "Sarah"
                    ]
                ]
            }
        },
        {
            "type": "FOOTER",
            "text": "Let us know what you think"
        },
        {
            "type": "BUTTONS",
            "buttons": [
                {
                    "type": "QUICK_REPLY",
                    "text": "Love it"
                },
                {
                    "type": "QUICK_REPLY",
                    "text": "Tell me more"
                }
            ]
        }
    ]
}
```

{% endtab %}

{% tab title="Image Template" %}

```json
{
  "name": "tag_image_template",
  "description": "Image header template",
  "namespace": "default",
  "language": "en_US",
  "enabled": true,
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "IMAGE",
      "example": {
        "header_url": [
          "https://via.placeholder.com/600x400.png"
        ]
      }
    },
    {
      "type": "BODY",
      "text": "Hi {{1}}, here is the image you requested.",
      "example": {
        "body_text": [
          ["Customer"]
        ]
      }
    }
  ]
}

```

{% endtab %}

{% tab title="Document Template" %}

```json
{
  "name": "document_info_template",
  "description": "Document header template example",
  "namespace": "default",
  "language": "en_US",
  "enabled": true,
  "category": "UTILITY",
  "components": [
    {
      "type": "HEADER",
      "format": "DOCUMENT",
      "example": {
        "header_url": [
          "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
        ]
      }
    },
    {
      "type": "BODY",
      "text": "Hi {{1}}, please review the attached document.",
      "example": {
        "body_text": [
          ["Customer"]
        ]
      }
    },
    {
      "type": "FOOTER",
      "text": "Thank you!"
    }
  ]
}

```

{% endtab %}
{% endtabs %}

## Create a Template with Tags and Quick Reply Buttons

{% tabs %}
{% tab title="Text Template" %}

```json
{
  "name": "basic_quickreply_template",
  "description": "Basic template with quick reply buttons",
  "namespace": "default",
  "language": "en_US",
  "enabled": true,
  "category": "MARKETING",
  "components": [
    {
      "type": "BODY",
      "text": "Hi {{1}}, would you like to hear more about our offers?",
      "example": {
        "body_text": [
          ["Customer"]
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "QUICK_REPLY",
          "text": "Yes"
        },
        {
          "type": "QUICK_REPLY",
          "text": "No"
        }
      ]
    }
  ]
}

```

{% endtab %}
{% endtabs %}

## Create a Template with Tags and Call-to-Action Buttons

{% tabs %}
{% tab title="Text Template " %}

```json
{
  "name": "basic_cta_template",
  "description": "Basic template with a CTA URL button",
  "namespace": "default",
  "language": "en_US",
  "enabled": true,
  "category": "MARKETING",
  "components": [
    {
      "type": "BODY",
      "text": "Hi {{1}}, tap below to view your dashboard.",
      "example": {
        "body_text": [
          ["Customer"]
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "URL",
          "text": "View Dashboard",
          "url": "https://example.com/dashboard/{{1}}",
          "example": [
            "12345"
          ]
        }
      ]
    }
  ]
}

```

{% endtab %}
{% endtabs %}

## Create an Authentication Template

<mark style="color:yellow;">`POST`</mark>`https://channel360.co.za/v1.1/org/{orgId}/whatsapp/templates`

**Query String Parameters:**

| Placeholder                      | Description                                                                                                                                                                                                                                                                                                                                                     | Example Value |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| \<ADD\_SECURITY\_RECOMMENDATION> | <p><strong>Optional.</strong></p><p><br></p><p>Set to <code>true</code> if you want the security recommendation body string included in the response.</p><p></p><p>The string is not editable.<br></p><p>If omitted, the security recommendation string will not be included.<br><br>(<em>For your security, do not share this code.)</em><br></p>              | true          |
| \<CODE\_EXPIRATION\_MINUTES>     | <p><strong>Optional.</strong></p><p><br></p><p>Set to an integer if you want the code expiration footer string included in the response.</p><p><br></p><p>If omitted, the code expiration footer string will not be included.</p><p><br></p><p>Value indicates number of minutes until code expires.</p><p>Minimum <code>1</code>, maximum <code>90</code>.</p> | 10            |
| \<BUTTON\_TYPES>                 | <p><strong>Required.</strong></p><p><br></p><p>Comma-separated list of strings indicating button type.</p><p><br></p><p>If included, the response will include the button text for each button in the response.</p><p><br></p><p>For authentication templates, this value must be <code>OTP</code>.</p>                                                         | OTP           |

**Example Request:**

```json
{
  "name": "authentication_code_copy_code_button",
  "language": "en",
  "category": "AUTHENTICATION",
  "components": [
    {
      "type": "BODY",
      "add_security_recommendation": true
    },
    {
      "type": "FOOTER",
      "code_expiration_minutes": 10
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "OTP",
          "otp_type": "COPY_CODE"
        }
      ]
    }
  ]
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.channel360.co.za/api-usage/using-the-channel360-v1.1-api/templates/create-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
