Bluecore Transactional API
Welcome to the Bluecore Transactional API
Use this resource to integrate with Bluecore’s Transactional API to begin sending transactional and real-time welcome emails with Bluecore.
Bluecore recommends that a member of your IT team complete this setup, as it requires a highly technical skillset. This document covers the following areas:
- Authorization: This section describes how to authenticate with the Transactional API.
- Send Email: This section describes how to trigger transactional or real-time welcome emails for both tests and live sends.
- Get Status: This section describes how to view the status of a previously-triggered transactional or real-time welcome email campaign. If a transactional or real-time welcome email is not received when testing, this API call can be used to troubleshoot.
NOTE: You will need the previously provided API key to complete this setup. If you do not have an API key, please reach out to our Product Support team at support@bluecore.com.
NOTE: The transactional API is intended for server-to-server communication only. Calling the transactional API from a browser can expose your API token publicly. If you’ve attempted this already, you should immediately reach out to Bluecore support to cycle your API token.
The transactional API is protected by a customer-specific API key, which is provided by Bluecore. Please provide this API key with each request in the HTTP Authorization header, type Bearer.
Example request header:
Authorization: Bearer {Bluecore API Key}
Send a Transactional or Real-Time Welcome Email
This section details how to send a transactional or real-time welcome email through Bluecore.
Returns: Object containing the conversation ID used to track the message. (See Responses > 202 below).
path Parameters
namespace required | string The partner namespace in Bluecore. |
header Parameters
Authorization Bearer required | string The authorization token in the header. |
Request Body schema: application/json
campaign_id required | string The Bluecore campaign identifier. This identifier can be obtained from the Bluecore UI campaigns page. |
email required | string The recipient’s email address. |
required | object A JSON formatted object containing data to be used in the Email template. |
object A JSON formatted object containing data to add to or update for the customer record. | |
use_draft | boolean A flag indicating if the draft version of a campaign should be used. Default: False. |
Responses
Request samples
- Payload
{- "campaign_id": "34545238545",
- "email": "test@bluecore.com",
- "template_attributes": {
- "template_variable_1": "Some text here",
- "template_variable_2": 1234,
- "html_variable": "<p>html here</p>"
}, - "customer_attributes": {
- "customer_attribute_1": "Some text here",
- "customer_attribute_2": 1234
}, - "use_draft": false
}
Response samples
- 200
{- "conversation_id": "3123245238545"
}
Get the Status of an Email Delivery Attempt
This section details how to get the status of an email delivery attempt.
Returns: Object containing the status and details of the message. (See Responses > 202 below).
path Parameters
namespace required | string The partner namespace in Bluecore. |
conversation_id required | string The conversation ID. |
header Parameters
Authorization Bearer required | string The authorization token in the header. |
Responses
Response samples
- 202
{- "status": "Being Processed",
- "message": "string"
}
Every request made requires a request body formatted in JSON containing your email’s contents and metadata.
{
"campaign_id": string,
"email": string,
"template_attributes": {
(key: value)+
},
"customer_attributes": {
(key: value)+
},
}
Template attributes are used to include data in the API payloads to display in the email template.
The values in template_attributes
can be referenced in the email template by the corresponding key name.
Using the example payload below, the Product 1 item_desc
would be displayed with the email template code {{ordered_products.0.item_desc}}
.
{
"campaign_id": "34545238545",
"email": "test@bluecore.com"
"template_attributes": {
"ordered_products": [
{
"item": "Product 1",
"item_desc": "Description"
},
{
"item": "Product 2",
"item_desc": null
}
]
}
}
NOTE: The request body must include template_attributes
as an empty object even if there are no variables in the email template. Any references to key names in the email template must be included in the API payload template_attributes
object. If a variable in the email template is meant to be populated in some cases but not others, the variable name for that property must still be present in the template_attributes
. The value can be set to null
.
Template attributes can also include full HTML content to render in emails.
{
"campaign_id": "34545238545",
"email": "test@bluecore.com"
"template_attributes": {
"html_content": "<h2>hello test!</h2>"
}
}
NOTE: When passing full HTML content in the JSON for the template attributes, Bluecore recommends the following:
- JSON must be one line.
- Strings must be delimited with
"
. Never with'
. '
must never be escaped.- Quotations (
"
), newlines, tabs must be escaped with only one backslash.
The customer_attributes
object is used for the purpose of updating customer information in Bluecore. Only real-time welcome campaigns will result in updates to customer attributes.
Email Type | Customer | Notes |
---|---|---|
Welcome | New | Customer attributes are acceptable in the payload and can be updated. Additionally, the new customer will end up in the customer entity in Bluecore. |
Welcome | Existing | If Should Suppress Duplicate Welcome Emails (Bluecore Adaptor Integration Settings) is enabled, additional customer_attributes updates will be rejected by the API. If Should Suppress Duplicate Welcome Emails is disabled, customer attributes are acceptable in the payload and will be updated. |
Transactional | New | Customer attributes will be rejected by the API. |
Transactional | Existing | Customer attributes will be rejected by the API. |
NOTE: Some attributes are protected and cannot be passed as customer attributes:
- created
- merged
- orphaned
- aliases
Whenever you make a request to the send endpoint, your JSON payload is validated before your email is sent. If there are any errors, Bluecore will attempt to identify and return as many issues as possible for each request. The validation additionally checks that the API payload does include all the attributes called out in the template.
Code | Message | Description |
---|---|---|
401 | Not authenticated or authorized. | API token is invalid. |
404 | Could not find campaign with id: provided-campaign-id for provided-namespace. | Returned if campaign_id is not an existing campaign. |
406 | Requested media type is not supported. | Only application/json requests are supported. |
422 | The request is missing the attribute email in the body. | If any required field is missing in the request. Required fields are: campaign_id , email , and template_attributes . |
422 | The request is missing the attribute ‘____’ in the body. | If template_attributes does not contain a key name that matches a variable that is expected in the email template. |
422 | Template attribute size exceeds the maximum allowed (819,200 bytes). | Payload was too large. |
500 | Unhandled exception. | Generic something went wrong error. |
500 | Function execution timed out. | Cloud function timed out. |
- The total size of your payload must be less than 900 KB.
- Transactional API calls cannot exceed 200 calls/sec.
- Transactional or real-time welcome sends will only be sent via Bluecore. Other ESP adapters will not be supported.
- We do not currently support the following when sending transactional or real-time welcome emails:
- Bluecore powered product recommendation blocks. Use dynamic content by providing it directly into the API payload.
- Bluecore powered coupon blocks. Use dynamic content by providing it directly into the API payload.
- Only ASCII character email addresses are supported.