AWS Messaging & Targeting Blog
Orchestrating and Monitoring Multichannel Messaging with Amazon Pinpoint
The union of marketing and technology (MarTech) has contributed to making communications and customers interactions more dynamic and personalized. In a multichannel environment with increasingly connected customers, it is essential for a MarTech system to orchestrate a digital marketing strategy using customers’ preferred channels in addition to monitoring their effectiveness during these engagements.
Companies in a variety of industries, from financial and retail to manufacturing seek to communicate with customers in the most efficient way, at the right time and channels. One way to facilitate this communication is to engage the customer in a personalized multi-step experience, or journeys. Amazon Pinpoint is a tool that gives marketers the flexibility to create multi-channel campaigns and monitor end user interactions such as email opens and clicks.
In this blog post we’ll go deeper into how Amazon Pinpoint can be configured for customer interactions and orchestration. We’ll also learn how to monitor and observe the results of these interactions through other AWS services that complement the MarTech stack.
Enabling Multi-Channel on Amazon Pinpoint
Sign in to the Amazon Pinpoint console and choose a region where the service is available. To organize the settings, campaigns, segments, and data, marketers can create a project on Amazon Pinpoint. To do this, simply specify a name for the project in the Get started box and select Create a Project.
After creating the project, a number of options related to the newly created project will appear on the menu on the left.
The first step to getting a project running is to activate the desired channels. A channel represents the platform through which you engage your audience segment with messages. Currently Amazon Pinpoint supports push notifications, email, SMS, voice and the creation of custom channels such as WhatsApp, Facebook Messenger or any other service that allows API integrations. In this blog post we will use the native Amazon Pinpoint channels: email, push notifications and SMS.
Let’s start by configuring the e-mail channel. From the menu related to the newly created project, navigate to Settings → Email and follow step 5 of the Creating an Amazon Pinpoint project with email support.
After configuring the email channel, we will start with configuring the SMS channel by navigating to Settings → SMS and Voice. Follow the walkthrough available in Setting up the Amazon Pinpoint SMS channel from the step 5. Then activate a phone number for the SMS service by following the steps on Requesting a number.
Note that Amazon Pinpoint supports more types of phone numbers in the United States than in other countries. Please review the available numbers within the United States and other countries. For testing in the United States a Toll Free Number (TFN) can be provisioned to the account immediately.
Remember that the usage of AWS services may incur costs and for detailed information about the costs regarding each service, by region, please visit this .
(Optional) Activate the push notification channel by going to, Settings → Push notifications and follow from Step 5 of the guide Setting up Amazon Pinpoint mobile push channels.
At the end of the settings, when accessing the Settings menu of the created project, you will see a similar screen like the following image.
We’ve now finished the channel configuration and are ready to move onto building Amazon Pinpoint Journeys.
Configuring Multi-Channel Experiences on Amazon Pinpoint Journeys
Now, let’s create a multichannel journey based on an external event. A journey is a personalized engagement experience made up of multiple steps across multiple channels. For example, in the case of a financial institution that wants to communicate with a customer over their preferred channel to notify the customer to activate a travel notice.
To simulate this use case, we will insert some endpoints. An Endpoint represents a destination that you can send messages, and a user can have one or more endpoints.
The example below is a json-document with 4 endpoints for 3 users, since the same user has two endpoints for two different channels. You should change the addresses to your own test email addresses, phone numbers, and push tokens, before using the example below.
Note that if your account is still in the sandbox these will need to be verified email addresses.
If you only have access to a single email address you can use labels by adding a plus sign (+) followed by a string of text after the local part of the address and before the at (@) sign. For example: [email protected] and [email protected]
Then, the following steps:
- Create a json file based on the example below.
- Update the Address fields with your test email addresses and phone numbers.
- Run AWS CLI to import the JSON file created in step 1.
{
"Item": [
{
"ChannelType": "EMAIL",
"Address": "[email protected]",
"Attributes": {
"PreferredChannel": ["N"]
},
"Id": "example_endpoint_1",
"User": {
"UserId": "example_user_1",
"UserAttributes": {
"FirstName": ["Richard"],
"LastName": ["Roe"]
}
}
},
{
"ChannelType": "SMS",
"Address": "+16145550100",
"Attributes": {
"PreferredChannel": ["Y"]
},
"Id": "example_endpoint_1b",
"User": {
"UserId": "example_user_1",
"UserAttributes": {
"FirstName": ["Richard"],
"LastName": ["Roe"]
}
}
},
{
"ChannelType": "SMS",
"Address": "+16145550102",
"Attributes": {
"PreferredChannel": ["Y"]
},
"Id": "example_endpoint_2",
"User": {
"UserId": "example_user_2",
"UserAttributes": {
"FirstName": ["Mary"],
"LastName": ["Major"]
}
}
},
{
"ChannelType": "APNS",
"Address": "1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7a8b9c0d1e2f",
"Attributes": {
"PreferredChannel": ["Y"]
},
"Id": "example_endpoint_3",
"User": {
"UserId": "example_user_3",
"UserAttributes": {
"FirstName": ["Wang"],
"LastName": ["Xiulan"]
}
}
}
]
}
Once the endpoints are inserted, let’s create 3 segments to represent each preferred channel — Email, Push Notifications, and SMS:
- Navigate to your project in the Amazon Pinpoint Console, choose Segments and then Create a segment.
- Select Build a segment.
- Provide a name for your segment, for example, SMS Preferred.
- Configure Segment Group 1 following the steps below to filter the endpoints where the preferred channel is SMS.
- Under Base segments, select Include any audiences
- Choose Add criteria and choose Channel Types → SMS.
- Choose Add filter, select Custom Endpoint Attributes → PreferredChannel, Operator Is, and on the dropdown choose Y.
Follow the same steps above for the Push and Email channels, choosing each of these channels in step 4.2. When you finish the configuration, you will have a result similar to the one presented below.
Next, let’s create the message templates for each of the channels. Follow the step-by-step in the User Guide for each of the following channels:
You should see the following:
Next, lets create the journey to notify users when a travel notice event occurs.
- Under your project Amazon Pinpoint Console, navigate to Journeys and choose Create journey.
- If this is your first time creating a Journey, click through the help messages
- Name your journey Travel Notice.
- Choose Set entry condition
- In Choose how to start the journey, select: Add participants when they perform an activity.
- In the field Events enter TravelNoticeAlert
- Choose Save.
- Click Add activity under the Journey Entry box and select Multivariate split
- Add 2 new branches by selecting Add Another Branch
- For the Branch A, under Choose a condition type, select Segment and for Segments choose E-mail Preferred
- For the Branch B, under Choose a condition type select Segment and for Segments choose SMSPreferred
- For the Branch C, under Choose a condition type select Segment and for Segments choose Push Preferred
- Leave everything else as the default values and select Save
- Finally, add a message sending activity for each segment.
- Under Branch A, select Add Activity, choose Send an email, then Choose an email template and select the template you created before for email channel.
- Choose Save.
- Under Branch B, select Add Activity, choose Send an SMS message, then Choose an SMS template and select the template you created before for SMS channel.
- Under Origination phone number, select the phone you configured when creating the SMS Channel
- Choose Save.
- Under Branch C, select Add Activity, choose Send a push notification activity, then Choose a push notification template and select the template you created before for push channel.
- Choose Save.
- When you complete these steps your journey will have a similar structure to the one presented below.
- Choose
- Under Review your journey choose Next, Mark as reviewed and finally Publish.
- Wait for the Journey to begin before continuing.
Installing Event Monitoring Components on Amazon Pinpoint
We can monitor and analysys the events generated by Amazon Pinpoint in real time by installing the Digital User Engagement Events Database solution, which is a reference implementation that installs the necessary services to track and query Amazon Pinpoint events.
To install this solution, follow the walkthrough available at Digital User Engagement Events Database Automated Deployment making sure to select the same region you used to configure Pinpoint earlier.
In Step 1. Launch the stack, for the Amazon Pinpoint Project ID field enter the Project ID that you created earlier, and leave the other fields as default. Wait for the end of the solution deployment. It will create a bucket in Amazon S3, a delivery stream in Amazon Kinesis Firehose, and a database and views in Amazon Athena, plus an AWS Lambda function responsible for partitioning the data.
Remember that the usage of AWS services may incur costs and for detailed information about the costs regarding the Digital User Engagement Events Database, please refer to the solution cost page.
Validating Your Multi-Channel Journey
Finally, we will use the commands below, to validate the event that triggers the journey and monitoring.
Note that we are using an Endpoint ID and not User ID. Amazon Pinpoint will see that the endpoint is associated with a user and as such use the appropriate Preferred Channel for that user.
For the following commands you can use AWS CLI.
application-id is your Amazon Pinpoint project ID. It can be accessed within AWS Pinpoint Console.
The value for the EventType parameter is the same you defined during the configuration of the Event field within the journey. In our example the value is TravelNoticeAlert.
Monitoring the Events of Your Multi-Channel Journey
Amazon Pinpoint natively offers a set of dashboards that can be accessed through the Analytics menu. However, with the architecture proposed in this blogpost it is possible to extract more detailed analysis. Navigate to the Amazon Athena console.
- Choose the Database due_eventdb that was configured by the solution above.
- Under New query tab copy and paste the statement below and choose Run query. The statement below creates a view that returns all endpoints to which SMS messages have been sent, with the status of sending at the telephone carrier. For more information about Views, access the topic Working With Views in Amazon Athena User Guide. Note that you may need to configure an S3 Bucket to store Athena Query Results.
CREATE OR REPLACE VIEW sms_carrier_delivery AS SELECT event_type, client.client_id, from_unixtime(event_timestamp/1000) event_date, attributes['journey_activity_id'] journey_activity_id, attributes['destination_phone_number'] destination_phone_number, attributes['record_status'] record_status FROM "due_eventdb"."all_events" WHERE event_type = '_SMS.SUCCESS' ORDER BY event_timestamp
- Open a new tab, copy and paste the following query, and select Run query. The command below creates a view that returns all endpoints to which SMS were sent, the message type (transactional or promotional), and the cost of sending.
CREATE OR REPLACE VIEW sms_pricing AS SELECT event_type, client.client_id, from_unixtime(event_timestamp/1000) event_date, attributes['destination_phone_number'] destination_phone_number, attributes['message_type'] message_type, metrics.price_in_millicents_usd/100000 sms_message_price FROM "due_eventdb"."all_events" WHERE event_type = '_SMS.SUCCESS' ORDER BY event_timestamp
To see all of the events available please refer to the Events Database Data Dictionary.
Finally, let’s further explore other monitoring options by creating dashboards in Amazon Quicksight.
From the AWS console, go to Amazon Quicksight and, if necessary, sign up.
- Select the top left menu where your username is and then Manage QuickSight.
-
- Select Security & permissions
- On QuickSight access to AWS services, select Add or remove.
- Check the option Amazon Athena, access Next and in S3 → S3 Buckets Linked To QuickSight Account.
- If the check box is clear, enable the check box next to Amazon S3.
- If the check box is already enabled, choose Details, and then choose Select S3 buckets.
- Check the S3 bucket created by the Digital User Engagement Events Database solution. If you have questions about the bucket name, check the Outputs tab for the value for the Dues3DataLakeName key of the CloudFormation stack you created.
- Select Finish and Update.
- Go back to the Amazon QuickSight home screen and select Datasets and then New dataset.
- Choose Athena.
- In Data source name field enter Pinpoint Dataset.
- Choose Validate connection, and Create data source.
- In the window Choose your table, in the Database: contain sets of tables select due_eventdb and the table sms_carrier_delivery.
- Select Edit/Preview data
- On the dataset definition screen press Save button.
- Choose Dataset
- Press the button New dataset.
- Scroll down to FROM EXISTING DATA SOURCES and access Pinpoint Dataset.
- Select Create dataset
- In the window Choose your table, in the Database: contain sets of tables select due_eventdb and the table sms_pricing.
- Select Edit/Preview data
- On the dataset definition screen press Save
- Repeat these steps again but select the journey_send table for the step
- Choose Analyses
- Press the button New analysis.
- For Your Datasets, choose journey_send and then access Create analysis. This view was created by Digital User Engagement Events Database solution.
- Under Field lists choose journey_send_status. Amazon QuickSight will draw a chart showing journeys events by status.
- Select the pen symbol next to Dataset and press the button Add dataset.
- Choose sms_carrier_delivery and Select.
- Choose the field record_status.
- Under Visual types, choose Pie chart. This chart will display message delivery status on your carrier.
- Press the pencil symbol next to Dataset and press the button Add dataset.
- Check sms_pricing and
- Choose sms_message_price and message_type
- Under Visual types, select Donut chart. This graph will display costs by transactional or promotional message type.
The final result will be something close to the one shown in the image below:
Conclusion
In this blogpost we walked through how to set up Amazon Pinpoint for an end-to-end scenario. We defined the basic components to a multichannel journey and monitoring, introduced AWS services as a MarTech solution that allows companies to send notifications to their customers preferred channels and also monitor their engagement data using Amazon Pinpoint events.
Clean up
If you want to avoid incurring future charges…
- Choose AWS CloudFormation.
- Delete and Delete stack
- Navigate to Amazon Pinpoint console.
- Go to Settings → SMS and voice, select the number created during the execution of this blogpost and choose Remove phone number.
- Under All projects, open the created project and then in the menu on the left select Settings → General settings. Choose Delete project and confirm the deletion by filling “delete” in the indicated field and select Delete.
- Choose Amazon Quicksight.
- Delete your user.