This post is a reply to the IFS forum discussion which questioned about SMS integration with IFS. I did a simple POC for this and surprisingly it worked so I thought it will be a good post to return to my blog after some time.
Clickatell is world leading SMS platform and supported in many countries and it has a very easy to use REST/HTTP API to send the messages. This guide is based on following parts
- Clickatell REST API
- IFS Application 10 UPD6 REST Sender
- IFS Custom Events
We start by setting up the Clickatell account and the SMS integration first
Setting up Clickatell Configurations
- Create a new Clickatell account
- Add a Test Phone, provide mobile number you need to send the SMS.
- Create SMS HTTP API. Use following values for settings
- API Type: REST
- Messaging type: One-way messaging
- Delivery type: Time Critical
- Note down the API key
IFS Setup to Send SMS to Notify Customer Order Status Change
Our use case is to send a SMS to a user upon customer order status is changed. We start by setting the IFS Connect configurations required to send the SMS.
- Routing Address, Create New. Choose destination type as REST. Root end point : https://platform.clickatell.com/messages
- Routing Rules/Outbound, Create New
- Route From: Application Message
- Queue: OUT1
- Content based condition, set
MESSAGE_FUNCTION = SMSWe will use this in the next step
- Set the Address created previously as main address
That’s basically required as the Integration setup to send the SMS from IFS. Now we need to build our use case, sending SMS on Customer Order Status Change. To keep things simplify, we use Reference field in Customer Order to fill the mobile number of the receiver. In a real scenario, this could be a comm method of the customer contact.
Custom Event Setup
Custom Event Action Setup
Code for the action:
DECLARE bxml_ CLOB; BEGIN bxml_ := '<SendMessageRequest>' || '<Content>' || 'Your Order ' || '&NEW:ORDER_NO' || ' is now ' || '&NEW:ROWSTATE' || '.' || CHR(10) || 'IFS Demo 10' || '</Content>' || '<To>' || '&NEW:CUST_REF' || '</To>' || '</SendMessageRequest>'; plsql_rest_sender_API.Call_Rest_EndPoint(rest_service_ => 'SMS', xml_ => bxml_, callback_func_ => 'P_L_S_Q_L_Rest_Test_API.REST_callback_Test', http_method_ => 'POST', http_req_headers_ =>'Content-Type: application/xml,Accept: application/xml,Authorization: YOURAPIKEY'); END;
Note that the
rest_service_ parameter in
plsql_rest_sender_API.Call_Rest_EndPoint is set to
SMS, which we used in the routing rule as MESSAGE_FUNCTION.
More information regarding the message context and the Clickatell HTTP POST message content can be found here.
Now we are completed with the setup. Create a new Customer Order and update the Reference field with the mobile added as the Clickatell Test Phone. Process Order. Notifications will receive upon status changes of the order.
This has been a good test to check the capabilities of the REST Sender which is new in IFS10. There are many possibilities with this and best this is you don’t need any customisation to build the integrations.