{"id":31576,"date":"2018-04-21T15:47:48","date_gmt":"2018-04-21T15:47:48","guid":{"rendered":"https:\/\/ampscript.guide\/createsmsconversation\/"},"modified":"2021-04-06T00:58:47","modified_gmt":"2021-04-06T00:58:47","slug":"createsmsconversation","status":"publish","type":"post","link":"https:\/\/ampscript.guide\/createsmsconversation\/","title":{"rendered":"CreateSmsConversation"},"content":{"rendered":"<h2>CreateSmsConversation<\/h2>\n<p>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.<\/p>\n<p>The function will return <code>true<\/code> if an conversation was successfully created, or <code>false<\/code> if an exception occurred. The function can only be used in MobileConnect messages and will return <code>false<\/code> if used in a different application context, for example in Email Studio or CloudPages.<\/p>\n<h3>Arguments<\/h3>\n<p><code>CreateSmsConversation(1,2,3,4)<\/code><\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center\">Ordinal<\/th>\n<th style=\"text-align: left\">Type<\/th>\n<th style=\"text-align: left\">Required<\/th>\n<th style=\"text-align: left\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center\">1<\/td>\n<td style=\"text-align: left\">Number<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">Short code or long code used by MobileConnect<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">2<\/td>\n<td style=\"text-align: left\">Number<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">Contact&#8217;s mobile number with country code prefix<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">3<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">Keyword to use for Next Keyword function<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">4<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">Application used for the conversation use <code>MOBILECONNECT<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>NOTE: This function cannot be used in conversation-based templates such as Double Opt-In, Vote\/Survey or Info Capture messages.<\/p>\n<\/blockquote>\n<h3>Example 1<\/h3>\n<p>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 &#8216;Offer&#8217; field is equal to <code>competition<\/code> then a conversation will be created for the Contact with <code>COMPETITION<\/code> as the Next Keyword.<\/p>\n<pre><code>%%[\n\nvar @offer\nset @offer = Lookup(\"SMS Offers\", \"Offer\", \"Mobile Number\", MOBILE_NUMBER)\n\nif @offer == \"competition\" then\n\n  CreateSMSConversation(61401123456, MOBILE_NUMBER, \"COMPETITION\", \"MOBILECONNECT\")\n\n]%%\nYou have been selected to enter a draw for a $100 voucher. Reply with your email address to register.\n%%[ else ]%%\n10% discount at all NTO stores, 5 days only!\n%%[ endif ]%%<\/code><\/pre>\n<p>A text response message is also created in MobileConnect with the <code>COMPETITION<\/code> keyword. The message template contains the following code:<\/p>\n<pre><code>%%[\n\nInsertData(\"Competition Responses\", \"Mobile Number\", MOBILE_NUMBER, \"Email Address\", [MSG(0).NOUNS])\n\n]%%\nThank you for providing your email address. You have been registered for the competition.<\/code><\/pre>\n<h4>Output<\/h4>\n<p>If the Lookup function used by the <code>@offer<\/code> variable returns <code>competition<\/code>, then the Contact will receive the following SMS message:<\/p>\n<pre><code>You have been selected to enter a draw for a $100 voucher. Reply with your email address to register.<\/code><\/pre>\n<p>If the Contact replies to the SMS message with <code>sam@limedash.com<\/code>, their mobile number and email address (from the response message) will be inserted into a &#8216;Competition Responses&#8217; Data Extension and they will receive the following response:<\/p>\n<pre><code>Thank you for providing your email address. You have been registered for the competition.<\/code><\/pre>\n<h3>Example 2<\/h3>\n<div class=\"rcp_restricted rcp_paid_only\"><div>\n\n\n\t\n\t<form id=\"rcp_login_form\"  class=\"rcp_form\" method=\"POST\" action=\"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31576\/\">\n\n\t\t\n\t\t<fieldset class=\"rcp_login_data\">\n\t\t\t<p>\n\t\t\t\t<label for=\"rcp_user_login\">Username or Email<\/label>\n\t\t\t\t<input name=\"rcp_user_login\" id=\"rcp_user_login\" class=\"required\" type=\"text\"\/>\n\t\t\t<\/p>\n\t\t\t<p>\n\t\t\t\t<label for=\"rcp_user_pass\">Password<\/label>\n\t\t\t\t<input name=\"rcp_user_pass\" id=\"rcp_user_pass\" class=\"required\" type=\"password\"\/>\n\t\t\t<\/p>\n\t\t\t\t\t\t<p>\n\t\t\t\t<input type=\"checkbox\" name=\"rcp_user_remember\" id=\"rcp_user_remember\" value=\"1\"\/>\n\t\t\t\t<label for=\"rcp_user_remember\">Remember me<\/label>\n\t\t\t<\/p>\n\t\t\t<p class=\"rcp_lost_password\"><a href=\"\/wp-json\/wp\/v2\/posts\/31576?rcp_action=lostpassword\">Lost your password?<\/a><\/p>\n\t\t\t<p>\n\t\t\t\t<input type=\"hidden\" name=\"rcp_action\" value=\"login\"\/>\n\t\t\t\t<input type=\"hidden\" name=\"rcp_redirect\" value=\"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31576\/\"\/>\n\t\t\t\t<input type=\"hidden\" name=\"rcp_login_nonce\" value=\"213020500f\"\/>\n\t\t\t\t<input id=\"rcp_login_submit\" class=\"rcp-button\" type=\"submit\" value=\"Login\"\/>\n\t\t\t<\/p>\n\t\t\t\t\t<\/fieldset>\n\n\t\t\n\t<\/form>\n<br \/>\nNot a subscriber? <a href=\"\/subscriptions\/subscribe\/\">Subscribe now<\/a>.\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v14.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The AMPscript Guide - CreateSmsConversation<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ampscript.guide\/createsmsconversation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The AMPscript Guide - CreateSmsConversation\" \/>\n<meta property=\"og:description\" content=\"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, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ampscript.guide\/createsmsconversation\/\" \/>\n<meta property=\"og:site_name\" content=\"The AMPscript Guide\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-21T15:47:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-06T00:58:47+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ampscript.guide\/#website\",\"url\":\"https:\/\/ampscript.guide\/\",\"name\":\"The AMPscript Guide\",\"description\":\"The Definitive Scripting Manual for Salesforce Marketing Cloud\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ampscript.guide\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/createsmsconversation\/#webpage\",\"url\":\"https:\/\/ampscript.guide\/createsmsconversation\/\",\"name\":\"The AMPscript Guide - CreateSmsConversation\",\"isPartOf\":{\"@id\":\"https:\/\/ampscript.guide\/#website\"},\"datePublished\":\"2018-04-21T15:47:48+00:00\",\"dateModified\":\"2021-04-06T00:58:47+00:00\",\"author\":{\"@id\":\"https:\/\/ampscript.guide\/#\/schema\/person\/5335042f77731e84f9808aecef25daec\"},\"breadcrumb\":{\"@id\":\"https:\/\/ampscript.guide\/createsmsconversation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ampscript.guide\/createsmsconversation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ampscript.guide\/createsmsconversation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/\",\"url\":\"https:\/\/ampscript.guide\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/createsmsconversation\/\",\"url\":\"https:\/\/ampscript.guide\/createsmsconversation\/\",\"name\":\"CreateSmsConversation\"}}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/ampscript.guide\/#\/schema\/person\/5335042f77731e84f9808aecef25daec\",\"name\":\"dev\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31576"}],"collection":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/comments?post=31576"}],"version-history":[{"count":0,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31576\/revisions"}],"wp:attachment":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/media?parent=31576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/categories?post=31576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/tags?post=31576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}