DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. MuleSoft Integration With Twilio

MuleSoft Integration With Twilio

Learn how to integrate the cloud communication platform Twilio with MuleSoft, and configure and use it to create a demo app.

Ashish Goyal user avatar by
Ashish Goyal
·
Oct. 03, 17 · Tutorial
Like (4)
Save
Tweet
Share
4.84K Views

Join the DZone community and get the full member experience.

Join For Free

Twilio is a cloud communication platform which allows applications to send and receive text messages, make and receive phone calls by exposing the APIs. MuleSoft provides a Twilio connector which is available on Anypoint Exchange to integrate apps developed in Anypoint Studio. You can use the steps in this post to configure Twilio and develop a demo app.

To start the integration with Twilio, please download the Twilio connector from the exchange.

To connect with Twilio, you should have an active account with Twilio.com. For demo purposes, Twilio allows developers to create a free trial account. 

Once you create a trial account, you can login to your account and can find the details required to configure the Twilio connector. Go to Twilio Dashboard (twilio.com/console) to find the Account SID and Auth Token.

Image title

Go to the Phone Numbers page to create a phone number from which the SMS will be sent in this demo.

Image title

Verify your caller ID under Verified Called IDs. Twilio APIs will allow sending an SMS only to verified caller IDs.

Image title

To start, create a new Mule project. Please drag and drop the connectors as shown in the below flow:

Image title

Once you have all the pallettes, use the following configs-

HTTP: Port 8091, path:  /send/{toNumber} 

Transform message:

% dw 1.0
 % output application / java
 -- - {
  body: "Message from mulesoft via Twilio",
  from: "${fromNumber}",
  to: inboundProperties.
  'http.uri.params'.toNumber
 }
as: object {
 class: "org.mule.modules.twilio.pojo.sendmessagerequest.MessageInput"
}

Twilio connector:

Click the green plus sign to the right of "Connector Configuration" and set the fields as shown in the below example.

Provide the AccountSid and Authtoken which we got from the Twilio account. Use this URL to configure API URL:  https://api.twilio.com/2010-04-01. This was the latest URL when this blog was written, it may change.

Image title

Use Test Connection to test the connectivity, to see if the connector is able to connect to Twilio successfully.

The operation will be "Send Message" as this demo is for sending an SMS. 

Entity Reference: #[payload] 

Image title

As we have configured all components, our app is ready to be deployed and tested. Just run it and deploy it on your Mule Runtime env. 

Image titleNow your app is ready to send an SMS through Twilio. If you open your browser and hit http://localhost:8091/send/9726932341, you will see the following page: 

Image title

You will receive the SMS on your phone:

Image title

For new Mule learners, try this example to get started. Also, explore the Anypoint Exchange to see other resources you can leverage.

Please refer to this video for a live demo.

Integration MuleSoft

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Fargate vs. Lambda: The Battle of the Future
  • What’s New in Flutter 3.7?
  • What Is Continuous Testing?
  • What’s New in the Latest Version of Angular V15?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: