How do I setup SMS notification for TEI users with Generic Configuration?

I know this topic has been asked a lot but I couldn’t find a clear instructions in the community nor from the documentation.

I want to setup SMS notification for TEI subscribers to our Tracker Program to notify them of ANC visits and vaccination appointments date. My inquiry is in two parts as it relate with the SMS configuration and Program notification setup.

Gateway configuration
I am using the Generic Gateway.

  1. The Configuration template* is a compulsory field. But I don’t know what should go into this field. In examples I saw, there is key/value parameters setup as a string. But I don’t know which of the parameters is being used. My SMS provider use (username and apiKey, content-type) in headers and (to, from, message) in the body of the request. How do I set the values for the keys I am using from the parameters.

  2. Send url parameters. Do I need to click this checkbox?

  3. Key value pairs. For this I added the apiKey and username as header message. Do I need to create a key/value pair for the message body parameters of the API? If so where do I get what I put as value?

Do I need to setup command? If I have to which type should I choose. I read in the documentation that it is Data collection for program stage. (TEI is identified based on phoneNumner). Where do I get the phoneNumner from. What I really want is to send a SMS to the TEI when they enroll in the program and reminders for future appointments.

Tracker Program Notification
I setup a Tracker Program. In the step 6 Program stage notification, I setup the reminder notifications. But I need clarification in two parts.

  1. When to send it. I select Days scheduled (due date). How do I set this due date?

  2. Who to send it. Here I select Tracked entity instance. And I tick the SMS box which I hope is correct.

  3. I am also confused on how to setup the recipient number

1 Like

Hi @jetisco4u

Thanks for the post! This probably requires an expert on the SMS configurations or at least someone who’ve tested the functionality. Will look for help,

while I search for insights probably from @zubair, if you do test things, please share your experience!


1 Like

I still hope to get some help on this

1 Like

Please @stephocay can you help?

@ejimba can you help provide an insight pls on your own implementation

In the implementation documentation of my SMS service provider,
we have example for Curl, Java, Node, Python, Ruby, PHP.

The Curl method is as below

curl -X POST
-H ‘Accept: application/json’
-H ‘Content-Type: application/x-www-form-urlencoded’
-H ‘apiKey: MyAppApiKey’
-d ‘username=MyAppUsername&to=%2B254711XXXYYY,%2B254733YYYZZZ&message=Hello%20World!&from=myShortCode’

Can any of these or the Curl method be adapted to the generic gateway configuration?

Hi @jetisco4u

Sorry you’ve not found a solution yet. For a learner/beginner on using SMS, there will probably be a lot of questions and testing. Since I have not experimented on this as well, it’s a bit of a challenge. I have sent your requests to @zubair

I have a question please is the POST request above is to send a message from the user to the DHIS2 instance or from the DHIS2 instance to the user? What would the request from DHIS2 to the gateway be like?


The POST request is supposed to be an outbound message from DHIS2 instance to the recipient.

I want to be able to send automatic SMS reminders to users enrolled in the Tracker Program.

In the Maintenance App under Program menu, I selected a Tracker program and go to step 6 under Notification. Then I did made the following settings for Program Stage Notification.

  1. What to send

  2. When to send it.

  3. Who to send it to.

So I was thinking that 1 day to the schedule date for visit, the user will receive the SMS template alert. I was expecting that the recipient number will be the phone number registered by the user.

My challenge is I don’t know how this connect to the Gateway. My SMS provider said I can send an SMS in the format:

Curl -v -H ‘Content-Type: application/json’ -H ‘Accept: application/json’ -H ‘apiKey:XXXX’ -X POST ‘’ -d ‘{“message”:“Testing JSON endpoint.”,“phoneNumbers”: [“+254ZZZZ”],“username”:“YYYY”,“senderId”:“XYZ” }’


DHIS2 support both type of API requests ( which you have shared in the recent post ). What is the error you are receiving in gateway response?


I am not getting the message in the gateway. First I don’t know how to configure the default Gateway setup to pick the message and recipient number from the Maintenance app. Especially how to setup the parameters in the gateway setup to automatically replace the parameters with the correct values from the Maintenance app.

1 Like