After you have created some templates, using them in emails is very simple and can be done either from the Trustifi web portal or using Trustifi’s API.
Using the Web Portal
Open the “New Secure Email” page, enter the email’s recipients, and click on the “Email template” button at the bottom of the text editor window (see figure 5).
Figure 5: finding the “Email template” button.
After you click the “Email template” button, you will have 2 options to select, (1) “Load Template”, or (2) “Save as Template” (see figure 6). Select the “Load Template” option
Figure 6: Select option.
After you have clicked on the “Load Template” button, a pop-up window will appear where you can select which template you want to use.
Once a template is selected, simply click on “Confirm” and the template will be loaded into the text editor (see figure 7).
Figure 7: loading a template
Using the API
Using the API to send an email with a template is very similar to the process of sending a “regular” email – all that needs to be added to the API request is the “template” object which includes the template name and any custom dynamic fields (if there are any).
The documentation for sending an API email with a template can be found here –https://api.trustifi.com/#65118bcc-cf29-4b36-bb8a-b86f7232cb5d
See the example below (this example is using Curl, but many other languages are supported):
curl --location --request POST 'https://be.trustifi.com/api/i/v1/email' \
--header 'x-trustifi-key: {{trustifi_key}}' \
--header 'x-trustifi-secret: {{trustifi_secret}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"template": {
"name": "my_template",
"fields": {
"first_field": "hello",
"second_field": "world"
}
},
"recipients": [{
"email": "test@gmail.com",
"name": "test",
"phone": {
"country_code": "+1",
"phone_number": "1111111111"
}
}],
"lists": [],
"contacts": [],
"methods": {
"postmark": false,
"secureSend": false,
"encryptContent": false,
"secureReply": false
}
}'