CreateSmsConversation

While MobileConnect includes the ability to create conversations through assigning Next Keywords to message templates, this function provides the ability to conditionally create a conversation and can dynamically define the Next Keyword to use, instead of a defined value in the message template.

The function will return true if an conversation was successfully created, or false if an exception occurred. The function can only be used in MobileConnect messages and will return false if used in a different application context, for example in Email Studio or CloudPages.

Arguments

CreateSmsConversation(1,2,3,4)

Ordinal Type Required Description
1 Number True Short code or long code used by MobileConnect
2 Number True Contact’s mobile number with country code prefix
3 String True Keyword to use for Next Keyword function
4 String True Application used for the conversation use MOBILECONNECT

NOTE: This function cannot be used in conversation-based templates such as Double Opt-In, Vote/Survey or Info Capture messages.

Example 1

An outbound message is sent to a Contact. A Lookup function returns an applicable offer for the Contact from a Data Extension based on their mobile number. If an ‘Offer’ field is equal to competition then a conversation will be created for the Contact with COMPETITION as the Next Keyword.

%%[

var @offer
set @offer = Lookup("SMS Offers", "Offer", "Mobile Number", MOBILE_NUMBER)

if @offer == "competition" then

  CreateSMSConversation(61401123456, MOBILE_NUMBER, "COMPETITION", "MOBILECONNECT")

]%%
You have been selected to enter a draw for a $100 voucher. Reply with your email address to register.
%%[ else ]%%
10% discount at all NTO stores, 5 days only!
%%[ endif ]%%

A text response message is also created in MobileConnect with the COMPETITION keyword. The message template contains the following code:

%%[

InsertData("Competition Responses", "Mobile Number", MOBILE_NUMBER, "Email Address", [MSG(0).NOUNS])

]%%
Thank you for providing your email address. You have been registered for the competition.

Output

If the Lookup function used by the @offer variable returns competition, then the Contact will receive the following SMS message:

You have been selected to enter a draw for a $100 voucher. Reply with your email address to register.

If the Contact replies to the SMS message with sam@limedash.com, their mobile number and email address (from the response message) will be inserted into a ‘Competition Responses’ Data Extension and they will receive the following response:

Thank you for providing your email address. You have been registered for the competition.

Example 2


Not a subscriber? Subscribe now.