Using two-way SMS communication

SMS two-way communication enables communication between a mobile phone and the MobileFirst Server, over an SMS channel. SMS messages that originate from the mobile device can be sent to the MobileFirst Server through an external SMS gateway. The MobileFirst Server can then send a response message back to the originating mobile device.

Before you begin

To run SMS two-way communication, the mobile device must support SMS functions.

About this task

Keywords or shortcodes should be configured with the third-party SMS gateway. The gateway should be configured to forward SMS messages to the SMS servlet of the MobileFirst Server, either directly or through a reverse proxy URL, based on the topology in your environment:

http://hostname:port/context/receiveSMS

The SMS messages that are sent from mobile phones are forwarded to an adapter procedure on the MobileFirst Server, which is configured by the developer. The adapter procedure can include the logic to process the request, or the procedure can forward the request to a back-end system for processing. The response is returned by using the MobileFirst notification framework. For more information, see Push notification.

The two-way SMS architecture is summarized in the following figure:

Figure 1. Two-way SMS architecture
Diagram showing two-way SMS architecture
  1. The adapter registers SMS event handlers on the MobileFirst Server.
  2. SMS messages are sent from mobile devices to the SMS gateway, which is configured with an SMS servlet of MobileFirst Server.
  3. The SMS gateway forwards SMS messages to a configured MobileFirst URL.
  4. An SMS servlet on MobileFirst Server matches the parameters with filters that are defined in SMS event handlers, and calls an adapter callback procedure.
  5. The adapter processes SMS messages and sends an SMS message to the mobile device by using the SMS API.

You use a series of server API methods to send and receive SMS messages:

WL.Server.createSMSEventHandler
Create an SMS event handler.
WL.Server.setEventHandlers
Set event handlers to implement callbacks for received events.
WL.Server.subscribeSMS
Subscribe a phone number to the specified event source.
WL.Server.unsubscribeSMS
Unsubscribe the phone number from the specified event source.
WL.Server.getSMSSubscription
Return an SMS subscription object for a phone number.