> ## Documentation Index
> Fetch the complete documentation index at: https://dev.wachap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Envoyer un message dans un groupe

> Envoyez un message dans un groupe WhatsApp

## Envoyer un message dans un groupe

Envoyez un message (texte, image, vidéo, etc.) dans un groupe WhatsApp.

### Endpoint

<ParamField method="POST" path="/v1/whatsapp/groups/send" />

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token avec votre Secret Key (format: `Bearer sk_...`)
</ParamField>

### Body Parameters

<ParamField body="accountId" type="string" required>
  L'identifiant du compte WhatsApp
</ParamField>

<ParamField body="groupJid" type="string" required>
  L'identifiant du groupe (format: `120363...@g.us`)
</ParamField>

<ParamField body="type" type="string" required>
  Type de message: `text`, `image`, `video`, `document`, `audio`, `location`, `contact`
</ParamField>

<ParamField body="content" type="string">
  Contenu du message texte (Requis si type=`text`)
</ParamField>

<ParamField body="imageUrl" type="string">
  URL de l'image (Requis si type=`image`)
</ParamField>

<ParamField body="caption" type="string">
  Légende pour une image, une vidéo ou un document
</ParamField>

<ParamField body="videoUrl" type="string">
  URL de la vidéo (Requis si type=`video`)
</ParamField>

<ParamField body="documentUrl" type="string">
  URL du document (Requis si type=`document`)
</ParamField>

<ParamField body="filename" type="string">
  Nom du fichier pour un document
</ParamField>

<ParamField body="audioUrl" type="string">
  URL du fichier audio (Requis si type=`audio`)
</ParamField>

<ParamField body="buttons" type="array">
  Jusqu’à trois boutons interactifs pour `text`, `image`, `video` ou `document`.
</ParamField>

<ParamField body="footerText" type="string">
  Pied affiché sous les boutons, limité à 60 caractères.
</ParamField>

Vous pouvez également utiliser `POST /v1/whatsapp/groups/:groupJid/send` en plaçant le JID dans l’URL et en omettant `groupJid` du body. Les mêmes champs de boutons sont acceptés.

### Exemples de requêtes

<CodeGroup>
  ```bash Message Texte theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/groups/send \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "groupJid": "120363123456789012@g.us",
      "type": "text",
      "content": "Confirmez-vous votre participation ?",
      "buttons": [
        {"id": "yes", "text": "Oui", "type": "reply"},
        {"id": "no", "text": "Non", "type": "reply"}
      ],
      "footerText": "Réunion WaChap"
    }'
  ```

  ```bash Image avec légende theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/groups/send \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "groupJid": "120363123456789012@g.us",
      "type": "image",
      "imageUrl": "https://example.com/image.jpg",
      "caption": "Regardez cette image !",
      "buttons": [
        {"id": "details", "text": "Voir les détails", "type": "url", "url": "https://wachap.com/details"}
      ]
    }'
  ```
</CodeGroup>

Consultez [Boutons interactifs](/fr/messages/interactive-buttons) pour les types de boutons, les limites et le comportement de repli.

### Exemple de réponse

```json theme={null}
{
  "success": true,
  "message": "Message envoyé avec succès",
  "messageId": "3EB0123456789ABCDEF",
  "groupJid": "120363123456789012@g.us"
}
```

### Codes d'erreur

| Code  | Description                                              |
| :---- | :------------------------------------------------------- |
| `400` | MISSING\_ACCOUNT\_ID, MISSING\_GROUP\_JID, MISSING\_TYPE |
| `401` | INVALID\_SECRET\_KEY - Clé secrète invalide              |
| `403` | NOT\_MEMBER - Vous n'êtes pas membre du groupe           |
| `404` | ACCOUNT\_NOT\_FOUND, GROUP\_NOT\_FOUND                   |


## OpenAPI

````yaml POST /whatsapp/groups/send
openapi: 3.0.3
info:
  title: WaChap API
  version: 2.0.0
servers:
  - url: https://api.wachap.com/v1
    description: WaChap API server
security:
  - BearerAuth: []
tags:
  - name: Instances
    description: Créer et gérer des instances WhatsApp
  - name: Webhook
    description: Configuration des webhooks de réception
  - name: Messages
    description: Envoyer des messages WhatsApp
  - name: Comptes
    description: Gérer vos comptes WhatsApp connectés
  - name: SMS
    description: Service SMS de WaChap (V4) via FCM
  - name: Étiquettes WhatsApp
    description: Créer et associer des étiquettes aux conversations WhatsApp
paths:
  /whatsapp/groups/send:
    post:
      tags:
        - Groupes
      summary: Envoyer un message groupe
      description: Envoyez un message dans un groupe WhatsApp.
      operationId: sendGroupMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - accountId
                - groupJid
                - type
              properties:
                accountId:
                  type: string
                groupJid:
                  type: string
                type:
                  type: string
                  enum:
                    - text
                    - image
                    - video
                    - document
                    - audio
                    - location
                    - contact
                content:
                  type: string
                imageUrl:
                  type: string
                videoUrl:
                  type: string
                documentUrl:
                  type: string
                audioUrl:
                  type: string
                filename:
                  type: string
                caption:
                  type: string
                buttons:
                  type: array
                  minItems: 1
                  maxItems: 3
                  description: Disponible pour text, image, video et document.
                  items:
                    $ref: '#/components/schemas/InteractiveButton'
                footerText:
                  type: string
                  maxLength: 60
            examples:
              groupConfirmation:
                value:
                  accountId: account_123
                  groupJid: 120363123456789012@g.us
                  type: text
                  content: Confirmez-vous votre participation ?
                  buttons:
                    - id: 'yes'
                      text: Oui
                      type: reply
                    - id: 'no'
                      text: Non
                      type: reply
                  footerText: Réunion WaChap
      responses:
        '200':
          description: OK
        '400':
          description: Paramètres du message ou boutons invalides
components:
  schemas:
    InteractiveButton:
      type: object
      required:
        - text
      properties:
        id:
          type: string
          description: >-
            Identifiant unique du bouton dans le message. Généré automatiquement
            s’il est omis.
        text:
          type: string
          minLength: 1
          maxLength: 20
          description: Libellé affiché dans WhatsApp.
        type:
          type: string
          enum:
            - reply
            - url
            - call
          default: reply
        url:
          type: string
          format: uri
          pattern: ^https?://
          description: URL HTTP(S) requise pour un bouton de type url.
        phoneNumber:
          type: string
          pattern: ^\+?[1-9][0-9]{5,14}$
          description: Numéro international requis pour un bouton de type call.
      example:
        id: confirm
        text: Confirmer
        type: reply
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````