Genesys Cloud (formerly PureCloud)

Discussion Thread View
Expand all | Collapse all

Use an outbound contact list column in inbound SMS flow

  • 1.  Use an outbound contact list column in inbound SMS flow

    Posted 21 days ago
    We are sending outbound SMS messages via outbound campaigns for appointment reminders. We allow the person to respond 1 or 2 to confirm or cancel their appointment.
    I have set up my inbound SMS flow in architect to process the response, how do I access/associate the contact list from the outbound reminder with the inbound flow so that I can access the appointment information that was sent to the person? On the outbound contact list we have an appointment id associated with each text and I need to be able to retrieve the id when the person responds with 1 or 2 to update our appointments. I am seeing campaign and contact attributes on the message but nothing that gives me the contact list fields.
    #Outbound

    ------------------------------
    Patricia Oaks
    Electroline Data Communications Inc
    ------------------------------


  • 2.  RE: Use an outbound contact list column in inbound SMS flow

    GENESYS
    Posted 21 days ago
    Edited by Jim Ullyot 21 days ago

    Hi @Patricia Oaks,

    Thanks for the question!

    Within an Inbound Message flow, Architect has the following flow level built in variables available:

    * Message.ContactId

    * Message.ContactList​​​

    To see if a contact identifier is set, you could add a Decision action and then create a custom Data Action that would update your contact list contact as appropriate which you could do like this:

    this uses a decision action in an inbound message flow to check to see if the contact id is a non-blank value


    Above we used this expression:

    !IsNotSetOrEmpty(Message.ContactId)​


    But if you wanted to check to make sure both the contact ID and the contact list ID are not blank prior to calling a Data Action because you want to pass both in and make sure they're not blank ahead of time, this expression would work:

    !IsNotSetOrEmpty(Message.ContactId) and IsSet(Message.Campaign) and !IsNotSetOrEmpty(Message.Campaign.id)​


    and same thing here where you'd put your custom data action in the Yes output of the Decision action to update the contact list contact.  The IsSet check on built-in Message.Campaign variable in the expression above is to be safe because you don't want to attempt to access Message.Campaign.id if Message.Campaign itself is NOT_SET.  If Message.Campain is NOT_SET and you try to access the id property on it, that goes on the non-cool list and would invoke flow error handling so that's why I've got that IsSet(Message.Campaign) check there first.

    As far as built in flow level variables in Architect, we have this page in the Resource Center that goes over them in more detail:

    https://help.mypurecloud.com/articles/architect-default-variables/

    So in a nutshell you can check the built in variables to see if you have a contact id / contact list available and then call a custom data action that you'd write to update the contact itself.  Architect currently does not have any built in actions to update contact list contacts which is why the Data Action is recommended to do this additional work.

    Thanks!

    Jim

    ------------------------------
    Jim Ullyot
    Genesys
    ------------------------------



  • 3.  RE: Use an outbound contact list column in inbound SMS flow

    Posted 19 days ago
    Thanks Jim! I will take a look at the data actions.
    I would assume in the data action we can use the contact list and contact id to lookup information that was in the outbound contact list for this contact?
    When the patient responds, we want to text instructions that were with the original outbound contact.

    ------------------------------
    Patricia Oaks
    Electroline Data Communications Inc
    ------------------------------



  • 4.  RE: Use an outbound contact list column in inbound SMS flow

    GENESYS
    Posted 19 days ago
    Edited by Jim Ullyot 19 days ago
    Hi @Patricia Oaks,

    Sounds good!  Also, while I haven't used it I think you'll want the custom data action to hit up this endpoint to get the contact:

    GET /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}​

    and then pick off the information it wants from the response.  Lets assume your custom data action takes inputs of contact ID and contact list ID and for outputs it has a contact name string and contact instructions string.  This is "happy path" coding in Architect but shows calling your data action and then sending a response to the contact along with the instructions from the contact:

    This image shows calling a data action to get contact information, then uses a Send Response action to send the contact's instructions to them.
    So on the data action above we passed in the contact id / contact list id and then we bound the output contact name and instruction string values to a State.ContactName string variable and State.ContactInstructions string variable.  Next the decision action on the success output says "Are both the name and instruction strings returned from the data action that we stored in State.ContactName and State.ContactInstructions non-blank?" and if they both have text, we send the following message:

    Dear {State.ContactName}, here are your instructions: {State.ContactInstructions}. If you have any other questions or just want to say hi ;-), please contact us. Thanks!​

    That expression for the response can be written directly as:

    Append( "Dear ", State.ContactName, ", here are your instructions: ", State.ContactInstructions, ". If you have any other questions or just want to say hi ;-), please contact us. Thanks!" )​

    Or instead of selecting Expression for the Body setting on the Send Response action, you could use the String Builder and configure it like this where each part of the response is laid out individually.  Some flow authors like this UI better than writing the actual expression text like I have above:

    This shows the string builder being used to generate response text.

    and I scrolled down here so you could see the whole configuration:

    This shows the remaining items in the string builder to send a response.


    Hope this helps!

    Jim

    ------------------------------
    Jim Ullyot
    Genesys
    ------------------------------