# Template Messages

{% hint style="info" %}
A message template is required to start a business-initiated conversation. These messages are stored on a WABA level, so multiple phone numbers in the same WABA can use the same template messages.&#x20;
{% endhint %}

Template messages must be submitted to Meta for approval before they are available to use.

Each WhatsApp Business Account can have up to 250 message templates. That means 250 message template names, and each of them can have multiple language translations. For example, a message template called `hello_world` translated into two languages counts as a single message template in regards to this limit.&#x20;

### Sending a Template Message

## Send Template Message

<mark style="color:green;">`POST`</mark> `https://api.qikchat.in/v1/messages`

#### Request Body

| Name                                          | Type   | Description                                       |
| --------------------------------------------- | ------ | ------------------------------------------------- |
| to\_contact<mark style="color:red;">\*</mark> | string | customer whatsapp number you want to send message |
| type<mark style="color:red;">\*</mark>        | strng  | template                                          |
| template<mark style="color:red;">\*</mark>    | String | contains multiple fields                          |

{% tabs %}
{% tab title="200: OK " %}
A successful response includes a data object with an ID for the message sent.

```json
{
    "status": true,
    "message": "Messages queued successfully",
    "data": [
        {
            "id": "52JH6WmuSruAVyXvBBYemd0Ia",
            "channel": "whatsapp",
            "from": "918080808081",
            "recipient": "+918080808080",
            "credits": 0.80,
            "created_at": "2023-02-19T12:52:25.222Z",
            "status": "queued"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

#### Example 1  - Sending Basic Template Message

```json
{
    "to_contact": "+91XXXXX12345",
    "type": "template",
    "template": { 
        "name": "sample_shipping_confirmation",
        "language": "en_US",
        "components": [
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "4"
                    }
                ]
            }
        ]
    }
}
```

#### Example 2  - Sending Media Template Message with Parameters

```json
{
    "to_contact": "+91XXXXX12345",
    "type": "template",
    "template": {
        "name": "template_name",
        "language": "en_US",
        "components": [
            {
                "type": "header", # optional
                "parameters": [
                    {
                        "type": "image",
                        "image": {
                            "link": "http(s)://the-url"
                        }
                    } # OR
                    {
                        "type": "video",
                        "video": {
                            "link": "http(s)://the-url"
                        }
                    } # OR
                    {
                        "type": "document",
                        "document": {
                            "link": "http(s)://the-url",
                            "filename": "file-name"
                        }
                    } # OR
                    {
                        "type": "text",
                        "text": "Welcome header text"
                    }
                ] 
            },
            {
                "type": "body",
                "parameters": [
                    {
                        "type": "text",
                        "text": "sample2"
                    }
                ]
            }
        ]
    }
}
```
