Skip to main content
Messages API create & update
Marcel Ursprung avatar
Written by Marcel Ursprung
Updated over a month ago

Visit api.envoke.com to test APIs and get examples in 20+ languages

Response

After a successful message insert the message ID is returned along with the full message object. This ID can be used to update the message later.

Message fields

All examples below show the POST URL followed by the POST data. Each example below also includes a cURL request. Make sure to change the API_ID and API_KEY with your values.

Create a message

Endpoint: /messages
​HTTP method: POST
​URL: https://e1.envoke.com/v2/messages

Supply the message object JSON in the POST data:

https://e1.envoke.com/v2/messages
{
"name": "test message",
"group": "test",
"sender": "Envoke Test <test@envoke.com>",
"subject": "This is a test message",
"recipient_tag": "test_contacts",
"html": "<body>This is a <strong>TEST</strong> message.</body>"
}

curl -X POST -u API_ID:API_KEY -d '{"name":"test message","group":"test","sender":"Envoke Test <test@envoke.com>","subject":"This is a test message","recipient_tag":"test_contacts","html":"<body>This is a <strong>TEST</strong> message.</body>"}' "https://e1.envoke.com/v2/messages"

Successful response:

{
"success": true,
"result_text": "Successfully created",
"result_data": {
"id": "1234",
"external_id": "x5j45ab4217aa1af159676b17f660821",
"preview_url": "https://engage.envoke.com/m/55age4d3dvb93586ad05812b2cc4321e/m/x5j45ab4217aa1af159676b17f660821",
"create_time": "2024-12-01 15:22:12",
"modified_time": "2024-12-01 15:22:12",
"name": "test message",
"group": "test",
"status": "Draft",
"send_time": "",
"sender": "Envoke Test <test@envoke.com>",
"subject": "This is a test message",
"language": "en",
"recipient_subscription": "",
"recipient_tag": "test_contacts",
"recipient_segment": "",
"publish_archive": false,
"utm_tag_links": true
}
}

Missing HTML or template_id error

NOTE: HTML code or an existing template_id is required when creating a message otherwise you will get the following error:

{
"success": false,
"result_data": {
"errors": [
"One of the fields 'template_id' or 'html' must be provided in order to create a message"
]
},
"result_text": "Validation failed, see 'result_data' -> 'errors'"
}

Update a message

Endpoint: /messages/{id}
​HTTP method: PATCH
​URL: https://e1.envoke.com/v2/messages/{MESSAGE_ID}

Replace {MESSAGE_ID} with the message id and include the message update object JSON in the PATCH data.

Update a message with the id "1234"

https://e1.envoke.com/v2/messages/1234
{
"subject": "TEST API message",
"html": "<body>Hello!</body>"
}

curl -X PATCH -u API_ID:API_KEY -d '{"subject":"TEST API message","html":"<body>Hello!</body>"' "https://e1.envoke.com/v2/messages/1234"

Did this answer your question?