Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This integration involves using RapidPro for messaging reminders to clients either through campaigns or direct messages from OpenSRP.  e.g When a pregnancy surveillance form is submitted and the woman involved has a phonenumber, a new contact is created in RapidPro for the woman and the woman enrolled in the Pregant Women group. Once the woman is added to the pregnant women group, she's enrolled into an ANC campaign whereby she receives SMS reminders through her mobile phone to remind her about ANC visits when due. This integration is supported by the functionality at org.opensrp.connector.rapidpro.RapidProService in the opensrp-connector module. The table below highlights the main methods in the class.

MethodNotes
sendMessage

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

Code Block
languagejs
{
    "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"
}






createContactThis method creates a contact in RapidPro and accepts a java.util.Map param.
addField
deleteContact


NB: To be able to use RapidPro within OpenSRP update opensrp.properties  the property rapidpro.url with your RapidPro server installation url, rapidpro.token with the your RapidPro REST API authentication token