Comment on page
Connecting to API
Send messages on Enveloop by connecting directly via HTTPS
You can send messages directly over HTTPS by sending a request to any of the Api Endpoints:
(ex: POST
https://api.enveloop.com/messages
)You will need to pass your Api Token as an Authorization header prefixed with
token
.
Authorization: token <API Token>
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: token test_eYLQRrzxLcLAlmb2H5BXIFSUor3h/tRr" \
-d '{
"template": "user-welcome",
"to": "[email protected]",
"from": "Northwind App <[email protected]>",
"subject": "Welcome to Northwind",
"templateVariables": {
"name": "Bob Vance"
}
}' \
"https://api.enveloop.com/messages"
The above cURL example uses a Sandbox token. Sandbox tokens, used with cURL commands in Enveloop, are an easy way to test your message structure and style. You can view Sandbox messages in the Message Log area of the project.
data = {
to: "[email protected]",
from: "Northwind App <[email protected]>",
subject: "Welcome to Northwind",
template: "user-welcome",
templateVariables: {
name: "Bob Vance"
}
}
fetch("https://api.enveloop.com/messages", {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json",
"Authorization": "token test_eYLQRrzxLcLAlmb2H5BXIFSUor3h/tRr",
},
})
.then(response => response.json())
.then(json => console.log(json))
.catch(err => console.log(err))
Last modified 11mo ago