Contacts by Customer ID
Address every contact by a Customer ID that never changes, yours or ours.
The Customer ID
Each contact has a customer_id of 9 digits or more, unique in the organisation and never changed. Every contact route takes it in the path, and every webhook names customers by it.
Create a contact with your own ID to keep one key across your systems. Leave it out and Omnio makes one of 10 digits. A taken ID is 409 customer_id_taken, a short one 422 customer_id_invalid.
curl -X POST https://api.omnio.sawego.com/v1/contacts \
-H "Authorization: Bearer $OMNIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"customer_id": "4829173650", "first_name": "Ama", "phone_e164": "+237690000099"}'
When the person writes
A contact made by the API has no WhatsApp identity yet. When that number first writes, Omnio attaches it to the one contact whose phone_e164 matches and keeps its Customer ID, tags and stage. With no match, or several, it creates a new contact.
Attributes
attributes holds your own fields, checked against the organisation's custom fields. A patch merges keys, and a key set to null is removed. An unknown field is 422 with details.reason unknown_field.
Sending by Customer ID
A send can name the contact and the channel instead of a conversation. A template this way also starts a conversation with someone who never wrote.
{
"channel_id": "0e8d3c1f-7a6b-4b52-9e34-2d1f5c8a9b70",
"customer_id": "4829173650",
"type": "template",
"template": { "name": "transfer_ready", "variables": { "body": ["Ama", "T-42"] } }
}
Deleting and blocking
Delete is soft. The contact keeps its history, leaves the lists and comes back with restore. A blocked contact's messages are stored without a conversation, and nothing is sent to it.