ContactService

public interface ContactService

A service for CRUD operations on Contact. Provides an interface to perform CRUD operations on Rapidpro Contacts, including mapping from an external ID to a Rapidpro UUID and communications over HTTP with Rapidpro.

Methods

addToGroup

void addToGroup(String externalId, String groupName)

Adds a contact to a group

Parameters:
  • externalId – The external ID mapping to a Rapidpro contact UUID.
  • groupName – The name of the Rapidpro group.

create

void create(String externalId, String phone, Contact contact)

Creates a new Contact in Rapidpro and a mapping from an external ID to a Rapidpro UUID.

Parameters:
  • externalId – The external ID used to map to a Rapidpro Contact
  • phone – The unique phone number of the Contact
  • contact – Object containing the necessary fields to create a new Contact

delete

void delete(String externalId)

Deletes a contact in Rapidpro

Parameters:
  • externalId – The external ID mapping to a Rapidpro UUID

findByExternalId

Contact findByExternalId(String externalId)

Finds a contact by its external ID, if it exists.

Parameters:
  • externalId – The external ID mapping to a Rapidpro UUID.
Returns:

Contact

removeFromGroup

void removeFromGroup(String externalId, String groupName)

Removes a contact from a group.

Parameters:
  • externalId – The external ID mapping to a Rapidpro contact UUID.
  • groupName – The name of the Rapidpro group.

update

void update(String externalId, Contact contact)

Updates a contact in Rapidpro

Parameters:
  • externalId – The external ID mapping to a Rapidpro UUID
  • contact – Object containing the fields to update a Contact.