RapidPro Integration in OpenSRP-DGHS, BD Example


OpenSRP-DGHS vaccination app sends two types of messages to beneficiaries/clients (Woman, Child) using Rapidpro.

1. Reminder Messages: Schedule SMS is sent to the beneficiaries based on the Camp/Session date (and also based on vaccine eligibility date of the beneficiary), which is pre-defined from the camp definition web portal.

2. Announcement Messages: There is a bulk SMS sending option integrated in the OpenSRP-DGHS app end, so that the HA (health assistant) can send ‘Announcement Message’ to all the beneficiaries who has a Due vaccine date on that day by a single click.

  Figure: High Level Diagram of OpenSRP-DGHS Integration with Rapidpro


Technical Descriptions:

Reminder Messages

A task scheduler job runs in OpenSRP server once in a day which invoke

class="org.opensrp.web.listener.CampListener"

Method Name

Descriptions

method="campRemainderListener"

This listener method find out all upcoming active vaccination camp dates in system. Next it call method “sentMessageToClient”

method="sentMessageToClient"

Find out all eligible beneficiaries, their type (child/woman) and mobile no who should come to take vaccine on these camp date/dates . Next call forward to method “sentMessage” which through rapid-pro service delivered SMS to end beneficiaries.

class="org.opensrp.service.MessageService.java"


method="sentMessage"

Validate mobile number and this method sends messages through RapidPro to the specified contacts. The method has the following params:

  • urns- This is a list of URNS to send messages to e.g ["tel:+250788123123","tel:+250788123124"] for telephone numbers or ["telegram:207355745"]
    for telegram accounts

  • contacts- This is a list of the contact uuids from RapidPro

  • groups- A list of group uuids to send message to

  • text- The text message to the user. Should be less than 480 characters

  • channel- The id of the RapidPro channel to use

Either of urns, contacts or groups is required since they contain the message recipient(s). This method makes a POST request against  Rapidpro /api/v1/broadcasts.json end point and returns a JSON

string with the sent message details e.g

{

    "id": 1234,

    "urns": ["tel:+250788123123", "tel:+250788123124"],

    "contacts": ["09d23a05-47fe-11e4-bfe9-b8f6b119e9ab"]

    "groups": [],

    "text": "hello world",

    "created_on": "2013-03-02T17:28:12",

    "status": "Q"

}



Announcement message:

A button is available in OpenSRP vaccination app which health assistant (HA) pressed to send vaccination camp announcement messages to their beneficiaries.

This basically invoke a controller method in server.

class="org.opensrp.web.controller.CampController.java"

Method Name

Descriptions

method="campAnnouncement"

This directs call to campAnnouncementListener(String HA) for current health assistant.

class="org.opensrp.web.listener.CampListener"

Method Name

Descriptions

method="campAnnouncementListener"

This method find all available vaccination camp dates which are active for that health worker. Next it call method “sentMessageToClient”

method="sentMessageToClient"

Find out all eligible beneficiaries, their type (child/woman) and mobile no who should come to take vaccine on these camp date/dates . Next call forward to method “sentMessage” which through rapid-pro service delivered SMS to end beneficiaries.

method="sentMessage"

See method description above.


Related Source Links:

1.https://github.com/OpenSRP/opensrp-server/blob/BD-vaccination/opensrp-web/src/main/webapp/WEB-INF/web.xml

2.https://github.com/OpenSRP/opensrp-server/blob/BD-vaccination/opensrp-web/src/main/java/org/opensrp/web/controller/CampController.java

3.https://github.com/OpenSRP/opensrp-server/blob/BD-vaccination/opensrp-web/src/main/java/org/opensrp/web/listener/CampListener.java

4.https://github.com/OpenSRP/opensrp-server/blob/BD-vaccination/opensrp-web/src/main/java/org/opensrp/service/MessageService.java

5. https://smartregister.atlassian.net/wiki/display/Documentation/Messaging