menu_open Messages API
The messages API is the go-to interface for sending transactional emails from your SaaS application or mobile application’s backend service. Transactional emails, like all email types, make use of SendStreak’s template functionality. When sending a transactional email, you must select an existing template from SendStreak and pass any necessary variables through the API to populate the template.
Currently, there is no API endpoint for creating templates, but you can easily create them using the template editor on the SendStreak dashboard.
Example email
{
"rcpt": "someone@example.com",
"templateSlug": "sign-up-thank-you",
"variables": {
"firstName": "John",
"lastName": "Doe",
"plan": "Professional"
}
}
Send an email
The POST method is used to send an email. With SendStreak, transactional emails are sent immediately without queuing for later delivery, unlike automated and campaign emails.
Endpoint
POST https://api.sendstreak.com/v1/messages
Body
Field | Description | Required |
---|---|---|
rcpt |
The recipient’s email address. | yes |
templateSlug |
The slug (short identifier) of the template. To find this value, go to the edit template screen on the SendStreak dashboard. | yes |
variables |
This is an object with key-value pairs that SendStreak uses to fill in the template, if the template supports them. | no |
Curl example
curl --location 'https://api.sendstreak.com/v1/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"rcpt": "someone@example.com",
"templateSlug": "sign-up-thank-you",
"variables": {
"firstName": "John",
"lastName": "Doe",
"plan": "Professional"
}
}'