Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support contact_actions #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions rapid_pro_tools/rapid_pro_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,21 @@ def update_contact(self, urn, name=None, contact_fields=None, groups=None):
"""
return self._retry_on_rate_exceed(lambda: self.rapid_pro.update_contact(urn, name=name,
fields=contact_fields, groups=groups))

def contact_actions(self, contacts, action, group=None):
"""
Perform an action on a set of contacts in bulk.

:param contacts: The contact UUIDs or URNs (array of up to 100 strings)
:type contacts: list of str
:param action: The action to perform, a string one of: add - Add the contacts to the given group, remove - Remove the contacts from the given group,
block - Block the contacts, unblock - Un-block the contacts, interrupt - Interrupt and end any of the contacts' active flow runs,
delete - Permanently delete the contacts.
:type action: str
:param group: The UUID or name of a contact group (string, optional)
:type group: str | None
"""
return self._retry_on_rate_exceed(lambda: self.rapid_pro.contact_actions(contacts, action, group=group))

def get_fields(self):
"""
Expand Down