Passer au contenu principal
POST
/
contact-groups
/
create
Créer une liste de contacts
curl --request POST \
  --url https://api.wachap.com/v1/contact-groups/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "csvUrl": "<string>",
  "contacts": [
    {
      "phone": "<string>",
      "name": "<string>",
      "city": "<string>"
    }
  ]
}
'

Endpoint

/v1/contact-groups/create

Headers

Authorization
string
requis
Bearer token avec votre Secret Key (format: Bearer sk_...)

Body Parameters

name
string
requis
Nom de la liste de contacts
csvUrl
string
URL d’un fichier CSV à importer
contacts
array
Liste de contacts à ajouter directement (format JSON). Voir structure ci-dessous.

Structure d’un contact (si fourni via JSON)

ChampTypeRequisDescription
phonestringOuiNuméro de téléphone au format international
namestringNonNom du contact
...anyNonAutres champs personnalisés

Exemples de requêtes

# Création via JSON direct
curl -X POST https://api.wachap.com/v1/contact-groups/create \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "name": "Clients Premium",
    "contacts": [
      {
        "phone": "+22962861571",
        "name": "John Doe",
        "city": "Abidjan"
      },
      {
        "phone": "+33612345678",
        "name": "Marie Dupont",
        "city": "Paris"
      }
    ]
  }'

# Création via URL CSV
curl -X POST https://api.wachap.com/v1/contact-groups/create \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "name": "Import CSV",
    "csvUrl": "https://example.com/contacts.csv"
  }'

Exemple de réponse

{
  "success": true,
  "listId": "65f1234567890abcdef12345",
  "contactGroup": {
    "$id": "65f1234567890abcdef12345",
    "userId": "user_xxx",
    "name": "Clients Premium",
    "csvUrl": null,
    "status": "ready",
    "createdAt": "2024-03-15T10:00:00.000Z",
    "updatedAt": "2024-03-15T10:00:00.000Z"
  }
}

Statuts possibles

StatutDescription
readyListe prête à être utilisée
importingImport CSV en cours

Codes d’erreur

CodeDescription
400MISSING_NAME - Le nom de la liste est requis
401INVALID_SECRET_KEY - Clé secrète invalide
500CREATE_CONTACT_GROUP_ERROR - Erreur lors de la création

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Corps

application/json
name
string
csvUrl
string
contacts
object[]

Réponse

200

OK