Skip to main content
Post the necessary fields for the API to upload files. The files need to be a buffer with the key “fileAttachment”. <br /><br /> The allowed file types are: <br/> <ul><li>JPG</li><li>JPEG</li><li>PNG</li><li>MP4</li><li>MPEG</li><li>ZIP</li><li>RAR</li><li>PDF</li><li>DOC</li><li>DOCX</li><li>TXT</li><li>MP3</li><li>WAV</li></ul> <br /><br /> The API will return an object with the URLs
POST https://services.leadconnectorhq.com/conversations/messages/upload

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

conversationId
string
default:"ve9EPM428h8vShlRW1KT"
required
Conversation Id
contactId
string
default:"ve9EPM428h8vShlRW1KT"
required
Contact Id
locationId
string
required
attachmentUrls
string[]
required
chatServiceSid
string
default:"ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Twilio chat service SID for group SMS uploads
isGroupSms
string
default:"true"
Flag to indicate group SMS upload flow. When true, only 1 file upload is allowed per request.

Respuestas

uploadedFiles
object
required
twilioMediaSids
string[]
Twilio media SIDs for group SMS (when isGroupSms=true)
{
  "uploadedFiles": {},
  "twilioMediaSids": [
    "MExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ]
}
{}
{}
status
number
default:"413"
required
HTTP Status code of the request Posibles valores: 400, 413, 415
message
string
default:"Failed to upload the files"
required
Error message of the request
{
  "status": 413,
  "message": "Failed to upload the files"
}
status
number
default:"413"
required
HTTP Status code of the request Posibles valores: 400, 413, 415
message
string
default:"Failed to upload the files"
required
Error message of the request
{
  "status": 413,
  "message": "Failed to upload the files"
}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/conversations/messages/upload' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "conversationId": "ve9EPM428h8vShlRW1KT",
  "contactId": "ve9EPM428h8vShlRW1KT",
  "locationId": "string",
  "attachmentUrls": [
    "string"
  ],
  "chatServiceSid": "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "isGroupSms": "true"
}'
const response = await fetch('https://services.leadconnectorhq.com/conversations/messages/upload', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"conversationId": "ve9EPM428h8vShlRW1KT", "contactId": "ve9EPM428h8vShlRW1KT", "locationId": "string", "attachmentUrls": ["string"], "chatServiceSid": "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "isGroupSms": "true"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/conversations/messages/upload',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"conversationId": "ve9EPM428h8vShlRW1KT", "contactId": "ve9EPM428h8vShlRW1KT", "locationId": "string", "attachmentUrls": ["string"], "chatServiceSid": "ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "isGroupSms": "true"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/conversations/messages/upload');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'conversationId': 've9EPM428h8vShlRW1KT', 'contactId': 've9EPM428h8vShlRW1KT', 'locationId': 'string', 'attachmentUrls': ['string'], 'chatServiceSid': 'ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'isGroupSms': 'true'}),
]);
$data = json_decode(curl_exec($ch), true);