Retrieve a message
curl --request GET \
--url https://rest.newlead.ai/v1/messages/{message_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/messages/{message_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/messages/{message_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "inbound",
"sender": "lead",
"origin": "lead",
"type": "text",
"text": "<string>",
"template": {
"name": "<string>",
"language": "<string>"
},
"attachments": [
{
"object": "attachment",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "image",
"mime_type": "<string>",
"file_name": "<string>",
"file_size": 123,
"transcription": "<string>"
}
],
"reply_to_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "received",
"error": {
"code": 123,
"category": "recipient_not_reachable"
},
"created_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"delivered_at": "2023-11-07T05:31:56Z",
"read_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"lead_created": true,
"warnings": [
"pause_ai_failed"
]
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Messages
Retrieve a message
Use it to check the delivery status.
GET
/
messages
/
{message_id}
Retrieve a message
curl --request GET \
--url https://rest.newlead.ai/v1/messages/{message_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/messages/{message_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/messages/{message_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"object": "message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "inbound",
"sender": "lead",
"origin": "lead",
"type": "text",
"text": "<string>",
"template": {
"name": "<string>",
"language": "<string>"
},
"attachments": [
{
"object": "attachment",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "image",
"mime_type": "<string>",
"file_name": "<string>",
"file_size": 123,
"transcription": "<string>"
}
],
"reply_to_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "received",
"error": {
"code": 123,
"category": "recipient_not_reachable"
},
"created_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"delivered_at": "2023-11-07T05:31:56Z",
"read_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"lead_created": true,
"warnings": [
"pause_ai_failed"
]
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Authorizations
BearerAuthApiKeyHeader
Response
The message.
received: a message from the lead. queued: stored but not yet sent to WhatsApp (in the queue, outside sending hours, waiting for template approval or with no channel connected). accepted: WhatsApp accepted it. sent, delivered, read and failed are confirmed by WhatsApp later.
Available options:
received, queued, accepted, sent, delivered, read, failed