Outbound Message Handler is a utility class that send message to SMS. Following is the Outbound Message Handler interface:
public interface OutBoundMessageHandler { /** * @param message object to be sent * @return message ID return from SMS Gateway, * it can be used to query DLR status * @throws SMSHandlerException */ public String sendMessage(Object message, String toNumber) throws SMSHandlerException; }
UNICOM® Digital Transformation Toolkit (UDTT™) provides one default implementation in the class com.ibm.btt.channel.sms.outbound.BTTOutboundMessageHandler, the application can use the sendMessage() API directly to send SMS message.
Following is the Outbound Message Handler configuration:
ParameterNames Configuration:
Note The value of the field in parameterNames should be mapped correctly with the keywords of the specific SMS gateway.
Following is an example for Outbound Message Handler configuration in application/x-www-form-urlencoded type:
Example of HTTP content in application/www-form-urlencoded type:
Note In the xml/text type, the parameterNames is not mandatory field.
The Outbound Message Handler supports application extension to set the message data format and handle response according to the specific requirement of different SMS gateways. To extend the message data format, you can extend the class com.ibm.btt.channel.sms.outbound.BTTOutboundMessageHandler and override the following method:
In the example above in xml/text type, the extension Outbound Message Handler implementation class is com.ibm.btt.test.MovilgateOutboundMessageHandler, following is the example code:
BTTOutboundMessageHandler provides a default implementation to handle the outbound response from gateway that indicates whether the outbound message sending request is accepted or rejected by gateway. It uses the DLR Configuration to parse the response data and store the delivery status by DLRStore interface. In most cases, the default implementation can fulfill the requirements. Anyway, the application can extend the default implementation method for special requirements.
To extend the response handling, you can extend the class com.ibm.btt.channel.sms.outbound.BTTOutboundMessageHandler and override the following method: