E-Commerce Alerts With Twilio and Kentico
Time to read: 3 minutes
My shopping list has a hierarchy. There are certain things I don’t need to track moment by moment — except for coffee. I need to track that inch by inch as it travels from (preferably) Reko, Ethiopia (if I’m buying Yirgacheffe). I also want an invoice of my order form as quickly as possible. The easiest way to do that is by sending a text.
If you’re running a popular coffee operation like my favorite caffeine purveyor, Black Cat, is, you can’t send all those text messages manually. You have to do it at scale, programatically.
Bryan Soltis from Kentico shows you how to build e-commerce alerts with Twilio SMS using just a few lines of code.
Setting Up E Commerce Text Alerts With Twilio And Kentico
Communication is the key to any good user experience. When a customer interacts with your site, you want to be sure you deliver information quickly and efficiently in the way the user wants to receive it. Twilio simplifies communication by allowing you a simple, clean solution for sending SMS messages to your visitors. In this blog, I’ll show you how I integrated Twilio into a Kentico EMS Marketing Automation process to send order details when a purchase is completed on the site.
Getting Set Up
For my demo, I utilized Kentico’s E-commerce demo site. This sample application demonstrates how
developers can implement Kentico to build a full-featured, robust e-commerce website. I also leveraged Kentico’s Marketing Automation, part of the Enterprise Marketing Suite (EMS), to automate the notification process. I created a process executed any time a user purchases a product on the site, and I created a trigger for when a user completes the purchase to start my new process.
The process contains a custom Marketing Automation action named “Twilio Notification”. This will be a reusable component I can use throughout my site anywhere I want to send SMS notifications.
Twilio Integration
After creating my Kentico site, the next step in the process was to integrate with Twilio. This was an extremely simple process, thanks to the available NuGet package for bringing in the Twilio API.
After adding the package, I added a simple call to Twilio to create a client and send the message.
The Marketing Automation action accepts a couple of parameters I use to set up the Twilio client and message. I added a couple of strings to hold my Twilio API key and “from” number. Lastly, I added a flag for my action to log it to the Kentico Event Log, if needed.
Tying It Together
Now that my Marketing Automation action was created and integrated with Twilio, all that was left was to tie it into my Marketing Automation process. I populated the action parameters with the appropriate values that will be passed to the Twilio integration.
Let’s Test It
With the custom code and configuration in place, it was time to test my functionality. I completed a purchase on the site.
After the purchase, I confirmed that I received the SMS message with the appropriate text.
Lastly, I confirmed that the event details were written to the Kentico Event Log.
Moving On
In this blog, you can see just how easy it is to empower your Kentico site with Twilio and a few lines of code. By extending Kentico EMS’s capabilities with Twilio notifications, I quickly created a great new channel for communication with customers. Because the Marketing Automation action was created for universal use, this functionality could easily be added to any other Marketing Automation process where notifications need to be sent. Future enhancements could include leveraging Twilio callback functionality to notify the site when an SMS message is received.
I hope you enjoyed this article. If you would like to know more about Kentico Marketing Automation, please click here.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.