Contacts and Groups
These endpoints ask WhatsApp through the session's linked number, so the session must be connected. They work with the session's API key, or a personal access token plus session_id. WhatsApp answers within a few seconds; if it does not answer in 25 seconds you get 504 runtime_timeout, and errors from WhatsApp come back as 502 whatsapp_error.
Check numbers
Find out which numbers use WhatsApp before you message them:
curl https://api.warsita.com/v1/contacts/check \
-H "Authorization: Bearer $WARSITA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phones": ["+6281234567890", "+6289999999999"]}'
{
"data": [
{ "jid": "6281234567890@s.whatsapp.net", "phone": "+6281234567890", "on_whatsapp": true },
{ "jid": "", "phone": "+6289999999999", "on_whatsapp": false }
]
}
Up to 50 numbers per request. Verified business accounts also have business_name.
Contact info and picture
GET /v1/contacts/{jid}returns a contact'sjid,phone, about text (status) andbusiness_name.{jid}may also be a phone number.GET /v1/contacts/{jid}/picturereturns{"data": {"url": "…"}}, the profile picture's URL, or""when there is none or it is hidden from this number.
Groups
GET /v1/groupslists the groups the number is in, with each group'sjid,name,topic,sizeand whether only admins can send (announce).GET /v1/groups/{jid}returns one group with itsparticipants(jid,phone,is_admin,is_super_admin).
Send to a group by using its jid as to in POST /v1/messages. Changes to a group arrive as the groups.update and group-participants.update webhooks.