SMS Zip-Code-To-Subscriber Scenario Guide

From $1

    This 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 Prerequisites

    To 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.

    Scenario

    Northern 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 Extensions

    To complete this scenario, Northern Trail Outfitters creates two data extensions. The first contains the following columns:

    • ZIP code
    • City
    • State

    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:

    • Customer key
    • Email address
    • The date the request was received
    • The subscriber's mobile phone number

    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 AMPscript

    This block of AMPscript serves two purposes:

    1. This first part attempts to match the ZIP code sent in by the MO user with information from a data extension. If it finds a single correct match, the MO keyword sends out the invitation to join the Northern Trail Outfitters email list. If there is more than one correct match or no correct match, the MO keyword sends out an error message.
    2. The second part takes requests to join a mailing list via an SMS message, assigns the user a randomly generated customer key, places their email and location information in a data extension, and send back a confirmation message. If there is a problem with the JOIN SMS message, the system will send back an error message via SMS.
    %%[ 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 Keyword

    From here, Northern Trail Outfitters creates the SMS MO keyword in the ExactTarget system. The MO keyword uses the following values:

    • Name: Email List
    • Verb: Join
    • Next Keyword: This field is left blank for this scenario
    • Action: Join Email List
    • Default List: The name of the data extension used to hold the subscription information
    • Message: Northern Trail Outfitters pastes the AMPscript from the Creating The AMPscript heading into this text field

    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:

     


    Was This Page Helpful?
    Suggestions or Comments:
    Name (optional):
    Email Address (optional):
    Enter 22090 backwards:
       
    Tags: (Edit tags)
    • No tags
     
    Comments (0)
    You must login to post a comment.

     
    Powered by MindTouch 2010
    Admin