Skip to main content

rapidpro@1.0.13

Functions

addContact(params, callback)
sendBroadcast(params, callback)
startFlow(params, callback)
upsertContact(params, callback)

The following functions are exported from the common adaptor:

alterState()
dataPath()
dataValue()
each()
field()
fields()
fn()
http()
lastReferenceValue()
merge()
sourceValue()

addContact

addContact(params, callback) ⇒ Operation

Adds a new contact to RapidPro

ParamTypeDescription
paramsobjectdata to create the new resource
callbackfunction(Optional) callback function

Example

addContact({
name: "Mamadou",
language: "ENG",
urns: ["tel:+250788123123"]
});

sendBroadcast

sendBroadcast(params, callback) ⇒ Operation

Sends a message to a list of contacts and/or URNs

ParamTypeDescription
paramsobjectdata to create the new resource
callbackfunction(Optional) callback function

Example

sendBroadcast({
text: "Hello world",
urns: ["twitter:sirmixalot"],
contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"]
});

startFlow

startFlow(params, callback) ⇒ Operation

Start a RapidPro flow for a number of contacts

ParamTypeDescription
paramsobjectdata to create the new resource
callbackfunction(Optional) callback function

Example

startFlow({
flow: "f5901b62-ba76-4003-9c62-72fdacc1b7b7",
restart_participants: false,
contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"]
});

upsertContact

upsertContact(params, callback) ⇒ Operation

Upserts a contact to RapidPro by URN

ParamTypeDescription
paramsobjectdata to upsert a contact
callbackfunction(Optional) callback function

Example

upsertContact({
name: "Mamadou",
language: "ENG",
urns: ["tel:+250788123123"]
});