A repository of reference architectures for AWS Digital User Engagement services, Amazon Pinpoint and Amazon Simple Email Service (SES), and other AWS services.
- Amazon SES Basics
- Amazon Pinpoint Basics
- Amazon S3 Triggered Endpoint Imports
- Automatic Phone Number Validate
- Automatic Amazon Pinpoint Campaign Creation
- Pinpoint Event Processing
- Pinpoint S3 Event Database
- Pinpoint SMS S3 Event Database
- SES email S3 Event Database
- Pinpoint Message Archiver
- Add / Remove from Segments via Event Activity
- Simple CMS or Static Website Host
- Digital User Engagement Events Dashboard
- Pinpoint / SES messages queuing
- Pinpoint Journey Copying Mechanism
- Amazon Pinpoint SMS
- Amazon Pinpoint Extensibility
- Federated Segmentation with Amazon Athena
- Send-Time Amazon Pinpoint Campaign Attributes
- External Amazon Pinpoint Campaign Templates
- Connect (or Facebook, WhatsApp, Twitter, anything) as a Pinpoint Campaign Channel
- Amazon Pinpoint Email Attachments with Custom Channel
- Amazon Pinpoint Campaings, Journeys, Segments DB
- Combining Multiple References Together
Like many other IT functions, sending emails requires operational oversight and ongoing management. One such consideration for executing any email delivery is reputation management by means of event processing. SES should be configured to emit events regarding email activity. Many events can be generated by SES, but two that are of high concern are Bounces (the recipient's mail server permanently rejected the email) and Complaints (the email was successfully delivered to the recipient, however recipient marked the email as spam). Failing to respond to these events will damage sending reputation.
The architecture below shows how SES can be configured to emit events to SNS which is then routed SQS and finally to a Lambda for processing. The Lambda function should then evaluate the events and for Bounces and Complaints, update the email address source database and remove the offending addresses from future sends.
Additionally, the Lambda function should be configured to make use of the SES Account Level Suppression List functionality to automatically suppress this email address from future sends.
- Best Practices configuration when sending emails
- Maintain high sending reputation
- Adhere to customer complaints and feedback
- Amazon SES Notifications Through Amazon SNS
- Configuring Amazon SNS Notifications for Amazon SES
- Amazon SNS Notification Examples for Amazon SES
Most of the time, the outgoing email address used to send email w/SES and Pinpoint is not setup to receive emails (aka No-Reply). It is often expected, however, that should somebody reply to such an email, that they would receive an automated guidance/confirmation that the address is not monitored and possibly who and how to reach for assistance. If that is not specifically configured, using such a non-existing email address would lead to an unhelpful and unprofessional server rejection due to address not being registered.
The architecture below allows one to deploy a templated auto-response behavior for a SES/Pinpoint domain/email address. A new rule is added to the SES Email Receiving Rule Set. The rule can be limited to specific email address, specific domain, or just be set to be across all domains. It can also have the default response address set or simply reuse the address that the original email was sent to. Once the rule is set, it is pointed to a Lambda function. Finally the latter looks up the chosen Pinpoint template and uses it to reply back. The template subject is used as the prefix for the original email subject. Optional template tag %%NAME%% is replaced with the original email's FROM and %%ID%% with the SES email message id.
Notes:
- While most of the configuration is done on the SES side (as that is the one processing received emails), even so called "Pinpoint-only" deployments can use this approach as the email configurations are shared between the two services already.
- Ensure your SES domain is verified and you are out of the sandbox. If still in the sandbox, you can only send email to the Amazon SES mailbox simulator and to email addresses/domains that you have verified.
- It is assumed that no additional tracking and actions are needed on such rejected and auto-replied emails, but you can further modify the flow by moving the rule around, adding more actions, and even specifying a particular SES Configuration Set.
- Pinpoint template instead of SES template is used as the latter does not currently have Console interface allowing for easier modification.
- Common practice configuration when sending emails
- Professional auto-reply to emails sent to the configured sending email addresses
In the majority of cases, business and finance teams require monthly VDM data for the purposes of validation and billing requirements. The people in question are not typically users of the Amazon Web Services interface, and they do not have any notion how to use the AWS console. In these kinds of situations, the business stakeholders desire a monthly email send report to be delivered to their email box. This report will allow them to take the next action steps, such as arranging to bill or observing the sending pattern, among other things. In addition, Independent Software Vendors (ISVs) that use Amazon Simple Email Service (SES) to send emails on behalf of their customers require these monthly VDM statistics to be supplied on a regular basis to their billing management teams. This allows the teams to plan the accountings for the end customers and track the margins.
Using the architecture that is presented below, it is possible to implement a templated auto-response mechanism that sets a VDM export operation to run on the first day of each month in order to obtain the statistics for the previous month. This data is subsequently sent to end users who are concerned about it. Within this architecture, Amazon Event bridge is responsible for triggering a timely event scheduling job, which triggers a step function that calls Amazon SES through v2 Apis in order to create a VDM export job. The same step function is then responsible for obtaining the acquire export job. In addition to distributing a pre-signed URL, the get export job is responsible for deploying this monthly report to an S3 location. Through ARNS, the same pre-signed URL is communicated to the various stakeholders of the customer.
- Extracting email email statics per identity, configuration set and ISP.
- Easy to calculate and understand tenant specific email usage.
- Figuring out the reputation from the tenant email sending stats
Even though Pinpoint has great API support to stream endpoint data to Pinpoint in realtime, many customers operate in a batch world and are used to loading data between systems in a batch method. Pinpoint has the ability to import data from CSV or JSON files from Amazon S3 specifically for this use-case. This could be used in a nightly batch process to update all Pinpoint Endpoints with the most recent data and preferences, or on a much smaller interval.
The architecture below will set up an infrastructure to automatically trigger when a new file is placed in an S3 bucket. The process, managed by an AWS Step Functions state machine, will start a Pinpoint import process, wait for it to complete, and send notifications that the job started, successfully finished, or failed.
For notifications, the below architecture uses SNS which allows for notifications to be sent to humans (ex: Email, SMS) or other systems that can read from the SNS topic. The notifications include the details of the import job so that quick action can be taken and records of past import jobs can be retained. The SNS Topic to subscribe to for notifications is found as an output parameter of the CloudFormation template.
With this architecture, development teams can simply save JSON or CSV formatted files for import in the designated S3 location and the process will manage the rest. It will provide detail logging in CloudWatch and send SNS notifications.
- Nightly Batch Endpoint Updates
- Ad-hoc Batch Endpoint Updates
- Triggered Imports with Status Alerts
- Operational notifications of import jobs
- Importing segments
- Developer Guide Importing segments
- Using AWS Lambda with Amazon S3
- What Is AWS Step Functions?
- Tutorial: Subscribing an endpoint to an Amazon SNS topic
Pinpoint includes a phone number validation service that you can use to determine if a phone number is valid, and to obtain additional information about the phone number itself. For example, when you use the phone number validation service, it returns the following information:
- The phone number in E.164 format.
- The phone number type (such as mobile, landline, or VoIP).
- The city and country where the phone number is based.
- The service provider that's associated with the phone number.
The API is useful for verifying phone numbers provided on a web form, cleaning your existing contact database, or to help determine if SMS is supported for a given phone number allowing you to fallback to Voice if necessary.
The architecture below will setup a Pinpoint segment of all unverified phone numbers by looking for a new endpoint attribute: PNV_PhoneNumberValidated. When the included State Machine is executed, it will export all the unverified numbers using that segment, perform verification on every number, and write back to Pinpoint as endpoint attributes the result of the API call including endpoints like: PNV_Carrier, PNV_City, PNV_Country, PNV_PhoneType, PNV_Timezone, PNV_ZipCode, and PNV_PhoneNumberValidated.
This architecture could be triggered from the Amazon S3 Triggered Endpoint Imports architecture above to perform validation on all newly imported endpoints automatically upon import. This could be done by setting up a Lambda function to listen to the SNS topic published from the import architecture that calls the execute method of the state machine.
- Verifying phone numbers provided on a web form
- Cleaning your existing contact database
- Determine best channel (SMS or Voice) for a number
- Operational notifications of Phone numbers validated
- Validating phone numbers in Amazon Pinpoint
- What Is AWS Step Functions?
- Tutorial: Subscribing an endpoint to an Amazon SNS topic
Pinpoint's UI allows marketers and non-technical users an easy way to create campaigns. There are times when creating campaigns needs to be done programmatically via the API. Further, this scheduled of campaigns could be event-triggered and also provide operational metrics via SNS notifications to when campaigns are scheduled and include success or failure alerting.
The architecture below will setup a simple State Machine that will execute a campaign immediately using the input state machine input:
{
"SegmentId": "...",
"SegmentName": "...",
"SmsTemplateName": "...",
}
It will immediately start the campaign and then wait for it to finish providing operational insights in an SNS topic including: Campaign Status, Actual Start Time, Actual Finsih Time, and Successful and Total Endpoint Count.
This architecture could be triggered from the Amazon S3 Triggered Endpoint Imports architecture above to send messages immediately upon an import. It could be chained with the Amazon S3 Triggered Endpoint Imports and Automatic Phone Number Validate to send SMS messages after numbers have been imported and then immediately verified for sending. This can be done by deploying Lambda functions to each SNS topic that initiates the next state machine. See Triggered Imports, Phone Validate, Campaign Create below.
- Automatically fire off messages upon file imports
- Set up welcome messages to be sent when new files are exported
- Set up timers to create campaigns on your own schedule
- Operational notifications of campaign statuses
- Creating Campaigns
- Campaign Activities
- What Is AWS Step Functions?
- Tutorial: Subscribing an endpoint to an Amazon SNS topic
Like many other IT functions, sending emails requires operational oversight and ongoing management. One such consideration for executing any email delivery is reputation management by means of event processing. Pinpoint should be configured to emit events regarding email sends. Many events can be generated by Pinpoint, but two that are of high concern are Bounces (the recipient's mail server permanently rejected the email) and Complaints (the email was successfully delivered to the recipient, however recipient marked the email as spam). Failing to respond to these events will damage sending reputation.
Since Pinpoint uses Amazon Simple Email Service to send all emails, we can rely on the above SES Event Processing Architecture to manage bounces and complaints for both SES and Pinpoint.
- Best Practices configuration when sending emails
- Maintain high sending reputation
- Adhere to customer complaints and feedback
- Amazon SES Notifications Through Amazon SNS
- Configuring Amazon SNS Notifications for Amazon SES
- Amazon SNS Notification Examples for Amazon SES
Sending outbound messages with Pinpoint allows you to track engagement events both in the Pinpoint console and programmatically by consuming the raw events that Pinpoint (and SES) generate. These events provide a wealth of knowledge on how your end-users are engaging with your messaging and Pinpoint allows you to stream these events to S3 to create a data lake which is excellent for mining, analysis, and future machine learning training and retraining.
The architecture below shows how Pinpoint can be configured to emit events through Kinesis Firehose into Amazon S3. SES will also be configured to use Pinpoint as an Event Destination, using the SESv2 API, to route all SES email events into the same S3 destination. Finally, it will register the event schema with Athena and Glue to create a single table for all events, and a series of Views, one for each event type.
This enables Athena Queries to be run against each event type as a flattened view, allowing for queries like:
Ex: Get all Campaigns with Opens, Clicks, Hard Bounces, Soft Bounces, and Unsubscribes
SELECT
pinpoint_campaign_id,
(SELECT COUNT(*) FROM email_send WHERE email_send.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumSends,
(SELECT COUNT(*) FROM email_open WHERE email_open.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumOpens,
(SELECT COUNT(*) FROM email_click WHERE email_click.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumClicks,
(SELECT COUNT(*) FROM email_hardbounce WHERE email_hardbounce.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumHardBounces,
(SELECT COUNT(*) FROM email_softbounce WHERE email_softbounce.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumSoftBounces,
(SELECT COUNT(*) FROM email_unsubscribe WHERE email_unsubscribe.pinpoint_campaign_id = campaign_send.pinpoint_campaign_id) AS NumUnsubs
FROM campaign_send
WHERE ingest_timestamp > current_timestamp - interval '30' day
GROUP BY pinpoint_campaign_id
Ex: Find all emails received by an email address in the last 30 days and check to see if it was opened
SELECT
a.event_timestamp as WhenSent,
a.subject as EmailSubject,
CASE WHEN b.event_timestamp IS NULL THEN 0 ELSE 1 END as DidOpen
FROM email_send a
LEFT JOIN email_open b
ON a.message_id = b.message_id
WHERE contains(a.destination, 'example_address@example.com')
AND a.ingest_timestamp > current_timestamp - interval '30' day
ORDER BY a.event_timestamp DESC
- Data Mining
- Engagement Scoring
- Engagement Analysis
- Campaign Reporting
- Click and Open Tracking
- Machine Learning Training / Retraining
- Streaming Amazon Pinpoint Events to Kinesis
- Setting Up Event Streaming
- Monitoring Using Amazon SES Event Publishing
- Setting Up Amazon SES Event Publishing
- Set Up a Kinesis Data Firehose Event Destination for Amazon SES Event Publishing
- Populating the AWS Glue Data Catalog
- Amazon Athena - Working with Views
Sending outbound messages with Pinpoint SMS allows you to track engagement events. These events provide a wealth of knowledge on the delivery status of your messages and Pinpoint SMS allows you to publish these events on Amazon SNS topic, Amazon CloudWatch logs or stream them to an Amazon S3 bucket to create a data lake which is excellent for mining, analysis, and future machine learning training and retraining.
The architecture below shows how Pinpoint SMS can use Amazon Kinesis Firehose as an event destination to stream SMS engagement events and store them into an S3 bucket.
This enables Athena Queries to be run against each event type as a flattened view, allowing for queries like:
Ex: Get total count and cost of all SMS by message type (Transactional / Promotional)
SELECT messagetype, COUNT(DISTINCT messageid) as MessageCount,SUM(totalmessageprice) as TotalCostUSD FROM "db_name"."sms_events"
GROUP BY messagetype
- Data Mining
- Engagement Analysis
- Campaign Reporting
- Machine Learning Training / Retraining
Amazon SES tracks email engagement events, which provide a wealth of knowledge on the delivery status of your messages. Using the event publishing feature, these email engagement events can be streamed using Amazon Kinesis Firehose, publish them on an Amazon SNS topic allows or on Amazon CloudWatch.
The architecture below shows how Amazon SES can use Amazon Kinesis Firehose as an event destination to stream email engagement events and store them into an S3 bucket.
This enables Athena Queries to be run against each event type as a flattened view, allowing for queries like:
Ex: Check the email delivery status for a specific email address
SELECT *
FROM "ses-eventsdb"."email_status"
CROSS JOIN UNNEST(destination) AS t(email)
WHERE t.email = 'email@address.com'
ORDER BY time_sent DESC;
- Data Mining
- Engagement Analysis
- Campaign Reporting
- Machine Learning Training / Retraining
Many organizations need to keep records of messages sent to end-users. Using the Pinpoint Event Stream, we are able to archive all Campaign and Journey messages reliably in Amazon S3 by re-rendering the message using the content provided.
The Architecture below shows how an Archiving solution could be built by attaching an AWS Lambda function to an existing Kinesis Firehose used as a Pinpoint Event Stream. We configure the Lambda function to look for the _campaign.send
and _journey.send events
processing the archival asynchronously using Amazon Simple Queue Service.
The result are MIME-typed files stored in Amazon S3 with the Key Prefix: /archive/[EndpointId]/[Year]/[Month]/[Day]/[Hour]. This allows for easy GDPR compliance by enabling deletion of all messages belonging to the same Endpoint ID very quickly.
- Compliance requiring historical record of all messages sent to an Endpoint
- Better customer service being able to lookup each messages sent to a user
Amazon Pinpoint can act as an event hub for events generated by engaging with end users (Email Opens, Email Clicks, Email Complaints, SMS Sends, etc). Pinpoint can also be used to stream custom events from applications via the PutEvents API. This is how AWS Amplify sends events to Pinpoint about mobile and web applications. All of these events can be streamed out of Pinpoint via the Pinpoint Event Stream allowing all of these events to be routed to the same destination for processing or storage. A common pattern is to use these events to target endpoints into Pinpoint Segments. Pinpoint's Dynamic Segment functionality allows for users to generate segments for Campaign or Journey targeting based on custom endpoint attributes.
The architecture below shows how an AWS Lambda function can be used to read the events coming from the Pinpoint event stream via Kinesis in order to find specific events that will trigger Endpoint attributes to be updated in near real time. The deployed Lambda function looks for email open events and custom webinar registration events.
Using this example, a marketer could create a Dynamic Segment in Pinpoint of users who have opened an email (attribute "email_opened" = "true") and who have registered for Webinar 5 (attribute "webinar_registration" = "webinar5"). This segment will be continuously updated so that Campaigns and Journeys would always have the most recent data.
- Using Event Data to create dynamic segments
- Target Users with Campaigns based on custom events
- Target Users with Journeys based on custom events
- Streaming Amazon Pinpoint Events to Kinesis
- Reporting Events in Your Application
- Pinpoint API - Events API
- Building Segments
Sometimes marketers need a simple way to host images and attachments that need to be referenced in Pinpoint or SES emails. They may also need to host a small static website to serve as a landing page for a particular marketing campaign.
This architecture will deploy an S3 bucket along with a CloudFront Distribution to allow for simple hosting of images and attachments for Pinpoint emails, Hosting a static website, or other file hosting needs.
Using AWS CloudFront will quickly distribute files from a geographic edge location that is closest to the requesting user.
WARNING! - ANY FILES UPLOADED TO THIS CMS WILL BE AVAILABLE TO THE PUBLIC. DO NOT USE THIS TO STORE ANY THING YOU WOULDN'T WANT THE ENTIRE WORLD TO SEE. THIS SHOULD ONLY BE USED TO HOST IMAGES/FILES YOU WOULD WANT TO INCLUDE IN EMAILS AND PUBLIC WEBSITES.
- Hosting images for Pinpoint/SES Emails
- Hosting attachments for Pinpoint/SES Emails
- Serving a small static site to use for simple landing pages or other marketing content
- This solution uses Cloudfront to quickly serve files from edge locations located close to your end users. By default the files are cached for 1 hour. If you upload files to S3 and don't see any changes you will need to invalidate the cache to see updates. If needed you can also adjust the 1 hour cache to a different value by modifying the Default TTL
- The associated S3 bucket will have S3 file versioning enabled. If you need to roll back or change versions you can easily do so via the S3 console.
- All S3 and CloudFront access will be logged to a separate S3 Logging Bucket for auditing purposes.
- Using a Custom Domain Name
- Secure Headers - This architecture does not implement Secure Headers. That maybe a concern if you are using this to host a static website. This can easily be fixed using Lambda@Edge. More Information
Customers want to view the results of their messaging campaigns in ever increasing levels of granularity and ensure their users see value from the email, SMS or push notifications they receive. Customers also want to analyze how different user segments respond to different messages, and how to optimize subsequent user communication. Previously, customers could only view this data in Pinpoint analytics, which offers robust reporting on: events, funnels, and campaigns. However, does not allow analysis across these different parameters and the building of custom reports. For example, show campaign revenue across different user segments, or show what events were generated after a user viewed a campaign in a funnel analysis. Customers would need to extract this data themselves and do the analysis in excel.
This Solution uses the Athena tables created by Digital user engagement events database solution Event database solution . The AWS CloudFormation template given in this post automatically sets up the different architecture components, to capture detailed notifications about Amazon Pinpoint engagement events and log those in Amazon Athena in the form of Athena views. You still need to manually configure Amazon Quicksight dashboards to link to these newly generated Athena views.
- Deep dive into engagement insights. (eg: SMS events, Email events, Campaign events, Journey events)
- The ability to view engagement events at the individual user level.
- Data/process mining turn raw event data into useful marking insights.
- User engagement benchmarking and end user event funneling.
- User engagement benchmarking and funneling
- Compute campaign conversions (post campaign user analysis to show campaign effectiveness)
- Build funnels that shows user progression.
Amazon SES and Amazon Pinpoint API operations for sending messages, don't have a queuing mechanism. If your application exceeds the allocated throughput limits (messages per second), then the API will return a throttling error message Maximum sending rate exceeded.
This solution takes advantages of an Amazon SQS Standard Queue and Lambda triggers ensuring that the allocated SES or Pinpoint throughput is being fully utilized while any throttling errors are being handled by writing the message back to the queue. The solution deploys an additional AWS Lambda function, which is invoked every minute by an EventBridge rule and writes an X number of messages defined by the user to the SQS Standard Queue. The messages written to the SQS Standard Queue are being send to an SES simulator address and all relevant metrics such as number of emails send, delivered, number of message written to the SQS etc. are reported on an Amazon Cloudwatch dashboard. Based on the Amazon Cloudwatch dashboard the user should configure the SQS batch and Lambda trigger concurrency so that the solution utilizes the full allocated throughput. Once the above have been configured the production application can write the messages directly to the SQS Standard Queue.
This solution is written in Python and uses a CloudFormation Template. It is fully configured for SES and requires minimum amendments for Pinpoint.
- Queue SES / Pinpoint messages and handle any throttling errors
- Store messages that are not being send due to an error in a dead letter queue for later processing or analysis
Amazon Pinpoint Campaigns, Journeys and Segments are Project specific resources and cannot be copied between Projects. This can become a blocker when Amazon Pinpoint is used from multiple teams who would like to share existing resources or when migrating between projects or AWS Regions. To achieve the above Amazon Pinpoint users need to re-create these assets in the new Amazon Pinpoint Project. This is a manual task that takes time and it is prone to human error.
This solution utilizes AWS CloudFormation that invokes an AWS Lambda function upon deployment, which copies the specified Journeys from one Amazon Pinpoint Project to another. The solution can also copy journeys between AWS regions and have them created either in an existing Amazon Pinpoint Project or a new one.
- Migration of Amazon Pinpoint Journeys from an old or staging Project to a new or production Project
- Marketing teams that are working in different Pinpoint Projects can share existing Journeys between them
Managing communication preferences for the SMS channel are very important. The STOP keyword is an important keyword to monitor when sending out SMS messages to end-users. By default, AWS will manage the STOP keyword (and other related keywords) on your behalf. If customers respond with STOP, then AWS will put that phone number on an opt out list per AWS account thereby blocking further communication with that end-user. This will keep you in compliance will sending SMS messages, but it is not ideal for transactional messaging such as One-Time Passwords, Confirmation Messages, or Receipts.
Amazon Pinpoint allows you to configure Self-Managed Opt Outs which will allow you to bypass AWS's built in controls. The architecture outlined below takes deploys an SNS Topic and Lambda function that will listen to and respond to the STOP keyword in two-way SMS conversations.
- Adhere to STOP keyword compliance rules
- Still allow for sending Transactional messaging after STOP keyword
- Used in One-Time Password, Confirmation, and Receipt messaging
- Allow other customer systems to be notified of STOP triggers
NOTE: Amazon Pinpoint does not allow you to configure two-way SMS or self-managed opt outs via API. This can only be done via the Console. After deploying the CloudFormation template, go into Pinpoint and turn on both Two-Way SMS, selecting the newly deployed SNS Topic, and also Self-Managed Opt Out per the documentation linked below.
- Managing the Amazon Pinpoint SMS Channel
- Using Two-Way SMS Messaging in Amazon Pinpoint
- SMS and Voice Settings
Amazon Pinpoint's SendMessages API can be used to send both Transactional and Promotional SMS messages. This repository shows how to use a CSV file drop in Amazon S3 to trigger a send via Amazon Pinpoint.
Many times, third party tools can be used to generate a targeted list of users for an SMS campaign. By dropping a file into S3, we can trigger the SMS messages to go out within milliseconds.
This solution takes advantages of an Amazon SQS FIFO Queue to ensure that we are able to control the concurrency of AWS Lambda functions being invoked as to not cause throttling exceptions. If using SMS Long Codes, it might be smart to include a Sleep(xxx) as long codes are limited to 1 per second. Short codes have a default rate limit of 100 per second.
This solution is written in Python and uses a CloudFormation Template.
This solution expects a CSV file as per the example file. If making changes, please review both Lambda functions.
Prereqs:
- Name of a unique Amazon S3 Bucket to create
- Amazon Pinpoint Project setup
- A short or long code provisioned in Amazon Pinpoint
Organizations in many sectors and verticals have user bases to whom they send transactional SMS messages such as OTPs, Notices, or transaction/purchase confirmations, among other things. Amazon Pinpoint enables customers to send transactional SMS messages to a global audience through a single API endpoint, and the messages are routed to recipients by the service. Amazon Pinpoint relies on downstream SMS providers and Telecom infrastructure to deliver the messages. While most of the times the SMS messages gets delivered to recipients but sometimes these messages could not get delivered due to carrier/telecom related issues which impacts customer’s brand name. As a result, customers must implement a solution that allows them to retry the transmission of SMS messages that fail owing to transitory problems caused by downstream SMS providers or telecom operators.
- Resend any OTP, Confirmation messages that failed get delivered
- Resend transactional messages.
- Resend Important campaigns that are failed due to transient reasons.
- If existing Kinesis stream has pre-defined desination lambda then current strack will not replace it but exit gracefully.
- If existing Kinesis firehose has pre-existing transfromation lambda then current stack shall not replace the current stack.
Endpoints stored in Amazon Pinpoint enable customers to store addresses across multiple channels all connected to each other via a UserId to represent a single user. Endpoints also enable you to store User and Endpoint level attributes to be used in Message personalization and Dynamic Segmentation. This allows for segmentation like "Where [Attribute Name] is [Some Value]". Ex: Select all Email endpoints where the User CustomerStage
is Renewal
and User CustomerValue
is High
.
Some segmentation use-cases call for more advanced segmentation rules where simple attribute matching will not be sufficient. In these cases, we can use customer's existing Data Lakes in Amazon S3 with Amazon Athena as a query engine. With these services, customers can create segments with much more specificity. Ex: Select all Email endpoints where the User has made a purchase of red shoes in the last 3 months and has opened more than 15 emails in the last 9 months and has clicked on the website page showing product details of our upcoming shoe release in the last 24 hours.
To initiate a query, start a step function execution with one of the following Execution Input (Query is JSON escaped):
{
"Query": "SELECT d.endpoint_id AS Id\r\nFROM some_table WHERE some_clause",
"Type": "direct",
"SegmentName": "Some Segment Name",
"SegmentId": "[Previously Imported Segment ID HERE]"
}
{
"Query": "SELECT d.endpoint_id AS Id, 'True' AS \"Attributes.SomeAttribute\"\r\nFROM some_table WHERE some_clause",
"Type": "mutate"
}
Note, queries need to have an output that matches the Pinpoint import file syntax as the examples above show.
Further, the step function can also be scheduled to be run on set intervals to ensure data in Amazon Pinpoint stays up-to-date by using Amazon CloudWatch event rules.
- Advanced segmentation rules
- Utilize existing S3 Data Lakes or any other Athena supported Federated Query Data Source
- Avoid moving data into Pinpoint Attributes that changes frequently
- Amazon S3 as the Data Lake Storage Platform
- Using Amazon Athena Federated Query
- What is Amazon Athena?
- How Step Functions Works
- Adding Endpoints to Amazon Pinpoint
In a typical Marketing Platform, in order to use a value in an email, it must exist inside the Marketing Platform. This typically involves creating Pipeline processes to select, transform, transfer, and load data from source systems into the Marketing Platform at regular intervals to sync it. This causes data latency if the data changes frequently, but can also cause long development delays when Marketers want to onboard new sources of data for use in Campaigns.
With Amazon Pinpoint's CampaignHook functionality, data can be retrieved at the time of Campaign execution from any source via a Lambda function that is called in realtime. The architecture diagram below shows how a Lambda function could be used to fetch a personalized offer from a source data store to be used in the email html without storing the offer in Pinpoint.
- Retrieving data in real time with no latency
- Avoid costly and time consuming ETL processes
- Onboard new attributes dynamically
Amazon Pinpoint has template management functionality to managed your Email, SMS, Push, and Voice templates for your campaigns. Many customers, however, already have content in other systems driven by the needs of the Creative team. Pinpoint is flexible and extensible in that it can fetch whole HTML content from other sources at send time.
With Amazon Pinpoint's CampaignHook functionality, html and subject lines can be retrieved at the time of Campaign execution from any source via a Lambda function that is called in realtime. The architecture diagram below shows how a Lambda function could be used to fetch html from a source data store to be used in the campaign.
- Templates stored in a Content Management System
- Templates managed and owned by separate creative team
- Complex business rules where templates can be internationalized an selected at campaign send time
- Build your own templating engine outside of Pinpoint
NOTE: In the campaign, a message body would need to be used to minimally render the dynamic attribute "html". An example email body would be:
<!DOCTYPE html>
<html>{Attributes.html}</html>
Amazon Pinpoint has a voice channel that can be used to place outbound calls and play a message. Amazon Connect is a separate AWS service that has full call center capabilities. Commonly, customers will want to use Pinpoint's campaign functionality to filter and identify customers to target for an interactive outbound call.
With Amazon Pinpoint's CampaignHook functionality, Amazon Connect can be set up as a custom channel via a Lambda function. The architecture diagram below shows how a Lambda function could be used to initiate a realtime call to Connect to place an outbound call.
It is important to note that this same Lambda Pinpoint CampaignHook feature can be used to build any custom channel. Customers are not limited to other AWS services.
- Appointment Confirmation: You have an appointment soon. Push 1 to confirm, Press 2 to speak to someone about rescheduling
- Automatically connect customers to agents
- Use an advanced IVR system for interactivity with customers
NOTE: This example uses the Pinpoint channel type of SMS. Via the UI, a message can be passed to the Lambda function by providing an SMS message during the Campaign creation process.
This also assumes that an Amazon Connect Instance, Queue, and Contact Flow have been set up and created prior to launching the CloudFormation template. These are required parameters for the template.
- Creating Custom Channels with AWS Lambda
- Automating outbound calling to customers using Amazon Connect
- Connect API - StartOutboundVoiceContact
- IoT Channel Using Amazon Pinpoint
Amazon Pinpoint currently doesn't support attachments when sending emails via Campaigns or Journeys. Customers have to use the Amazon SES SendRawMessage API operation to attach files, which lacks features such as customer segmentation and scheduling. This solution enables marketers to design and schedule Amazon Pinpoint journeys with attachments or pre-signed Amazon S3 URLs without the support of technical resources.
- Monthly bills (specific to the recipient)
- New terms & conditions (same for all)
- Contracts (specific to the recipient)
- Booking confirmation (specific to the recipient)
- e-Tickets (specific to the recipient)
Amazon Pinpoint event streaming capability, utilizes Amazon Kinesis Firehose or Data Streams to stream the raw customer engagement events to an AWS service for further processing or storage. The data can be used to create custom dashboards using Amazon QuickSight or a 3rd party business intelligence tool.
The Amazon Pinpoint streamed events include the Campaign, Journey and Segment Ids but they don't include their names making it challenging for users to identify them when building a custom report.
This solution deploys a series of AWS services using AWS CloudFormation creating two Amazon DynamoDB tables, one stores the mapping between Campaign/Journey Ids and their names while the second one stores the mapping between Segment Ids and their names. To query the Amazon DynamoDB data with Amazon Athena, you can use this connector.
- Custom dashboard development
- Creation of user friendly dahsboards
Chaining the Amazon S3 Triggered Endpoint Imports, Automatic Phone Number Validate, and Automatic Amazon Pinpoint Campaign Creation reference architectures together can create a import pipeline to automatically import files as they land in S3, perform phone number validation on all new numbers, then kick off a campaign automatically.
This library is licensed under the MIT-0 License. See the LICENSE file.