22.5. SMS Service

SMS Service is a generic service used for sending/receiving SMS. Any other DHIS2 module can include this service and utilize it to send and receive SMS from users or workers in the field.

22.5.1. Setting up SMS service

There are few pre-requisites in order to make this service functional. There are two ways to complete these steps. One way is to configure gateway from the GUI in Mobile Configuration Module. The other way is to use SMS Web Api.

  • Configure SMS Gateway

22.5.1.1. Configure SMS Gateway

There are five different types of Gateways supported by SMS Service. SMS can be sent if any one of the gateway is configured. If more than one gateways are present, then they will be used in round-robin fashion for load balancing. There are different parameters for different type of gateway. The Gateway can be configured in GUI in Mobile Configuration Module as shown in the figure. More information about parameters needed to configure gateway can be found in Gateway Configuraitons

22.5.1.2. Configure GenericHttp Gateway

Many DHIS2 instances are using GenericHttpGateway to connect to their local gateways. These local gateways provides HTTP APIs for sending SMS. In new GenericHttpGateway it is now possible to configure url parameters provided in their APIs. For example http://gateway.com/sendMessage?username=AA&password=xxxxx&message=testing&msisdn=9999. In this url username, password, message, msisdn are parameters that are required by external gateways. Now in GenericHttp these parameters are configurable which was not possible in previous releases. Making is configurable will help DHIS2 to interact with other gateways which have different url formats.

22.5.2. Gateway Configurations

Below table shows the parameters required for configuring gateway.

Table 22.3. Gateway Configuration Parameters

ParameterBulkSMS GatewayClickatell GatewayGeneric HTTP GatewayDescription
Gateway NameOptionalOptionalOptionalUsed as gateway identity. Default name will be stored in case this parameter is not configured. Its use is recommended
User NameRequiredRequiredRequiredUsed for API authentication
PasswordRequiredRequiredRequiredUsed for API authentication
Auth-TokenN/ARequiredN/AUsed for API authentication
MessageParameterN/AN/ARequiredMessage query parameter. For example http://gateway.com?message=Hi
RecipientParameterN/AN/ARequiredRecipient query parameter. For example http://gateway.com?phoneNumber=47XXXXX
URL TemplateN/AN/ARequiredUrl Tempalte is only required in case of GenericHttpGateway . For example "http://smsgatewa1.com"