Customize transactional email templates

This API provides functionality to send templates created in SendinBlue through SendinBlue SMTP (as transactional emails). This API supports only the POST method. The following fields may be sent while making API calls.

Parameter Required Requirement

 Description 

User Yes Username

Your SendinBlue username can be found in your SendinBlue account on the My Account "SMTP & API" page on the SMTP tab.

Key Yes API key

Your API key(s) can be found in your SendinBlue account on the My Account "SMTP & API" page

Templateid Yes Please provide a valid campaign ID whose type is template

Should be the ID of the campaign whose type is ‘template’

To Yes At least one recipient

Should contain one or more than one (‘|’ separated) recipients. Must be a valid email address

Cc No Recipient to receive copy

If provided then must be a valid email address

Bcc No Recipient to receive copy

If provided then must be valid email address

Attr_1….n No Attributes should be provided in JSON format.  For example: {"attr1":"value","attr2":"value"}

In the template, this attribute must be provided inside ‘%%’ in capital letters without spaces (non-accented characters are recommended). If the value of this attribute is provided in the request then in the email it will be replaced with the value in the result. If no such attribute is found then no replacement will be done. Additionally, if in the template, for ex: %PASS% is found and the value of PASS is not provided in the request, then no replacement will be done. You can also have attribute variables in the subject - they will also be replaced while sending the email.

Example:

Contact attributes can be managed using two different methods:

  • Method 1: by using, for example, a fixed value such as surname and first name, which are saved in your SendinBlue contact list database.
  • Method 2: by using, for example, a dynamic variable such as an order amount or invoice number, which will be generated during a transaction and sent via the API.

If the attribute has a fixed value, it is in SendinBlue's database, and you want to customize your templates with this type of contact attribute, then the attribute name needs to be placed in curly brackets {}.

Example: Hello {FIRSTNAME}

You can find more information about this in the following tutorial.

You can go a step further by using conditions.

On the other hand, if the attribute has a dynamic value and this is sent by the API, the attribute name needs to be placed between %%.

Example: Order amount: %ORDER_AMOUNT%

You can use both types of attributes in the same template to personalize your email like this:

ATTRIBUTES_EN_1  

If the template contains “Hello %LNAME% %FNAME%, This is the email sent through SendinBlue SMTP as a test. Regards,"

Real content that will appear in your mailbox (youremail@email.com) will look like this: “Hello Smith John, This is the email sent through SendinBlue SMTP as a test. Regards,  

Note: If you want to demonstrate the personalization fields in your email to a colleague, place a “\” before “{“ to ensure your personalization field label is visible in your test email. For example, if you want to show the {NAME} personalization field label, include the text \{NAME} in your test email.