Skip to main content

rapidpro@0.5.1

Adaptor

Adaptor.execute(operations) ⇒ Operation

Execute a sequence of operations. Wraps language-common/execute, and prepends initial state.

Kind: static method of Adaptor

ParamTypeDescription
operationsOperationsOperations to be performed.

Example

execute(
create('foo'),
delete('bar')
)(state)

Adaptor.addContact(params, callback) ⇒ Operation

Adds a new contact to RapidPro

Kind: static method of Adaptor
Access: public

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

Example

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

Adaptor.upsertContact(params, callback) ⇒ Operation

Upserts a contact to RapidPro by URN

Kind: static method of Adaptor
Access: public

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

Example

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

Adaptor.startFlow(params, callback) ⇒ Operation

Start a RapidPro flow for a number of contacts

Kind: static method of Adaptor
Access: public

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"]
});

Adaptor.sendBroadcast(params, callback) ⇒ Operation

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

Kind: static method of Adaptor
Access: public

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"]
});