Skip to main content

Contacts

Endpoints

MéthodeEndpoint
GET/api/v1/contacts
POST/api/v1/contacts
GET/api/v1/contacts/{id}
PUT/api/v1/contacts/{id}
DELETE/api/v1/contacts/{id}
POST/api/v1/contacts/bulk-delete

Paramètres

POST /api/v1/contacts

ChampTypeRequisEmplacementDescription
namestringouibodyNom complet
phonestringouibodyNuméro E.164
tagsstring[]nonbodyTags du contact
metaobjectnonbodyMétadonnées libres

PUT /api/v1/contacts/{id}

ChampTypeRequisEmplacementDescription
idUUIDouipathID du contact
namestringnonbodyNouveau nom
phonestringnonbodyNouveau numéro
tagsstring[]nonbodyRemplace les tags
metaobjectnonbodyRemplace les métadonnées

POST /api/v1/contacts/bulk-delete

ChampTypeRequisEmplacementDescription
contactIdsUUID[]ouibody1 à 500 IDs

Créer un contact

curl -X POST https://srv.msgflash.com/api/v1/contacts \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Awa Doe",
    "phone": "+22901000000",
    "tags": ["vip", "newsletter"],
    "meta": {
      "city": "Cotonou"
    }
  }'

Supprimer plusieurs contacts

curl -X POST https://srv.msgflash.com/api/v1/contacts/bulk-delete \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "contactIds": ["CONTACT_UUID_1", "CONTACT_UUID_2"]
  }'
Exemple de réponse :
{
  "data": {
    "requested": 2,
    "deleted": 1,
    "notFound": ["CONTACT_UUID_2"]
  }
}

Erreurs courantes

CodeHTTPQuand
VALIDATION_ERROR400Body invalide
NOT_FOUND404Contact demandé introuvable

Groupes de contacts

Endpoints

MéthodeEndpoint
GET/api/v1/contacts/groups
POST/api/v1/contacts/groups
GET/api/v1/contacts/groups/{groupId}
PUT/api/v1/contacts/groups/{groupId}
DELETE/api/v1/contacts/groups/{groupId}
POST/api/v1/contacts/groups/{groupId}/members
DELETE/api/v1/contacts/groups/{groupId}/members
GET/api/v1/contacts/groups/{groupId}/members
GET/api/v1/contacts/{id}/groups

Paramètres

POST /api/v1/contacts/groups

ChampTypeRequisEmplacementDescription
namestringouibodyNom du groupe
descriptionstringnonbodyDescription
colorstringnonbodyCouleur hexadécimale

POST /api/v1/contacts/groups/{groupId}/members

ChampTypeRequisEmplacementDescription
groupIdUUIDouipathID du groupe
contactIdsUUID[]ouibodyListe des membres à ajouter

GET /api/v1/contacts/groups/{groupId}/members

ParamètreTypeRequisEmplacementDescription
groupIdUUIDouipathID du groupe
limitintegernonqueryTaille de page
cursorstringnonqueryCurseur
searchstringnonqueryFiltre sur nom ou téléphone

Créer un groupe

curl -X POST https://srv.msgflash.com/api/v1/contacts/groups \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Clients VIP",
    "description": "Clients à forte valeur",
    "color": "#F59E0B"
  }'

Ajouter des membres

curl -X POST https://srv.msgflash.com/api/v1/contacts/groups/GROUP_ID/members \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "contactIds": ["CONTACT_UUID_1", "CONTACT_UUID_2"]
  }'

Lister les membres

curl "https://srv.msgflash.com/api/v1/contacts/groups/GROUP_ID/members?limit=20&search=awa" \
  -H "x-api-key: msgf_live_your_api_key_here"
Réponse :
{
  "data": {
    "members": [],
    "nextCursor": null,
    "hasMore": false
  }
}
Les groupes exposés ici sont les groupes de contacts MsgFlash, pas des groupes WhatsApp natifs.

Erreurs courantes

CodeHTTPQuand
MAX_CONTACT_GROUPS_REACHED403Limite de groupes atteinte
NOT_FOUND404Groupe ou contact introuvable
CONFLICT409Groupe avec le même nom déjà existant