Send SMS Using Only Native SAP Commerce Libraries with Twilio API

Hi Everyone!

I hope everyone is doing well.

It's no surprise that SMS delivery messages are an important communication channel for B2B and B2C customers. Customers expect to receive opted-in SMS-based notifications, as well as, email-based notifications for order tracking and delivery. Recently, I built a Groovy script to send customer-facing SMS-Based delivery notifications using the Twilio SMS API.  I decided to leverage out-of-the-box Java libraries that are natively bundled with SAP Commerce instead of adding the Twilio JAR library to the client's long list of custom libraries already used in its SAP Commerce implementation.

If you are a regular reader of, you know that I tend to rely on Groovy for developing scheduled programming tasks. Of course, I decided to develop the SMS-based delivery notification with Groovy.

The HttpURLConnection class was used to communicate with the Twilio SMS API instead of using the Twillio JAR library.  It was quite easy to connect with the Twilio API using the HttpURLConnection. That said, I had some issues sorting out the 400 Bad Request HTTP Status Codes that I continuously received from Twilio early in the integration process.

A partial screen capture of the Groovy script:

The complete Groovy script can be purchased for $8.00 USD.

Buy Now to Download the Script/Code: 8.00 USD

I hope you find this file useful.

If you have any questions, please email me at:

Thank You,

Marc Raygoza

Marc is the Founder of
He enjoys helping others learn more about SAP Commerce Cloud (Hybris). Marc is a SAP Commerce Certified Professional and has held the role of SAP Commerce Cloud Architect at Deloitte, PwC, Brillio (a Bain Company), and Nasty Gal. Marc holds an M.S. Software Engineering from Carnegie Mellon University and a B.S. in Accountancy from California State University, Fresno. He can be reached at:

You may also like...

Popular Posts