Finalizing all Journey Steps
Part VII - Tying the Journey together
In Part VI, we configured a Notification that was sent only conditionally, finalizing all elements of this Journey's Step 1. Now, we will configure Step 2 of the Journey which leads the user to leave some feedback after their appointment.
Setting the timer to start Step 2
- In Web Flows Builder, go to the Scheduler Control in the Schedule Appointment Web Flow. In the Actions tab of the Inspector, add a Start Timer Action and complete it as follows:
- Change the key to โstart-step-2โ
- Set an execution of 5 minutes after the appointment by adding the following Custom Expression:
ADD_TO_DATETIME(
session.appointment.end_time,
5,
"m"
)
This uses the Airscript function ADD_TO_DATETIME to return a DataTime indicating a time five minutes after the appointment ends.
- Beneath the Start Timer Action, nest a Go to Next Journey Step Action so that five minutes after the appointment is over, the user will be funneled into the second Step of the Journey.
Configuring the Collect Feedback Web Flow
This Web Flow will be triggered once the user leaves the appointment in order to collect some feedback.
- In Web Flows Builder, select the Collect Feedback Web Flow and rename the associated Web Page to โCollect Feedbackโ.
- Add a Label asking the user how the appointment went.
- Add a Text Area Input Control.
- Add a Button Control and change its text to โSubmit Feedbackโ.
- With the Submit Button selected, go to the Actions tab in the Inspector and add a Navigate to Web Page Action. Then, select Add Web Page.
- Go to the new Web Page in the Tree and rename it to โThank youโ.
- Add a Label to thank the user for their feedback. Personalize the message by including the
actor.first_name
variable:
โThank you for your feedback, {{actor.first_name}}!โ
- Save the app
Creating the App Object to save usersโ info
Letโs create an app object for the fields we want to store.
- Go to AirData Builder and create a Feedback App Object with the following fields:
feedback
Variable of Type Textphone
Variable of Type Phone. This attribute is the same one as the actorโs since it serves to identify the user.
- Save the app.
Creating the Data Flow to save feedback
In order to save the information into AirData, the next step is to create a Data Flow.
- Go to Connections Builder and create a Data Flow from scratch. Rename it to โSave Feedbackโ.
- In Start, add the following:
phone
Variable of Type Phonefeedback
Variable of Type Text
- By clicking on the โ+โ icon, add an AirData Request Data Operation.
- In App Object, select the one we have just created
- For Type select INSERT
- In Objects to Insert or Update, enter the Keys one by one from the โ+โ icon and match them with their corresponding Variables:
In Run Results, check that your Data Flow runs.
- Save the app.
Passing the Information to the Data Flow
- Go back to Web Flows Builder. With the Submit Feedback Button selected, go to Actions and add a Run Data Flow Action.
- Select the Save Feedback Data Flow and pass the following Variables:
actor.phone
for the phone inputtext_area
for the feedback input as that was the auto generated variable we got when adding the Text Area Input control to the Web Flow.
Informing the user
The last thing we need to configure is a Notification inviting users to submit some feedback once their appointment is over.
- In Notifications Builder, add another SMS Notification and rename it to โAsk for Feedbackโ.
- Add a text inviting the user to submit some feedback. Personalize the message by entering
actor.first_name
in Custom Airscript Expression. - Click on the โ+โ sign below the message and add a separate Link to Journey step to direct the user.
- Go to Journey Builder and drag Send an SMS from Notifications in the Tree to Step 2. Finally, select the Ask for Feedback Notification.
Is this Notification TCPA Compliant?
Yes! All Notification send from Journey Steps are automatically TCPA complaint, provided you've initialized the Actor properly, which we did back in Part 2.
Enabling TCPA timing restrictions on Notifications sent from a Journey Step requires initializing the Actor with an appropriate value for actor.calendar_restriction
.
actor.calendar_restriction
expects an Availability Schedule Key, and Notifications sent from Journey Steps will only be sent within the windows of time described by the Availability Schedule. To simplify the process of defining actor.calendar_restriction
, Airkit does it automatically whenever an Actor is initialized with values for actor.region
and actor.time_zone
, so that:
actor.calendar_restriction = "TCPA-{{actor.region}}-{{actor.time_zone}}"
(This Availability Schedule Key should look very familiar! It's what we used to enforce TCPA compliance when scheduling our first two Notifications.)
This actor.calendar_restriction
value references an out-of-the-box Availability Schedule that encompasses blocks of time the TCPA allows messages to be sent within the Actor's region and timezone. Outgoing Notifications sent from Journey Steps will only be sent within the allowed blocks of time.
For more on TCPA compliance and Notifications, see TCPA.
Previewing the start-step-2 timer
Let's go to App Preview to preview the finalized application.
-
After emulating all of Step 1, click on the Timers tab to see the timers that are available at that stage of the Journey.
-
Select the timer you want to test and, from Actions, click on Activate Scheduled Trigger. By doing so, the timer will be triggered regardless of the time it was set for.
- Go back to the Device tab and click on the chat icon at the bottom to see the Notification's message.
Congratulations! You've now built out a multi-Step scheduling application, capable of scheduling appointments and sending a variety of TCPA-compliant messages.
A note about publishing
There's one important element of sending SMS Notifications that went largely unaddressed throughout this tutorial: when outgoing text messages are sent, we've established that they're sent to the Actor, but what number are they sent from? This question is primarily important in the context to of publishing your application; see Publishing Your Application to learn more.
The Console provides the means to connect your Twilio numbers to your Org. Once connected to an Org, phone numbers will become available in Settings when accessing your application in the Studio. Under the Chat Bot section, you can select an available number to manage the texts associated with your application. Once a phone number is configured, your outgoing SMS Notifications will be sent from the configured number.
For more on how to associate your phone numbers with Airkit apps, see Connecting Your Twilio Numbers To Airkit.
Updated over 1 year ago