Skip to main content
POST
/
workspaces
/
{workspace}
/
contacts
/
number
/
{number}
/
template-messages
Send Template Message
curl --request POST \
  --url https://lancepilot.com/api/v3/workspaces/{workspace}/contacts/number/{number}/template-messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "template_id": 12,
  "template_data": {
    "header": {
      "media": {
        "file": "https://example.com/sample-image.jpg"
      }
    }
  }
}'
{
  "status": 201,
  "message": "Resource created successfully.",
  "data": {}
}

Description

This endpoint allows you to send a template message with optional media in the header. You can provide the media in two ways:
  1. Media URL: Pass the media URL in template_data.header.media.file.
  2. Uploaded File: Send the media as a file instance using multipart/form-data in the same field (template_data.header.media.file).

File Field Requirements

  • file:
    • Required (when template has media header)
    • Allowed types: image, video, document
    • Maximum size: 16 MB (max:16384 KB)

Request Options

  • Media URL Example (JSON):
{
  "template_id": 12,
  "template_data": {
    "header": {
      "media": {
        "file": "https://example.com/sample-image.jpg"
      }
    }
  }
}
  • Uploaded File Example (multipart/form-data):
POST /api/v3/send-template-message
Content-Type: multipart/form-data

template_id: 12
template_data[header][media][file]: [binary file]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspace
string<uuid>
required

ID of the workspace.

number
string<uuid>
required

Number of the contact.

Body

application/json
template_id
integer
required
Example:

12

template_data
object

Response

status
integer
required
Example:

201

message
string
required
Example:

"Resource created successfully."

data
object
required

Created resource data.