Passer au contenu principal
POST
/
whatsapp
/
groups
/
members
Gérer les membres
curl --request POST \
  --url https://api.wachap.com/v1/whatsapp/groups/members \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "accountId": "<string>",
  "groupJid": "<string>",
  "action": "add",
  "participants": [
    "<string>"
  ]
}
'

Endpoints

Option 1: GroupJid dans le body

POST https://api.wachap.com/v1/whatsapp/groups/members

Option 2: GroupJid dans l’URL (rétrocompatibilité)

POST https://api.wachap.com/v1/whatsapp/groups/:groupJid/members

Headers

ParamètreTypeRequisDescription
AuthorizationstringOuiBearer token avec votre Secret Key (format: Bearer sk_...)

Body Parameters (Option 1)

ParamètreTypeRequisDescription
accountIdstringOuiL’identifiant du compte WhatsApp
groupJidstringOuiL’identifiant du groupe (format: [email protected])
actionstringOuiAction à effectuer: add, remove, promote, demote
participantsarrayOuiListe des numéros de téléphone au format international

Body Parameters (Option 2)

ParamètreTypeRequisDescription
accountIdstringOuiL’identifiant du compte WhatsApp
actionstringOuiAction à effectuer: add, remove, promote, demote
participantsarrayOuiListe des numéros de téléphone au format international

Actions disponibles

ActionDescription
addAjouter des membres au groupe
removeRetirer des membres du groupe
promotePromouvoir des membres en tant qu’administrateurs
demoteRétrograder des administrateurs en membres normaux

Exemples de requêtes

Ajouter des membres (Option 1)

curl -X POST https://api.wachap.com/v1/whatsapp/groups/members \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "accountId": "account_xxx",
    "groupJid": "[email protected]",
    "action": "add",
    "participants": ["+33612345678", "+22962861571"]
  }'

Retirer des membres (Option 2)

curl -X POST https://api.wachap.com/v1/whatsapp/groups/[email protected]/members \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "accountId": "account_xxx",
    "action": "remove",
    "participants": ["+33698765432"]
  }'

Promouvoir en administrateur

curl -X POST https://api.wachap.com/v1/whatsapp/groups/members \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "accountId": "account_xxx",
    "groupJid": "[email protected]",
    "action": "promote",
    "participants": ["+33612345678"]
  }'

Rétrograder un administrateur

curl -X POST https://api.wachap.com/v1/whatsapp/groups/members \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer VOTRE_CLE_SECRETE" \
  -d '{
    "accountId": "account_xxx",
    "groupJid": "[email protected]",
    "action": "demote",
    "participants": ["+33612345678"]
  }'

Exemple de réponse

{
  "success": true,
  "message": "Action effectuée avec succès",
  "action": "add",
  "groupJid": "[email protected]",
  "participants": [
    "[email protected]",
    "[email protected]"
  ],
  "results": [
    {
      "jid": "[email protected]",
      "status": "success"
    },
    {
      "jid": "[email protected]",
      "status": "success"
    }
  ]
}

Notes

  • Vous devez être administrateur du groupe pour effectuer ces actions
  • Pour promote et demote, les participants doivent déjà être membres du groupe
  • Pour add, les participants ne doivent pas déjà être dans le groupe
  • Pour remove, vous ne pouvez pas vous retirer vous-même

Codes d’erreur

CodeDescription
400MISSING_ACCOUNT_ID - accountId manquant
400MISSING_GROUP_JID - groupJid manquant
400MISSING_ACTION - action manquante
400INVALID_ACTION - action invalide
400MISSING_PARTICIPANTS - participants manquant ou vide
401INVALID_SECRET_KEY - Clé secrète invalide
403NOT_ADMIN - Vous n’êtes pas administrateur du groupe
403NOT_CREATOR - Seul le créateur peut promouvoir/rétrograder (selon cas)
404ACCOUNT_NOT_FOUND - Compte WhatsApp non trouvé
404GROUP_NOT_FOUND - Groupe non trouvé

Autorisations

Authorization
string
header
requis

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

Corps

application/json
accountId
string
groupJid
string
action
enum<string>

Action à effectuer

Options disponibles:
add,
remove,
promote,
demote
participants
string[]

Liste des numéros de téléphone (format international)

Réponse

200

OK