Messaging
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.
Method | Notes |
---|---|
sendMessage | This method sends messages through RapidPro to the specified contacts. The method has the following params:
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" }
|
createContact | This method creates a contact in RapidPro and accepts a java.util.Map param. In the map the following keys can be added:
Other than the urns, all the other values are optional. This method makes a POST request against Rapidpro /api/v1/contacts.json end point and returns a JSON string contains the details of the contact just added e.g { "uuid": "4686bf60-a241-4b42-8102-27d9221aad5b", "name": "Xcv", "language": null, "group_uuids": [ "bc5ef0d0-ce9d-4b52-adee-649a99927c8b" ], "urns": [ "tel:+254727000000" ], "fields": { "anc1": "2016-10-27", "anc2": "2017-02-16", "anc3": "2017-04-13", "anc4": "2017-05-11", }, "blocked": false, "failed": false, "modified_on": "2016-11-03T07:36:41.494Z", "phone": "+254727812024", "groups": [ "Pregnant Women" ] } |
addField | This method adds a field to RapidPro and has the following params:
This method makes a POST request against Rapidpro /api/v1/contacts.json end point and returns a JSON string contains the details of the contact just added e.g { "key": "anc3", "label": "anc3", "value_type": "T" } . |
deleteContact | This method deletes an existing contact given the UUID. This method makes a POST request against Rapidpro /api/v1/contacts.json end point . |
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
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.