Skip to main content

Send API requests & responses

Marcus Warren avatar
Written by Marcus Warren
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.

Send 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.

Send a message

Endpoint: /send
​HTTP method: POST
​URL: https://e1.envoke.com/v1/send

Supply the message object JSON in the POST data:

https://e1.envoke.com/v1/send
{
"name": "test message",
"group": "test",
"sender": "Envoke Test <test@envoke.com>",
"subject": "This is a test message",
"recipients": [ "example@api.com" ],
"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","recipients":["example@api.com"],"html":"<body>This is a <strong>TEST</strong> message.</body>"}' "https://e1.envoke.com/v1/send"

Successful response:

{
"success": true,
"result_text": "Message is sending",
"result_data": {
"id": 123456,
"new_contacts_created": 0,
"summary": {
"total_selected": 1,
"emails_to_be_sent": 1,
"excluded_unsubscribed_contacts": 0,
"excluded_invalid_emails": 0,
"excluded_bounced_emails": 0,
"excluded_unverified_emails": 0
},
"recipients": [
{
"id": 65432,
"email": "example@api.com",
"emails_to_be_sent": true
}
]
}
}

Example error: 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'"
}

Add recipients to a message

Endpoint: /send
​HTTP method: POST
​URL: https://e1.envoke.com/v1/send

Send a message with the id "123456" to additional recipients

https://e1.envoke.com/v1/send
{
"id": 123456,
"recipients": [ "new-recipient1@example.com", "new-recipient2@example.com" ]
}

curl -X POST -u API_ID:API_KEY -d '{"id":123456,"recipients":["new-recipient1@example.com","new-recipient2@example.com"]}' "https://e1.envoke.com/v1/send"

Did this answer your question?