To send emails through Quentn you have to follow these steps:
- Create email (optional with placeholders) and receive an email_id
- Make sure you have at least one contact as recipient (use Contact API to create or retrieve an existing contact)
- Get a sender_id (optional)
- Send email
Create Email
Placeholders
You are free to use any existing placeholders offered by the Quentn software (usually starting with [contact:...]). To get a full list of all placeholders, look up the email editor in your Quentn-Software.
Furthermore Mail-API allowes you to define your own placeholders for the subject and body field. When sending email through the API, you can define corresponding substitution data for each recipient. Placeholders can contain any UTF-8 character e.g. %name% or [first_name].
Request parameters
Name | Type | Required | Description |
---|---|---|---|
subject | String(255) | yes | Email subject |
body_html | String | yes | Email Html |
body_text | String | no | Raw text version of the email. If not defined, a text version will be created automatically from the given body_html. |
context | String(32) | yes | Context of the email. E.g. 'Opt-In' or 'Webinar Reminder' |
sender_id | Int | no | The default sender to use for this email |
Request:
POST https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/add HTTP/1.1
{
"subject" : "Welcome to my Newsletter",
"body_html" : "<html><body><h1>Hello @name@, welcome to my Newsletter</h1>...",
"body_text" : "Hello @name@, welcome to my Newsletter",
"context" : "opt_in_mail"
}
Response:
{
"id" : 1
{
Retrieve Email
After creating an email, you could make sure that everything was done as intended. To do so get the email by its id which you received during creation.
Request:
GET https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/<email_id> HTTP/1.1
Response:
{
"id" : 1,
"sender_id" : 1,
"subject" : "Welcome to my Newsletter",
"body_html" : "<html><body><h1>Hello @name@, welcome to my Newsletter</h1>...",
"body_text" : "Hello @name@, welcome to my Newsletter",
"context" : "opt_in_mail"
}
Request parameters
Update Email
Request Parameters:
Name | Type | Required | Description |
---|---|---|---|
subject | String(255) | no | Email subject |
body_html | String | no | Email Html |
body_text | String | no | Raw text version of the email. If not defined, a text version will be created automatically from the given body_html. |
context | String(32) | no | Context of the email. E.g. 'Opt-In' or 'Webinar Reminder' |
sender_id | Int | no | The default sender to use for this email |
Request:
PUT https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/<email_id> HTTP/1.1
{
"sender_id" : 1,
"subject" : "Welcome to my Newsletter",
"body_html" : "<html><body><h1>Hello @name@, welcome to my Newsletter</h1>...",
"body_text" : "Hello @name@, welcome to my Newsletter",
"context" : "opt_in_mail"
}
Response:
{
"success": "true",
}
Delete Email
Request:
DELETE https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/<email_id> HTTP/1.1
Response:
{
"success": "true",
}
Get sender IDs
Retrieve a list of available senders. Please note that you will only receive confirmed senders.
Response parameters
Name | Type | Always included | Description |
---|---|---|---|
id | int | yes | Sender ID |
String | yes | Sender email address | |
first_name | String | no | First name |
last_name | String | no | Last name |
company | Int | no | Company |
Request:
GET https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/senders HTTP/1.1
Response:
[
{
"id" : 1,
"email" : "johndoe@example.de",
"first_name" : "John",
"last_name" : "Doe",
"company" : "John Doe's Bikeshop Ltd."
},
{
"id" : 2,
"email" : "bikeshop@example.com"
}
]
Send Email
To send an email, you have to provide an email ID and a list of recipients. This list contains a contact ID and, optionally, substition data for email placeholders.
Please Note: Each request has a limit of 1.000 recipients.
Request values:
Name | Type | Required | Description |
---|---|---|---|
email_id | int | yes | Email ID |
recipients | array | yes | List of recipients containing the recipient id and an optional list of field substitutions (see example below) |
sender_id | int | no | Sender id |
Request:
POST https://<system_id>.<server_id>.quentn.com/public/api/V1/mail/<email_id>/send HTTP/1.1
Request data:
{
'email_id' : 123,
'recipients' : [
{
'id' : 1,
'substitution_data' : {
"@name@" : "John",
....
}
},
.....
]
}
Response:
{
"success": "true",
}