Quick links
Inbound message triggered flows
Using merge fields
Pendula supports merge fields within the body of your SMS messages to add personalised contact data.
If you know what a merge field is, skip to using merge fields in flows.
What are merge fields
Merge fields are dynamic fields you can reference in your messages that incorporates data from your record database. With Pendula, merge fields are referenced through surrounding the requested record with two curly braces, {{
}}
(i.e. the “handlebars”).
Why use merge fields?
To create a personalised customer message using the customer’s first name, which you may have stored in your database under FirstName
, you might write:
Hello
{{FirstName}}
, hope you are well!
It would display on Sally’s phone as:
Hello Sally, hope you are well!
...and on Eric’s phone as:
Hello Eric, hope you are well!
Merge fields in flows
The fields available to reference in a node, are based on any fields collected or generated by previous nodes in the flow.
For example, the 'Amazon Kinesis trigger’ node receives data (which includes the fields you want to use in the message body). Then, the ‘Outbound SMS’ node has access to any of these fields.
The fields collected by the Amazon Kinesis trigger node are available to all subsequent nodes.
Using merge fields in flows
To use fields from a previous node you will need to refer to them correctly. To do this:
Start by opening the ‘handlebars’,
{{
Then reference the node by using the node output key in the Advanced tab of a node's settings. In this case, it is:
{{inboundSMSTrigger_1
—
Then add .
, followed by the field you wish to reference, in this case it’s firstName
, so the final merge field should look like:
{{inboundSMSTrigger_1.firstName}}
If a merge field value is blank or non-existent in your data extension, it will simply render blank in the message to the recipient.
Note that the character count in the message body will not accurately reflect the rendered version of the merge fields. For example, {{amazonKinesisTrigger_1.firstName}} can render as Anna (4 characters) or Alexander (9 characters).
Inbound message triggered flows
The following structure is bound to the node output key of an Inbound message triggered flow:
Inbound SMS
{
"matchedIntent": string,
"fromNumber": string,
"timestamp": Number (epoch timestamp)
}
Conversation reply
{
"matchedIntent": string,
"timestamp": Number (epoch timestamp)
}
Any of these fields can be used in a subsequent node where a field expression (Criteria Split) or handlebars template can be used (as above).
As an example, in a handlebars template the fromNumber
field would be {{inboundSms_1.fromNumber}}
(with the default node output key).
Conditional logic
The handlebars merge field system also supports conditional logic. This means you can display certain blocks of information depending on if certain criteria are met.
For example, Eric, who is on a prepaid mobile plan, would receive a different message to Sally, who isn’t.
If-else {{#if}}
If-else statements let you conditionally render blocks based on if-else logic arguments; if this, then do this. If an {{#if}}
block argument returns a false
, undefined
, null
, “”
, 0
or {}
, handlebars will not render the block inside.
Hey,{{firstName}} {{lastName}}, we hope you've been enjoying your
{{#if prepaid}}
prepaid mobile plan and other
{{/if}}
Amaysim services.
You can also use {{else}}
inside of {{#if}}
statements to determine what block will render if the initial{{#if}}
block returns a false value.
Hi {{firstName}},
{{#if prepaid}}we hope you’ve been enjoying your prepaid mobile plan.
{{else}}
we hope you’ve been enjoying using amaysim services.
{{/if}}
We would love to hear your feedback! Would you like to take our survey? Reply YES to take part, and STOP to opt out.
The example above would render differently if you were on a prepaid mobile plan or not.
Unless {{#unless}}
You can use the unless
helper as the opposite of the if
helper. Its block will be rendered if the expression returns a false
, undefined
, null
, “”
, 0
or {}
.