{"id":31578,"date":"2018-04-21T15:47:48","date_gmt":"2018-04-21T15:47:48","guid":{"rendered":"https:\/\/ampscript.guide\/endsmsconversation\/"},"modified":"2021-04-06T00:58:47","modified_gmt":"2021-04-06T00:58:47","slug":"endsmsconversation","status":"publish","type":"post","link":"https:\/\/ampscript.guide\/endsmsconversation\/","title":{"rendered":"EndSmsConversation"},"content":{"rendered":"<h2>EndSmsConversation<\/h2>\n<p>This function will end an active conversation-based on a given short or long code and a Contact&#8217;s mobile number. Once a conversation ends, it will allow the Contact to send other MO messages related to the short or long code, otherwise the Contact will remain in the conversation until it ends, either by reaching a message template without a Next Keyword, or being ejected from the conversation by this function.<\/p>\n<p>The function will return <code>true<\/code> if the conversation successfully ends, or <code>false<\/code> if an exception occurs. 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>EndSmsConversation(1,2)<\/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<\/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<\/h3>\n<p>A conversation is created from a series of SMS messages with Next Keywords, as per the table below.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left\">Message Name<\/th>\n<th style=\"text-align: left\">Message Type<\/th>\n<th style=\"text-align: left\">Keyword<\/th>\n<th style=\"text-align: left\">Next Keyword<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left\">Outbound Offer<\/td>\n<td style=\"text-align: left\">Outbound<\/td>\n<td style=\"text-align: left\"><\/td>\n<td style=\"text-align: left\"><code>RESPONSE1<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Response 1<\/td>\n<td style=\"text-align: left\">Text Response<\/td>\n<td style=\"text-align: left\"><code>RESPONSE1<\/code><\/td>\n<td style=\"text-align: left\"><code>RESPONSE2<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Response 2<\/td>\n<td style=\"text-align: left\">Text Response<\/td>\n<td style=\"text-align: left\"><code>RESPONSE2<\/code><\/td>\n<td style=\"text-align: left\"><code>RESPONSE3<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">Response 3<\/td>\n<td style=\"text-align: left\">Text Response<\/td>\n<td style=\"text-align: left\"><code>RESPONSE3<\/code><\/td>\n<td style=\"text-align: left\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A Contact then responds <code>No<\/code> to the &#8216;Outbound Offer&#8217; message and receives the &#8216;Response 1&#8217; message.<\/p>\n<p>This message contains the following code:<\/p>\n<pre><code>%%[\n\nvar @response\nset @response = [MSG(0).NOUNS]\n\nif IndexOf(@response,\"no\") &gt; 0 then\n\n  EndSMSConversation(61401123456, MOBILE_NUMBER)\n\n]%%\nThank you for participating in this survey.\n%%[ else ]%%\nPlease reply with your first name.\n%%[ endif ]%%<\/code><\/pre>\n<h4>Output<\/h4>\n<p>The reply is interpreted by the &#8216;Response 1&#8217; message and as the response contains the word &#8216;no&#8217; (which is evaluated as case-insensitive by the <a href=\"\/indexof\">IndexOf<\/a> function), the Contact receives the message below and they are ejected from the conversation.<\/p>\n<pre><code>Thank you for participating in this survey.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>EndSmsConversation This function will end an active conversation-based on a given short or long code and a Contact&#8217;s mobile number. Once a conversation ends, it will allow the Contact to send other MO messages related to the short or long code, otherwise the Contact will remain in the conversation until it ends, either by reaching [&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 - EndSmsConversation<\/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\/endsmsconversation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The AMPscript Guide - EndSmsConversation\" \/>\n<meta property=\"og:description\" content=\"EndSmsConversation This function will end an active conversation-based on a given short or long code and a Contact&#8217;s mobile number. Once a conversation ends, it will allow the Contact to send other MO messages related to the short or long code, otherwise the Contact will remain in the conversation until it ends, either by reaching [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ampscript.guide\/endsmsconversation\/\" \/>\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\/endsmsconversation\/#webpage\",\"url\":\"https:\/\/ampscript.guide\/endsmsconversation\/\",\"name\":\"The AMPscript Guide - EndSmsConversation\",\"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\/endsmsconversation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ampscript.guide\/endsmsconversation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ampscript.guide\/endsmsconversation\/#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\/endsmsconversation\/\",\"url\":\"https:\/\/ampscript.guide\/endsmsconversation\/\",\"name\":\"EndSmsConversation\"}}]},{\"@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\/31578"}],"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=31578"}],"version-history":[{"count":0,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31578\/revisions"}],"wp:attachment":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/media?parent=31578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/categories?post=31578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/tags?post=31578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}