- 07 Aug 2023
- 3 Minutes to read
Create Email Campaigns
- Updated on 07 Aug 2023
- 3 Minutes to read
Overview
Content API enables you to send email body and subject from your back-end to create email campaigns on Insider platform. With this API request, you can specify the account name, campaign name and campaign type.
You can use the Content API to:
- Send your already created email HTML body and other input parameters to Inone panel to not lose time by adding it again
- Send the values of the input parameters to the panel directly if you have multiple accounts in Inone and have the same/similar value for these parameters
Endpoint and Headers
Headers
Header | Sample Value | Description |
---|---|---|
X-INS-AUTH-KEY | 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Body Parameters
Before sending your request, make sure you create it within the following criteria:
- All body parameters should be lowercase. Otherwise, they will not be validated and you will receive a validation error.
- If the campaign type is Experiment, you should have 2 variations. Otherwise, your request will not be validated and you will receive a validation error.
- If the campaign type is Single, you should have 1 variation. Otherwise, your request will not be validated and you will receive a validation error.
- The subject is required with a maximum of 200 characters.
- The pre-header is optional with a maximum of 150 characters.
- Source, medium, and campaign parameters are required for UTM parameters.
- UTM keys can only be alphanumeric with _.
- UTM values can have a maximum of 40 characters.
- UTM values can only be alphanumeric with _-.
- The campaign you create will automatically be tagged with the email-content-api tag.
- The campaign creation on Insider platform is real-time after you send the request.
- The default status of the campaign you create is set to Draft. You can schedule your campaigns on the panel.
- Email content is not saved as a template.
Parameter | Description | Data Type | Required |
---|---|---|---|
name | Name of the campaign that you want to create on Insider platform. It should be alphanumeric with -_{space}, max. 40 and min. 5 characters. | String | Yes |
tags | Tag of the campaign that you want to create on Insider platform. It should be alphanumeric with -_{space}, max. 5 tags, max. 15 character-long each. | Array of strings | No |
type | Type of the campaign that you want to create on Insider platform (single, experiment, recurring) | String | Yes |
variations | Array that contains email subject, preheader, email HTML, and UTM parameters. | Array of object | Yes |
subject | The subject of your email campaign up to 200 characters. | String | Yes |
pre_header | The summary of your email message up to 150 characters. | String | No |
html | The HTML of your email campaign in base64 format. | String | Yes |
utm | The source, campaign, medium, and extra UTM parameters of your email campaign. The value for each can have 40 characters max. | Object | No |
Sample Example
Sample Request
Every request made to the request endpoint requires a request body formatted in JSON and containing your email's content as variations.
The following is a sample request for a Single email campaign.
curl --location --request POST 'http://mail.useinsider.com/content/v1/campaign/create' \
--header 'x-ins-auth-key: INS.pwT63PN4xlp378IfeB_.-rLHwDclZprp+SvpmzWkK-EgEBhdkL33blf7pzAxjt' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "my single campaign",
"tags": [
"v",
"tag1 789dfs44"
],
"type": "single",
"variations": [
{
"subject": "Hello {{name}} {{email}} {{custom3|fallback}}",
"pre_header": "apre {{surname|there}}",
"html": "PHRkIGNsYXNzPSJlc2Qtc3RydWN0dXJlIGVzLXAyMCIgYWxpZ249ImxlZnQiIGJnY29sb3I9IiM5MTk0OUYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiAjOTE5NDlGOyI+DQogICAgPHRhYmxlIHdpZHRoPSIxMDAlIiBjZWxsc3BhY2luZz0iMCIgY2VsbHBhZGRpbmc9IjAiPg0KICAgICAgICA8dGJvZHk+DQogICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgPHRkIGNsYXNzPSJlc2QtY29udGFpbmVyLWZyYW1lIiB3aWR0aD0iNTYwIiB2YWxpZ249InRvcCIgYWxpZ249ImNlbnRlciI+DQogICAgICAgICAgICAgICAgICAgIDx0YWJsZSB3aWR0aD0iMTAwJSIgY2VsbHNwYWNpbmc9IjAiIGNlbGxwYWRkaW5nPSIwIj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDx0Ym9keT4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0ZCBhbGlnbj0iY2VudGVyIiBjbGFzcz0iZXNkLWJsb2NrLWltYWdlIGVzLXAxNSIgc3R5bGU9ImZvbnQtc2l6ZTogMHB4OyI+PGEgdGFyZ2V0PSJfYmxhbmsiPjxpbWcgY2xhc3M9ImFkYXB0LWltZyIgc3JjPSJodHRwczovL2ltYWdlLnVzZWluc2lkZXIuY29tL2VtYWlsLXRlbXBsYXRlL2xvZ28ucG5nIiBhbHQgc3R5bGU9ImRpc3BsYXk6IGJsb2NrOyIgaGVpZ2h0PSIzMCI+PC9hPjwvdGQ+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPC90cj4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dHI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0ZCBjbGFzcz0iZXNkLWJsb2NrLXRleHQiIGFsaWduPSJjZW50ZXIiPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGgyIHN0eWxlPSJjb2xvcjogI0ZGRkZGRjsgZm9udC1zaXplOiAzMHB4OyI+PHN0cm9uZz5UaW1lIGZvciBncmVhdCBlbWFpbCBkZXNpZ248L3N0cm9uZz48L2gyPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3RkPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdHI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRyPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGQgY2xhc3M9ImVzZC1ibG9jay10ZXh0IGVzLW0tdHh0LWMgZXMtcDEwdCIgYWxpZ249ImNlbnRlciI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cCBzdHlsZT0iY29sb3I6ICNGRkZGRkY7Ij5UaGlzIGlzIGEgbmV3IHRleHQgYmxvY2sgcmVhZHkgZm9yIHlvdXIgbWVzc2FnZSBjb250ZW50LjwvcD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC90ZD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3RyPg0KICAgICAgICAgICAgICAgICAgICAgICAgPC90Ym9keT4NCiAgICAgICAgICAgICAgICAgICAgPC90YWJsZT4NCiAgICAgICAgICAgICAgICA8L3RkPg0KICAgICAgICAgICAgPC90cj4NCiAgICAgICAgPC90Ym9keT4NCiAgICA8L3RhYmxlPg0KPC90ZD4=",
"utm": {
"source": "thisis_source",
"campaign": "thisis_campaign",
"medium": "thisis_medium",
"extra": "thisis_extra"
}
}
]
}'
The following is a sample request for an Experiment (A/B) campaign.
curl --location --request POST 'mail.useinsider.com/content/v1/campaign/create' \
--header 'x-ins-auth-key: INS.jQIja9pXwuNC2Pkoy....vgjiHHoMgBkkYtDsrb6Gz9K0nAIi4NMLkkWClfU' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Campaign Name",
"tags": ["campaign-tag"],
"type": "experiment",
"variations": [
{
"subject": "Variation A subject {{custom}}",
"html": "PHA+TXkgZW1haWwgYm9keSBBPC9wPg==",
"pre_header": "Variation A preheader"
},
{
"subject": "Variation B subject {{custom}}",
"html": "PHA+TXkgZW1haWwgYm9keSBBPC9wPg==",
"pre_header": "Variation B preheader",
"utm": {
"source": "my_source",
"campaign": "my_campaign",
"medium": "email",
"extra": "value"
}
}
]
}
The subject and pre_header will be placed in the following sections in your inbox:
The subject and html will look like as follows:
The utm parameters will be added to the URL(s) as follows:
Sample Responses
Created Success Message 201
{
"message":"created",
"id":"builderID"
}
Validation Error Message 400
{
"error":"$message"
}
Unauthorized Error Message 401
{
"error":"unathorized"
}
Limitations
- All functions must be executed with a simple HTTPS POST request.
- Only new email campaigns can be created via this API. No data can be retrieved.
- The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.
- The rate limit is 1 request per second. Each request might take approximately 1 second.