Send Message
const url = 'https://api.linqapp.com/api/partner/v2/chats/1/chat_messages';const form = new FormData();form.append('message[text]', 'Hello, how are you?');form.append('message[idempotency_key]', 'msg-2024_01-23_abc123');
const options = { method: 'POST', headers: {'X-LINQ-INTEGRATION-TOKEN': '<X-LINQ-INTEGRATION-TOKEN>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.linqapp.com/api/partner/v2/chats/1/chat_messages \ --header 'Content-Type: multipart/form-data' \ --header 'X-LINQ-INTEGRATION-TOKEN: <X-LINQ-INTEGRATION-TOKEN>' \ --form 'message[text]=Hello, how are you?' \ --form 'message[idempotency_key]=msg-2024_01-23_abc123'Sends a new message in the specified chat.
Idempotency: To prevent duplicate messages (e.g., due to network retries), include a unique message[idempotency_key] in your request. If a message with the same key was already sent, the API will return the existing message with a 200 status instead of creating a duplicate. The idempotency key must be alphanumeric and may include hyphens and underscores.
Attachments: You can attach files in two ways:
- Direct upload - Use
message[attachments][]fields in your multipart/form-data request to upload files directly:
-F "message[attachments][][email protected]" \
-F "message[attachments][][email protected]"
- URLs - Use
message[attachment_urls][]to provide URLs of files. The API will download them from the provided URLs (must be publicly accessible, 30-second timeout per download):
-F "message[attachment_urls][]=https://example.com/document.pdf" \
-F "message[attachment_urls][]=https://example.com/image.jpg"
Both methods can be used together in the same message.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The chat ID
Request Body required
Section titled “Request Body required ”object
The message text content
Optional unique key to prevent duplicate messages. Must be alphanumeric and may include hyphens and underscores.
Optional file attachments to upload. Include one field per file (e.g., message[attachments][][email protected] message[attachments][][email protected]). Omit this field if not uploading files.
Optional URLs of files to attach. The API will download files from these URLs (must be publicly accessible). Uses a 30-second timeout per download. Omit this field if not attaching files via URLs.
Examples
Basic text message
{ "message[text]": "Hello, how are you?", "message[idempotency_key]": "msg-2024_01-23_abc123"}Message with attachment URLs
{ "message[text]": "Here are the files you requested.", "message[attachment_urls][]": [ "https://example.com/document.pdf", "https://example.com/image.jpg" ]}Message with direct file uploads
For direct file uploads via multipart/form-data. Use cURL with -F flags:
curl -X POST “https://api.linqapp.com/api/partner/v2/chats/{chat_id}/chat_messages”
-H “X-LINQ-INTEGRATION-TOKEN: your_token”
-F “message[text]=Check out these files”
-F “message[attachments][]=@/path/to/file1.jpg”
-F “message[attachments][]=@/path/to/file2.pdf”
{ "message[text]": "Check out these files", "message[attachments][]": [ "<binary file data>" ]}Responses
Section titled “ Responses ”Message sent successfully
object
object
Current delivery status of the message
The phone number or identifier that sent this message
object
Unique identifier for the attachment
object
The type of reaction
Example
{ "data": { "id": 224, "text": "Hello, how are you?", "sent_at": "2025-05-21T15:30:00.123-05:00", "delivered_at": "2025-05-21T15:30:05.456-05:00", "delivery_status": "pending", "edited_at": "2025-05-21T15:31:00.789-05:00", "is_read": false, "sent_from": "+15551234567", "chat_handle_id": 123, "attachments": [ { "id": "abc12345-1234-5678-9abc-def012345678", "url": "https://storage.googleapis.com/linq-files/attachments/abc123.pdf", "filename": "document.pdf", "mime_type": "application/pdf", "file_size": 12345 } ], "reactions": [ { "id": 456, "chat_message_id": 224, "reaction": "love", "is_from_me": false, "from_phone": "+15551234567", "sent_at": "2025-05-21T15:30:00.000-05:00", "created_at": "2025-05-21T15:30:00.000-05:00", "updated_at": "2025-05-21T15:30:00.000-05:00" } ] }}