This document describes creating a web application in MuleSoft that allows users to send SMS messages through RingCentral APIs. The web application takes user input for the "To" number, "From" number, and message text. When submitted, it calls a Mule API that authenticates with RingCentral, gets an access token, and uses the RingCentral messaging API to send the SMS. The Mule application then displays a success response page back to the user with the message ID.
2. We have seen in our previous post the way of integrating RingCentral
with MuleSoft and sending SMS messages by consuming RingCentral
APIs.
This post we will create a small web application in MuleSoft using
HTML pages that will be calling RingCentral APIs and will be send SMS.
3. In Anypoint Studio IDE, after we create a new MuleSoft project, we will
be creating HTML that will be providing the interface to the users and
take the input.
5. As we see, we are taking 3 visual input (To, From, Text Message) from
user in HTML form. The user here will put the phone number where
the message will be send as well as the phone number from which the
message will be send. The 3rd parameter message will take the input
SMS message from users. We can also see, once the form is submitted
by users, it will call an Mule API.
6. Next steps will be design the Mule flows that will expose the Mule API
and will be called internally by the user from the web portal. The main
task of this Mule API will be calling RingCentral Authentication API first,
get the access_token from /restapi/oauth/token API , and then call the
messaging API of RingCentral to send SMS.
8. Here we can see, the main flow is using parse template component to
host HTML page in form of web application.
Once the submit button is clicked by users, the input payload will arrive
at SendSMS flow, where it will call RingCentral Authentication API to
get access_token and then use this token while calling messaging API of
RingCentral next to send the SMS message.
The OAuth token flow is kept under Cache to avoid multiple call to the
RingCentral authentication API before the access_token expires.
9. Finally, at the end we need to design our response web application
HTML page to show the successful response message to the web
application users:
10. Here we are showing the successfully message send response along
with message id.
12. Once the web application is deployed in server, we can start our Mule
web application as follow:
13. The web application is asking the users to fill the web form with phone
number from which the SMS will be send and the number where the
message will be delivered. It also provide the user the visual field to
enter their input SMS text.
14. Once users hit submit button, we will see the response from the web
application:
15. As we can see, the message is send successfully using back-end
RingCentral messaging API leaving the user with above response.
The response will display unique message id each time users send a
SMS with successful response.