|
|
Documentation Wiki > ExactTarget > Interactions > Mobile Messages > Mobile Messages Scenario and Solution Guides > SMS Zip-Code-To-Subscriber Scenario Guide
SMS Zip-Code-To-Subscriber Scenario GuideFrom $1Table of contentsThis guide contains scenario, conceptual and procedural information on using SMS messages to retrieve the location of a potential subscriber and encourage them to join your SMS mailing list. Tools and PrerequisitesTo execute the scenario in this guide, you must have the SMS feature enabled on your account. Contact your account manager or customer support for more information on enabling SMS messaging for your ExactTarget account. ScenarioNorthern Trail Outfitters has opened a chain of retail stores with inventories tailored to the climate and terrain of the surround region. Each store wants to target its mailing list to potential customers within a certain distance of a specific store. To create such a targeted mailing list, Northern Trail Outfitters uses ExactTarget to set up an MO SMS keyword that asks users to send in the keyword ZIP and their ZIP code to the Northern Trail Outfitters short code. AMPscript used in the MO SMS keyword matches the ZIP code to a city and state by referring to a data extension containing store location information. If the ZIP code is found, Northern Trail Outfitters sends an SMS message to the MO user asking them to send back the keyword JOIN and their email list. If the MO user sends such a message back correctly, the MO user's information is stored in a data extension and assigned a random customer key. From there, Northern Trail Outfitters can send the MO user an email as part of their normal subscriber-based email sends. Based on the ZIP code, a store can move that subscriber on to their list and send them the appropriate emails. How to Create the Data ExtensionsTo complete this scenario, Northern Trail Outfitters creates two data extensions. The first contains the following columns:
It's important that each ZIP code is listed only once in its own row. Listing a ZIP code multiple times will cause errors when the AMPscript looks up the data and attempts to associate it with a potential subscriber. In the AMPscript example below, this data extension is referred to by the name "resurv-locations," but you can change it to the name you want to use. The second data extension contains the following columns:
The AMPscript from the SMS MO keyword takes the information from the MO message and puts it in the second data extension for use later. The triggered send in the AMPscript below refers to the second data extension. Creating the AMPscriptThis block of AMPscript serves two purposes:
%%[ Var @zip, @msg, @rows, @row, @city, @state, @subkey, @email, @date, @mobile, @ts, @tsDef, @ts_sub, @ts_attr, @ts_statusCode, @ts_statusMsg
if (Uppercase([MSG(0).NOUN(0)]) == "ZIP") and (Length([MSG(0).NOUN(1)]) >= 5) then
Set @zip = v([MSG(0).NOUN(1)])
Set @rows = LookupRows("resurv-locations","zip",@zip)
if RowCount(@rows) == 1 then
Set @row = Row(@rows,1)
Set @city = Field(@row,"city")
Set @state = Field(@row,"state")
Set @msg = Concat(@city,", ",@state,": Txt JOIN and your Email to join our list")
endif
elseif (Uppercase([MSG(0).NOUN(0)]) == "ZIP") and (RowCount(@rows) > 1) or (RowCount(@rows) == 0) or (Empty([MSG(0).NOUN(1)]) == "true") then
Set @msg = "I'm sorry an error occurred finding your location"
elseif (Uppercase([MSG(0).NOUN(0)]) == "JOIN") and (not Empty([MSG(0).NOUN(1)])) then
Set @subkey = Concat(Random(1,1000),"-",Random(1,1000))
Set @email = v([MSG(0).NOUN(1)])
Set @date = Now()
Set @mobile = v(MOBILE_NUMBER)
Set @ts = CreateObject("TriggeredSend")
Set @tsDef = CreateObject("TriggeredSendDefinition")
SetObjectProperty(@tsDef,"CustomerKey","SMSTriggeredSendToDE2")
SetObjectProperty(@ts,"TriggeredSendDefinition",@tsDef)
Set @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub,"SubscriberKey",@subkey)
SetObjectProperty(@ts_sub,"EmailAddress",@email)
Set @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr,"Name","Date")
SetObjectProperty(@ts_attr,"Value",@date)
AddObjectArrayItem(@ts_sub,"Attributes",@ts_attr)
Set @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr,"Name","MobileNumber")
SetObjectProperty(@ts_attr,"Value",@mobile)
AddObjectArrayItem(@ts_sub,"Attributes",@ts_attr)
AddObjectArrayItem(@ts,"Subscribers",@ts_sub)
Set @ts_statusCode = InvokeCreate(@ts,@ts_statusMsg)
Set @msg = "You'll receive an email shortly"
else
Set @msg = "I'm sorry there was an error with your request"
endif ]%%
%%= v(@msg) =%%
How to Create the SMS MO KeywordFrom here, Northern Trail Outfitters creates the SMS MO keyword in the ExactTarget system. The MO keyword uses the following values:
Northern Trails saves the SMS MO keyword after entering this information. This page was last updated by Ryan Williams on Tue, 02 Aug 2011 12:15:45 GMT. If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:
Tags: (Edit tags)
|
Powered by MindTouch 2010 |