# Send Template Messages

<p class="callout info">While sending a template message, the template contents are not sent. To send a template message, its media link \[public link\] &amp; variable values \[if any\] are sent along with the template name and language</p>

<p class="callout danger">Broadcast with caution - Do not spam. Spamming will lead to the degradation of service and WhatsApp number getting blocked</p>

##### **Sending Message**

##### <span style="background-color: rgb(191, 237, 210);">The template has no parameter</span>

```bash
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
    "purpose": "sendtemplate",
    "to": <recepient phone number>,
    "template": <template name>,
    "code": <language code>    
}'

sample data
--data '{
    "purpose": "sendtemplate",
    "to": "919999900000",
    "template": "conv_start_hi",
    "code": "en_US"    
}'
```

##### <span style="background-color: rgb(191, 237, 210);">The template has image media</span>

<p class="callout info">The image typically does not look like a regular parameter while creating the template. However, is a parameter</p>

```bash
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
    "purpose": "sendtemplate",
    "to": <recepient>,
    "template": "schedule",
    "code": "en",
    "components": [
        {
            "type": "header",
            "parameters": [
                {
                    "type": "image",
                    "image": {
                        "link": "https://cdn.anuhealthyfood.in/images/missyourorders.png"
                    }
                }
            ]
        }
    ]
}'
```

<p class="callout warning">The link has to be publically accessible, or else the template won't be delivered to the user</p>

##### <span style="background-color: rgb(191, 237, 210);">The template has body parameters</span>

```bash
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
    "purpose": "sendtemplate",
    "to": <recepient>,
    "template": "schedule",
    "code": "en",
    "components": [
        {
            "type": "body",
            "parameters": [
                {
                    "type": "TEXT",
                    "text": "Hemant Suryavanshi"
                },
                {
                    "type": "TEXT",
                    "text": "Blue USB Microphone"
                },
                {
                    "type": "TEXT",
                    "text": "12/12/2024"
                }
            ]
        }
    ]
}'
```

<span style="background-color: rgb(191, 237, 210);"></span>

<p class="callout info">In the above example, the template has three body variables. As depicted, only parameters are passed and not the entire body</p>

##### <span style="background-color: rgb(191, 237, 210);">The template has body parameters and </span><span style="background-color: rgb(191, 237, 210);">image media</span>

```bash
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
    "purpose": "sendtemplate",
    "to": <recepient>,
    "template": "schedule",
    "code": "en",
    "components": [
        {
            "type": "header",
            "parameters": [
                {
                    "type": "image",
                    "image": {
                        "link": "https://cdn.anuhealthyfood.in/images/missyourorders.png"
                    }
                }
            ]
        },
        {
            "type": "body",
            "parameters": [
                {
                    "type": "TEXT",
                    "text": "Hemant Suryavanshi"
                },
                {
                    "type": "TEXT",
                    "text": "Blue USB Microphone"
                },
                {
                    "type": "TEXT",
                    "text": "12/12/2024"
                }
            ]
        }
    ]
}'
```

<p class="callout info">In the above example, there is an image and three body parameters in the template</p>

<p class="callout success">Response</p>

```bash
{
    "message": "Message sent successfully",
    "response_text": "{"messaging_product":"whatsapp","contacts":[{"input":"+16312924377","wa_id":"16312924377"}],"messages":[{"id":"wamid.HBgLMTYzMTI5MjQzNzcVAgARGBIxNEExODY3MjhGMDNGNDRBNjgA","message_status":"accepted"}]}",
    "status": "200"
}

```