How to Join or Leave a Group
Group membership is managed by by the group_contact.php endpoint.
Add a Person to a Group
To add a person to a group, you will need to obtain the hash identifier for the contact and group. Once these are obtained, pass the contact_hash and the group_hash to the groupContact.php endpoint.
curl --request POST \
--url https://api.textinchurch.com/API/1_0/groupContact.php \
--header 'accept: application/json' \
--header 'authorization: Bearer <<api_key>>' \
--data contact_hash="YMKiGjtmhEvCoBAXkwNZ" \
--data group_hash="RdXt4fleaLTW3XknoJkn" RESPONSE:
{
"group_contact_id": "23178506",
"hash": "PkhFmQWjKQ5r9RuHbkZQ",
"group_id": "203002",
"contact_id": "7059942",
"group_contact_source": "User",
"group_contact_create_date": "2024-01-01 20:21:32",
"group_contact_remove_date": "0000-00-00 00:00:00",
"group_contact_removed_by_sync": "0"
}Remove a Person from a Group
To remove a person from a group, you can make a DELETE request to the groupContact.php endpoint and pass either (1) the hash of the groupcontact record or (2) the the_contact_hash and the group_hash. As a note, this does not remove the record. Rather, it will set the group_contact_remove_date property to the current date. This will indicate the person has been removed from the group while still maintaining a record of what happened. If the contact is added again, a new record will be created. There will always be one record representing the enrollment of the person in a group, however, there may be multiple records representing people leaving a group.
curl --request DELETE \
--url https://api.textinchurch.com/API/1_0/groupContact.php \
--header 'accept: application/json' \
--header 'authorization: Bearer <<api_key>>' \
--data hash="WFPiGktyhE7CoTAgk4N1"RESPONSE:
{
"group_contact_id": "23178506",
"hash": "PkhFmQWjKQ5r9RuHbkZQ",
"group_id": "203002",
"contact_id": "7059942",
"group_contact_source": "User",
"group_contact_create_date": "2024-01-01 20:21:32",
"group_contact_remove_date": "2024-08-15 14:17:59",
"group_contact_removed_by_sync": "0"
}Updated 12 months ago