Dynamic Content Emails via The API

Introduction

The Conversation::sendEmail method in the Net-Results API may be used to send emails that merge arbitrary content, including HTML, directly into any Email that exists in your Net-Results account.


This allows the layout and look of the email to be controlled within the Net-Results platform by members of your marketing team, while the triggering of the email, and the dynamic content therein, is controlled by your I.T. team and the systems they manage.


Example use cases include welcome emails, transaction & shipping confirmations, and shopping cart abandonment.

How To

To take advantage of this capability, you’ll need to use special merge tags in your email template, and pass corresponding data in your API call.
For example, to dynamically insert a username and password into your email, you would place the following merge tags at the location in your email where you’d like the username and password to appear:

{MERGE_DATA:USERNAME|unknown}
{MERGE_DATA:PASSWORD|unknown}

This is very similar to using Personalized Field merge tags like first name, which look like this:

{FIRST NAME|Valued Customer}

In the case of the First Name field, Net-Results will inject the Contact’s First Name, as stored in Net-Results, wherever this tag is found in your email. If the prospect’s first name is blank, Net-Results will inject the default value, Valued Customer which comes after the pipe, the vertical line character that separates the field name from its default value.


In the case of our username and password, Net-Results will merge in the values passed in the API call, and inject the default value unknown if you were to pass a null value for either username or password.


The important capability offered by this technique is the ability to merge values into your email that are not necessarily stored in Net-Results at all.

An Example

Below is a screenshot of part of a Net-Results email that contains merge tags for both username and password:

Sample Email Content

dynamic-email-content-example


To inject the correct values in place of these merge tags, you will need to pass a JSON object formatted per the example below to the Conversation:: sendEmail method.
 

Sample JSON

{
	"id": "5a9ec21d29487",
	"method": "sendEmail",
	"jsonrpc": "2.0",
	"params": {
		"email_id": 12345,
		"contact_id": 123456789,
		"options": {
			"override": {
				"merge_data": {
					"username": "user@domain.com",
					"password": "123456"
				}
			}
		}
	}
};

 
This method relies on the use of the options property in the params object that you pass in JSON format when calling the method.


The override property allows you to pass values that potentially override any stored in Net-Results. Values passed in this JSON object are not stored on the corresponding Contact in Net-Results. They are simply merged into your email template before sending.


Questions? Please call or email your Customer Success Team!

Updated on March 11, 2024

Was this article helpful?

Related Articles