Reduce costs and enable integrated SMS tracking with Braze URL shortening
AWS Architecture BlogReduce costs and enable integrated SMS tracking with Braze URL shorteningby Umesh Kalaspurkar, Donnie Kendall, and Ian Abels | on01 SEP 2023| inAmazon DynamoDB,Amazon DynamoDB Accelerator (DAX),Amazon VPC,Architecture|Permalink|Comments|ShareAs competition grows fiercer, marketers need ways to ensure they reach each user with personalized content on their most critical channels. Short message/messaging service (SMS) is a key part of that effort, touching more than 5 billion people worldwide, with an impressive 82% open rate. However, SMS lacks the built-in engagement metrics supported by other channels.To bridge this gap, leading customer engagement platform,Braze, recently built an in-house SMS link shortening solution usingAmazon DynamoDBandAmazon DynamoDB Accelerator(DAX). It’s designed to handle up to 27 billion redirects per month, allowing marketers to automatically shorten SMS-related URLs. Alongside theBraze Intelligence Suite, you can use SMS click data in reporting functions and retargeting actions. Read on to learn how Braze created this feature and the impact it’s having on marketers and consumers alike.SMS link shortening approachMany Braze customers have used third-party SMS link shortening solutions in the past. However, this approach complicates the SMS composition process and isolates click metrics from Braze analytics. This makes it difficult to get a full picture of SMS performance.Figure 1. Multiple approaches for shortening URLsThe following table compares all 3 approaches for their pros and cons.Scenario#1 – Unshortened URL in SMS#2 – 3rd Party Shortener#3 – Braze Link Shortening & Click TrackingLow Character CountX✓✓Total ClicksX✓✓Ability to Retarget UsersXX✓Ability to Trigger Subsequent MessagesXX✓With link shortening built in-house and more tightly integrated into the Braze platform, Braze can maintain more control over their roadmap priority. By developing the tool internally, Braze achieved a 90% reduction in ongoing expenses compared with the $400,000 annual expense associated with using an outside solution.Braze SMS link shortening: Flow and architectureFigure 2. SMS link shortening architectureThe following steps explain the link shortening architecture:First, customers initiate campaigns via the Braze Dashboard. Using this interface, they can also make requests to shorten URLs.The URL registration process is managed by a Kubernetes-deployed Go-based service. This service not only shortens the provided URL but also maintains reference data in Amazon DynamoDB.After processing, the dashboard receives the generated campaign details alongside the shortened URL.The fully refined campaign can be efficiently distributed to intended recipients through SMS channels.Upon a user’s interaction with the shortened URL, the message gets directed to the URL redirect service. This redirection occurs through an Application Load Balancer.The redirect service processes links in messages, calls the service, and replaces links before sending to carriers.Asynchronous calls feed data to a Kafka queue for metrics, using the HTTP sink connector integrated with Braze systems.The registration and redirect services are decoupled from the Braze platform to enable independent deployment and scaling due to different requirements. Both the services are running the same code, but with different endpoints exposed, depending on the functionality of a given Kubernetes pod. This restricts internal access to the registration endpoint and permits independent scaling of the services, while still maintaining a fast response time.Braze SMS link shortening: ScaleRight now, our customers use the Braze platform to send about 200 million SMS messages each month, with peak speeds of around 2,000 messages per second. Many of these messages contain one or more URLs that need to be shortened. In order to support the scalability of the link shortening feature and give us room to grow, we designed the service to handle 33 million URLs sent per month, and 3.25 million redirects per month. We assumed that we’d see up to 65 million database writes per month and 3.25 million reads per month in connection with the redirect service. This would require storage of 65 GB per month, with peaks of ~2,000 writes and 100 reads per second.With these needs in mind, we carried out testing and determined that Amazon DynamoDB made the most sense as the backend database for the redirect service. To determine this, we tested read and write performance and found that it exceeded our needs. Additionally, it was fully managed, thus requiring less maintenance expertise, and included DAX out of the box. Most clicks happen close to send, so leveraging DAX helps us smooth out the read and write load associated with the SMS link shortener.Because we know how long we must keep the relevant written elements at write time, we’re able to useDynamoDB Time to Live(TTL) to effectively manage their lifecycle. Finally, we’re careful to evenly distribute partition keys to avoid hot partitions, and DynamoDB’s autoscaling capabilities make it possible for us to respond more efficiently to spikes in demand.Braze SMS link shortening: FlowFigure 3. Braze SMS link shortening flowWhen the marketer initiates an SMS send, Braze checks its primary datastore (a MongoDB collection) to see if the link has already been shortened (see Figure 3). If it has, Braze re-uses that shortened link and continues the send. If it hasn’t, the registration process is initiated to generate a new site identifier that encodes the generation date and saves campaign information in DynamoDB via DAX.The response from the registration service is used to generate a short link (1a) for the SMS.A recipient gets an SMS containing a short link (2).Recipient decides to tap it (3). Braze smoothly redirects them to the destination URL, and updates the campaign statistics to show that the link was tapped.UsingAmazon Route 53’s latency-based routing, Braze directs the recipient to the nearest endpoint (Braze currently has North America and EU deployments), then inspects the link to ensure validity and that it hasn’t expired. If it passes those checks, the redirect service queries DynamoDB via DAX for information about the redirect (3a). Initial redirects are cached at send time, while later requests query the DAX cache.The user is redirected with a P99 redirect latency of less than 10 milliseconds (3b).Emit campaign-level metrics on redirects.Braze generates URL identifiers, which serve as the partition key to the DynamoDB collection, by generating a random number. We concatenate the generation date timestamp to the number, then Base66 encode the value. This results in a generated URL that looks like https://brz.ai/5xRmz, with “5xRmz” being the encoded URL identifier. The use of randomized partition keys helps avoid hot, overloaded partitions. Embedding the generation date lets us see when a given link was generated without querying the database. This helps us maintain performance and reduce costs by removing old links from the database. Other cost control measures include autoscaling and the use of DAX to avoid repeat reads of the same data. We also query DynamoDB directly against a hash key, avoiding scatter-gather queries.Braze link shortening feature resultsSince its launch, SMS link shortening has been used by over 300 Braze customer companies in more than 700 million SMS messages. This includes 50% of the total SMS volume sent by Braze during last year’s Black Friday period. There has been a tangible reduction in the time it takes to build and send SMS. “The Motley Fool”, a financial media company, saved up to four hours of work per month while driving click rates of up to 15%. Another Braze client utilized multimedia messaging service (MMS) and link shortening to encourage users to shop during their “Smart Investment” campaign, rewarding users with additional store credit. Using the engagement data collected with Braze link shortening, they were able to offer engaged users unique messaging and follow-up offers. They retargeted users who did not interact with the message via other Braze messaging channels.ConclusionThe Braze platform is designed to be both accessible to marketers and capable of supporting best-in-class cross-channel customer engagement. Our SMS link shortening feature, supported by AWS, enables marketers to provide an exceptional user experience and save time and money.Further reading:Braze SMS Marketing 101Braze SMS Link Shortening DocsUmesh KalaspurkarUmesh is a Sr Solutions Architect at AWS, and brings more than 20 years of experience in design and delivery of Digital Innovation and Transformation projects, across enterprises and startups. He is motivated by helping customers identify and overcome challenges. Outside of work, Umesh enjoys being a father, skiing, and traveling.Donnie KendallDonnie is a Sr Software Engineer at Braze, and has over a decade of experience building highly scalable software, both in the cloud and on-premises. Outside of work, Donnie enjoys being a father, traveling, and playing the sax.Ian AbelsIan is a Product Manager at Braze, and brings a pragmatic approach to product development. He comes from an engineering background, and has helped onboard a number of the largest Braze customers. In his spare time, Ian enjoys reading and playing music.CommentsView Comments
As competition grows fiercer, marketers need ways to ensure they reach each user with personalized content on their most critical channels. Short message/messaging service (SMS) is a key part of that effort, touching more than 5 billion people worldwide, with an impressive 82% open rate. However, SMS lacks the built-in engagement metrics supported by other […]
Umesh Kalaspurkar
Amazon DynamoDB Amazon DynamoDB Accelerator (DAX) Amazon VPC Architecture