> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conversive.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conversive.ai/_mcp/server.

# WhatsApp Media Template

Send a pre-approved WhatsApp Message Template with an image header and body variables.

## Authentication

All requests require an `apiKey` header containing your Conversive API key.

```http
apiKey: <YOUR_API_KEY>
```

> **Note**
>
> Pass the API key as a request header named `apiKey`, not as a Bearer token in the `Authorization` header.

## Request

### Request

POST [https://api.beconversive.com/api/v2/message/send](https://api.beconversive.com/api/v2/message/send)

**`WhatsApp Media Template`**

```curl WhatsApp Media Template
curl -X POST https://api.beconversive.com/api/v2/message/send \
     -H "apiKey: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "userPayload": {
    "type": "api",
    "apiKey": "YOUR_API_KEY"
  },
  "messageDetails": [
    {
      "recipient": [
        {
          "channelType": "whatsapp",
          "phone": "RECIPIENT_PHONE"
        }
      ],
      "sender": {
        "channelType": "whatsapp",
        "phone": "SENDER_PHONE"
      },
      "source": "1",
      "messageId": "UNIQUE_MESSAGE_ID",
      "message": {
        "type": "custom",
        "content": {
          "custom": {
            "template": {
              "components": [
                {
                  "parameters": [
                    {
                      "type": "image",
                      "value": {
                        "link": "https://example.com/path/to/image.png"
                      }
                    }
                  ],
                  "type": "header"
                },
                {
                  "parameters": [
                    {
                      "type": "text",
                      "value": "VARIABLE_1"
                    },
                    {
                      "type": "text",
                      "value": "VARIABLE_2"
                    }
                  ],
                  "type": "body"
                }
              ],
              "language": {
                "code": "en",
                "policy": "deterministic"
              },
              "name": "whatsapp_media_template_name"
            },
            "type": "template"
          },
          "messageText": "Sample media template message",
          "type": "custom"
        }
      }
    }
  ]
}'
```

**`WhatsApp Media Template`**

```python WhatsApp Media Template
import requests

url = "https://api.beconversive.com/api/v2/message/send"

payload = {
    "userPayload": {
        "type": "api",
        "apiKey": "YOUR_API_KEY"
    },
    "messageDetails": [
        {
            "recipient": [
                {
                    "channelType": "whatsapp",
                    "phone": "RECIPIENT_PHONE"
                }
            ],
            "sender": {
                "channelType": "whatsapp",
                "phone": "SENDER_PHONE"
            },
            "source": "1",
            "messageId": "UNIQUE_MESSAGE_ID",
            "message": {
                "type": "custom",
                "content": {
                    "custom": {
                        "template": {
                            "components": [
                                {
                                    "parameters": [
                                        {
                                            "type": "image",
                                            "value": { "link": "https://example.com/path/to/image.png" }
                                        }
                                    ],
                                    "type": "header"
                                },
                                {
                                    "parameters": [
                                        {
                                            "type": "text",
                                            "value": "VARIABLE_1"
                                        },
                                        {
                                            "type": "text",
                                            "value": "VARIABLE_2"
                                        }
                                    ],
                                    "type": "body"
                                }
                            ],
                            "language": {
                                "code": "en",
                                "policy": "deterministic"
                            },
                            "name": "whatsapp_media_template_name"
                        },
                        "type": "template"
                    },
                    "messageText": "Sample media template message",
                    "type": "custom"
                }
            }
        }
    ]
}
headers = {
    "apiKey": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`WhatsApp Media Template`**

```javascript WhatsApp Media Template
const url = 'https://api.beconversive.com/api/v2/message/send';
const options = {
  method: 'POST',
  headers: {apiKey: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"userPayload":{"type":"api","apiKey":"YOUR_API_KEY"},"messageDetails":[{"recipient":[{"channelType":"whatsapp","phone":"RECIPIENT_PHONE"}],"sender":{"channelType":"whatsapp","phone":"SENDER_PHONE"},"source":"1","messageId":"UNIQUE_MESSAGE_ID","message":{"type":"custom","content":{"custom":{"template":{"components":[{"parameters":[{"type":"image","value":{"link":"https://example.com/path/to/image.png"}}],"type":"header"},{"parameters":[{"type":"text","value":"VARIABLE_1"},{"type":"text","value":"VARIABLE_2"}],"type":"body"}],"language":{"code":"en","policy":"deterministic"},"name":"whatsapp_media_template_name"},"type":"template"},"messageText":"Sample media template message","type":"custom"}}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`WhatsApp Media Template`**

```go WhatsApp Media Template
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beconversive.com/api/v2/message/send"

	payload := strings.NewReader("{\n  \"userPayload\": {\n    \"type\": \"api\",\n    \"apiKey\": \"YOUR_API_KEY\"\n  },\n  \"messageDetails\": [\n    {\n      \"recipient\": [\n        {\n          \"channelType\": \"whatsapp\",\n          \"phone\": \"RECIPIENT_PHONE\"\n        }\n      ],\n      \"sender\": {\n        \"channelType\": \"whatsapp\",\n        \"phone\": \"SENDER_PHONE\"\n      },\n      \"source\": \"1\",\n      \"messageId\": \"UNIQUE_MESSAGE_ID\",\n      \"message\": {\n        \"type\": \"custom\",\n        \"content\": {\n          \"custom\": {\n            \"template\": {\n              \"components\": [\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"image\",\n                      \"value\": {\n                        \"link\": \"https://example.com/path/to/image.png\"\n                      }\n                    }\n                  ],\n                  \"type\": \"header\"\n                },\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_1\"\n                    },\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_2\"\n                    }\n                  ],\n                  \"type\": \"body\"\n                }\n              ],\n              \"language\": {\n                \"code\": \"en\",\n                \"policy\": \"deterministic\"\n              },\n              \"name\": \"whatsapp_media_template_name\"\n            },\n            \"type\": \"template\"\n          },\n          \"messageText\": \"Sample media template message\",\n          \"type\": \"custom\"\n        }\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("apiKey", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`WhatsApp Media Template`**

```ruby WhatsApp Media Template
require 'uri'
require 'net/http'

url = URI("https://api.beconversive.com/api/v2/message/send")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["apiKey"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"userPayload\": {\n    \"type\": \"api\",\n    \"apiKey\": \"YOUR_API_KEY\"\n  },\n  \"messageDetails\": [\n    {\n      \"recipient\": [\n        {\n          \"channelType\": \"whatsapp\",\n          \"phone\": \"RECIPIENT_PHONE\"\n        }\n      ],\n      \"sender\": {\n        \"channelType\": \"whatsapp\",\n        \"phone\": \"SENDER_PHONE\"\n      },\n      \"source\": \"1\",\n      \"messageId\": \"UNIQUE_MESSAGE_ID\",\n      \"message\": {\n        \"type\": \"custom\",\n        \"content\": {\n          \"custom\": {\n            \"template\": {\n              \"components\": [\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"image\",\n                      \"value\": {\n                        \"link\": \"https://example.com/path/to/image.png\"\n                      }\n                    }\n                  ],\n                  \"type\": \"header\"\n                },\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_1\"\n                    },\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_2\"\n                    }\n                  ],\n                  \"type\": \"body\"\n                }\n              ],\n              \"language\": {\n                \"code\": \"en\",\n                \"policy\": \"deterministic\"\n              },\n              \"name\": \"whatsapp_media_template_name\"\n            },\n            \"type\": \"template\"\n          },\n          \"messageText\": \"Sample media template message\",\n          \"type\": \"custom\"\n        }\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

**`WhatsApp Media Template`**

```java WhatsApp Media Template
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beconversive.com/api/v2/message/send")
  .header("apiKey", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"userPayload\": {\n    \"type\": \"api\",\n    \"apiKey\": \"YOUR_API_KEY\"\n  },\n  \"messageDetails\": [\n    {\n      \"recipient\": [\n        {\n          \"channelType\": \"whatsapp\",\n          \"phone\": \"RECIPIENT_PHONE\"\n        }\n      ],\n      \"sender\": {\n        \"channelType\": \"whatsapp\",\n        \"phone\": \"SENDER_PHONE\"\n      },\n      \"source\": \"1\",\n      \"messageId\": \"UNIQUE_MESSAGE_ID\",\n      \"message\": {\n        \"type\": \"custom\",\n        \"content\": {\n          \"custom\": {\n            \"template\": {\n              \"components\": [\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"image\",\n                      \"value\": {\n                        \"link\": \"https://example.com/path/to/image.png\"\n                      }\n                    }\n                  ],\n                  \"type\": \"header\"\n                },\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_1\"\n                    },\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_2\"\n                    }\n                  ],\n                  \"type\": \"body\"\n                }\n              ],\n              \"language\": {\n                \"code\": \"en\",\n                \"policy\": \"deterministic\"\n              },\n              \"name\": \"whatsapp_media_template_name\"\n            },\n            \"type\": \"template\"\n          },\n          \"messageText\": \"Sample media template message\",\n          \"type\": \"custom\"\n        }\n      }\n    }\n  ]\n}")
  .asString();
```

**`WhatsApp Media Template`**

```php WhatsApp Media Template
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beconversive.com/api/v2/message/send', [
  'body' => '{
  "userPayload": {
    "type": "api",
    "apiKey": "YOUR_API_KEY"
  },
  "messageDetails": [
    {
      "recipient": [
        {
          "channelType": "whatsapp",
          "phone": "RECIPIENT_PHONE"
        }
      ],
      "sender": {
        "channelType": "whatsapp",
        "phone": "SENDER_PHONE"
      },
      "source": "1",
      "messageId": "UNIQUE_MESSAGE_ID",
      "message": {
        "type": "custom",
        "content": {
          "custom": {
            "template": {
              "components": [
                {
                  "parameters": [
                    {
                      "type": "image",
                      "value": {
                        "link": "https://example.com/path/to/image.png"
                      }
                    }
                  ],
                  "type": "header"
                },
                {
                  "parameters": [
                    {
                      "type": "text",
                      "value": "VARIABLE_1"
                    },
                    {
                      "type": "text",
                      "value": "VARIABLE_2"
                    }
                  ],
                  "type": "body"
                }
              ],
              "language": {
                "code": "en",
                "policy": "deterministic"
              },
              "name": "whatsapp_media_template_name"
            },
            "type": "template"
          },
          "messageText": "Sample media template message",
          "type": "custom"
        }
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'apiKey' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`WhatsApp Media Template`**

```csharp WhatsApp Media Template
using RestSharp;

var client = new RestClient("https://api.beconversive.com/api/v2/message/send");
var request = new RestRequest(Method.POST);
request.AddHeader("apiKey", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"userPayload\": {\n    \"type\": \"api\",\n    \"apiKey\": \"YOUR_API_KEY\"\n  },\n  \"messageDetails\": [\n    {\n      \"recipient\": [\n        {\n          \"channelType\": \"whatsapp\",\n          \"phone\": \"RECIPIENT_PHONE\"\n        }\n      ],\n      \"sender\": {\n        \"channelType\": \"whatsapp\",\n        \"phone\": \"SENDER_PHONE\"\n      },\n      \"source\": \"1\",\n      \"messageId\": \"UNIQUE_MESSAGE_ID\",\n      \"message\": {\n        \"type\": \"custom\",\n        \"content\": {\n          \"custom\": {\n            \"template\": {\n              \"components\": [\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"image\",\n                      \"value\": {\n                        \"link\": \"https://example.com/path/to/image.png\"\n                      }\n                    }\n                  ],\n                  \"type\": \"header\"\n                },\n                {\n                  \"parameters\": [\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_1\"\n                    },\n                    {\n                      \"type\": \"text\",\n                      \"value\": \"VARIABLE_2\"\n                    }\n                  ],\n                  \"type\": \"body\"\n                }\n              ],\n              \"language\": {\n                \"code\": \"en\",\n                \"policy\": \"deterministic\"\n              },\n              \"name\": \"whatsapp_media_template_name\"\n            },\n            \"type\": \"template\"\n          },\n          \"messageText\": \"Sample media template message\",\n          \"type\": \"custom\"\n        }\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`WhatsApp Media Template`**

```swift WhatsApp Media Template
import Foundation

let headers = [
  "apiKey": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "userPayload": [
    "type": "api",
    "apiKey": "YOUR_API_KEY"
  ],
  "messageDetails": [
    [
      "recipient": [
        [
          "channelType": "whatsapp",
          "phone": "RECIPIENT_PHONE"
        ]
      ],
      "sender": [
        "channelType": "whatsapp",
        "phone": "SENDER_PHONE"
      ],
      "source": "1",
      "messageId": "UNIQUE_MESSAGE_ID",
      "message": [
        "type": "custom",
        "content": [
          "custom": [
            "template": [
              "components": [
                [
                  "parameters": [
                    [
                      "type": "image",
                      "value": ["link": "https://example.com/path/to/image.png"]
                    ]
                  ],
                  "type": "header"
                ],
                [
                  "parameters": [
                    [
                      "type": "text",
                      "value": "VARIABLE_1"
                    ],
                    [
                      "type": "text",
                      "value": "VARIABLE_2"
                    ]
                  ],
                  "type": "body"
                ]
              ],
              "language": [
                "code": "en",
                "policy": "deterministic"
              ],
              "name": "whatsapp_media_template_name"
            ],
            "type": "template"
          ],
          "messageText": "Sample media template message",
          "type": "custom"
        ]
      ]
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beconversive.com/api/v2/message/send")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Schema (`request`)

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/v2/message/send:
    post:
      operationId: sendMessages
      summary: Send Messages
      responses:
        '200':
          description: Messages queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
servers:
  - url: https://api.beconversive.com
    description: US Data Center
  - url: https://eu-api.beconversive.com
    description: EU Data Center
  - url: https://aus-api.beconversive.com
    description: Australia Data Center
  - url: https://qa-api.beconversive.com
    description: QA
  - url: https://staging-api.beconversive.com
    description: Staging
components:
  schemas:
    SendMessageRequestUserPayload:
      type: object
      properties:
        type:
          type: string
        apiKey:
          type: string
      required:
        - type
        - apiKey
      title: SendMessageRequestUserPayload
    ChannelParty:
      type: object
      properties:
        channelType:
          type: string
        phone:
          type: string
      title: ChannelParty
    MessageContentContent:
      type: object
      properties: {}
      title: MessageContentContent
    MessageContent:
      type: object
      properties:
        type:
          type: string
        content:
          $ref: '#/components/schemas/MessageContentContent'
      title: MessageContent
    MessageDetails:
      type: object
      properties:
        recipient:
          type: array
          items:
            $ref: '#/components/schemas/ChannelParty'
        sender:
          $ref: '#/components/schemas/ChannelParty'
        source:
          type: integer
        messageId:
          type: string
        message:
          $ref: '#/components/schemas/MessageContent'
      title: MessageDetails
    SendMessageRequest:
      type: object
      properties:
        userPayload:
          $ref: '#/components/schemas/SendMessageRequestUserPayload'
        messageDetails:
          type: array
          items:
            $ref: '#/components/schemas/MessageDetails'
      required:
        - userPayload
        - messageDetails
      title: SendMessageRequest
    SendMessageResponseResponse:
      type: object
      properties:
        vstatus:
          type: string
        responseText:
          type: string
      title: SendMessageResponseResponse
    SendMessageResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/SendMessageResponseResponse'
      title: SendMessageResponse
    ErrorResponseResponse:
      type: object
      properties:
        vstatus:
          type: string
        responseText:
          type: string
      title: ErrorResponseResponse
    ErrorResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/ErrorResponseResponse'
      title: ErrorResponse

```

## Response

### Schema (`response`)

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/v2/message/send:
    post:
      operationId: sendMessages
      summary: Send Messages
      responses:
        '200':
          description: Messages queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
servers:
  - url: https://api.beconversive.com
    description: US Data Center
  - url: https://eu-api.beconversive.com
    description: EU Data Center
  - url: https://aus-api.beconversive.com
    description: Australia Data Center
  - url: https://qa-api.beconversive.com
    description: QA
  - url: https://staging-api.beconversive.com
    description: Staging
components:
  schemas:
    SendMessageRequestUserPayload:
      type: object
      properties:
        type:
          type: string
        apiKey:
          type: string
      required:
        - type
        - apiKey
      title: SendMessageRequestUserPayload
    ChannelParty:
      type: object
      properties:
        channelType:
          type: string
        phone:
          type: string
      title: ChannelParty
    MessageContentContent:
      type: object
      properties: {}
      title: MessageContentContent
    MessageContent:
      type: object
      properties:
        type:
          type: string
        content:
          $ref: '#/components/schemas/MessageContentContent'
      title: MessageContent
    MessageDetails:
      type: object
      properties:
        recipient:
          type: array
          items:
            $ref: '#/components/schemas/ChannelParty'
        sender:
          $ref: '#/components/schemas/ChannelParty'
        source:
          type: integer
        messageId:
          type: string
        message:
          $ref: '#/components/schemas/MessageContent'
      title: MessageDetails
    SendMessageRequest:
      type: object
      properties:
        userPayload:
          $ref: '#/components/schemas/SendMessageRequestUserPayload'
        messageDetails:
          type: array
          items:
            $ref: '#/components/schemas/MessageDetails'
      required:
        - userPayload
        - messageDetails
      title: SendMessageRequest
    SendMessageResponseResponse:
      type: object
      properties:
        vstatus:
          type: string
        responseText:
          type: string
      title: SendMessageResponseResponse
    SendMessageResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/SendMessageResponseResponse'
      title: SendMessageResponse
    ErrorResponseResponse:
      type: object
      properties:
        vstatus:
          type: string
        responseText:
          type: string
      title: ErrorResponseResponse
    ErrorResponse:
      type: object
      properties:
        response:
          $ref: '#/components/schemas/ErrorResponseResponse'
      title: ErrorResponse

```

## Errors

| Status Code | Meaning                                     |
| ----------- | ------------------------------------------- |
| 400         | Bad Request — missing or invalid parameters |
| 401         | Unauthorized — invalid or missing API key   |
| 403         | Forbidden — insufficient permissions        |
| 404         | Not Found — endpoint or resource not found  |
| 429         | Too Many Requests — rate limit exceeded     |
| 500         | Internal Server Error — contact support     |