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

# Enviar Mensagem de Evento

> Enviar mensagem de evento para um contato ou grupo com informações de data, hora e localização

## Descrição

Este endpoint permite enviar mensagens de evento para contatos individuais ou grupos no WhatsApp. Eventos podem incluir informações sobre nome, descrição, horários, localização e permissão para convidados extras.

## Parâmetros de URL

<ParamField path="session" type="string" required>
  ID da sessão autenticada que enviará o evento
</ParamField>

## Body

```json theme={null}
{
  "jid": "5511999999999@s.whatsapp.net",
  "event": {
    "name": "Meu Grupo",
    "description": "Descrição",
    "startTime": 0,
    "endTime": 0,
    "location": {
      "name": "Meu Grupo",
      "latitude": -23.5505,
      "longitude": -46.6333
    },
    "extraGuestsAllowed": true
  }
}
```

### Parâmetros do Body

| Propriedade                | Tipo      | Obrigatório | Descrição                                                                                                                                |
| -------------------------- | --------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `jid`                      | `string`  | ✅ Sim       | Identificador do destinatário (JID do WhatsApp). Formato: `5511999999999@s.whatsapp.net` para contatos ou `120363XXXXX@g.us` para grupos |
| `event`                    | `object`  | ✅ Sim       | Objeto contendo as informações do evento                                                                                                 |
| `event.name`               | `string`  | ✅ Sim       | Nome do evento                                                                                                                           |
| `event.description`        | `string`  | ❌ Não       | Descrição do evento                                                                                                                      |
| `event.startTime`          | `number`  | ✅ Sim       | Timestamp Unix (em milissegundos) indicando o horário de início do evento                                                                |
| `event.endTime`            | `number`  | ❌ Não       | Timestamp Unix (em milissegundos) indicando o horário de término do evento                                                               |
| `event.location`           | `object`  | ✅ Sim       | Informações sobre a localização do evento                                                                                                |
| `event.location.name`      | `string`  | ✅ Sim       | Nome ou endereço da localização                                                                                                          |
| `event.location.latitude`  | `number`  | ❌ Não       | Latitude da localização                                                                                                                  |
| `event.location.longitude` | `number`  | ❌ Não       | Longitude da localização                                                                                                                 |
| `event.extraGuestsAllowed` | `boolean` | ✅ Sim       | Define se convidados extras são permitidos no evento                                                                                     |

<ResponseExample>
  ```json Resposta de Sucesso theme={null}
  {
    "success": true,
    "messageId": "3EB0XXXXXX"
  }
  ```
</ResponseExample>

## Códigos de Status

* `200` - Evento enviado com sucesso
* `400` - Parâmetros inválidos
* `401` - Sessão não autorizada
* `404` - Sessão não encontrada

## Exemplo de Uso

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wappfy.com.br/api/my-session/events \
    -H "Content-Type: application/json" \
    -d '{
      "jid": "5511999999999@s.whatsapp.net",
      "event": {
        "name": "Reunião de Equipe",
        "description": "Discussão sobre o projeto Q1",
        "startTime": 1704034800000,
        "endTime": 1704038400000,
        "location": {
          "name": "Sala de Conferências A, Av. Paulista 1000",
          "latitude": -23.561684,
          "longitude": -46.655981
        },
        "extraGuestsAllowed": true
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wappfy.com.br/api/my-session/events', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      jid: '5511999999999@s.whatsapp.net',
      event: {
        name: 'Reunião de Equipe',
        description: 'Discussão sobre o projeto Q1',
        startTime: 1704034800000,
        endTime: 1704038400000,
        location: {
          name: 'Sala de Conferências A, Av. Paulista 1000',
          latitude: -23.561684,
          longitude: -46.655981
        },
        extraGuestsAllowed: true
      }
    })
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.wappfy.com.br/api/my-session/events',
      json={
          'jid': '5511999999999@s.whatsapp.net',
          'event': {
              'name': 'Reunião de Equipe',
              'description': 'Discussão sobre o projeto Q1',
              'startTime': 1704034800000,
              'endTime': 1704038400000,
              'location': {
                  'name': 'Sala de Conferências A, Av. Paulista 1000',
                  'latitude': -23.561684,
                  'longitude': -46.655981
              },
              'extraGuestsAllowed': True
          }
      }
  )
  data = response.json()
  print(data)
  ```
</CodeGroup>

## Notas Importantes

* Os timestamps devem estar em formato Unix (milissegundos)
* A localização é obrigatória, mas latitude e longitude são opcionais
* Se `extraGuestsAllowed` for `true`, os convidados poderão trazer pessoas adicionais
* O evento será exibido no WhatsApp com um card especial contendo todas as informações fornecidas


## OpenAPI

````yaml viewer.json post /api/{session}/events
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Servidor Customizável
    variables:
      host:
        default: api.wappfy.com.br
        description: 'URL do servidor (ex: api.wappfy.com.br ou seu-servidor.com)'
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: >-
      Controlar sessões do WhatsApp (contas) (Control WhatsApp sessions
      (accounts))
  - name: 🔑 Auth
    description: Autenticação
  - name: 🆔 Profile
    description: Informações do seu perfil
  - name: 🖼️ Screenshot
    description: Obter captura de tela do WhatsApp e mostrar código QR
  - name: 📤 Chatting
    description: Métodos de conversação
  - name: 📢 Channels
    description: Métodos de canais (newsletters) (Channels (newsletters) methods)
  - name: 🟢 Status
    description: Métodos de status (aka stories) (Status (aka stories) methods)
  - name: 💬 Chats
    description: Métodos de conversas
  - name: 👤 Contacts
    description: >-
      Métodos de contatos. Use número de telefone (sem +) ou número de telefone
      e `@c.us` no final como `contactId`. Ex: `12312312310` OU
      `12312312310@c.us` (Contacts methods.<br>
                      Use phone number (without +) or phone number and `@c.us` at the end as `contactId`.<br>
                      'E.g: `12312312310` OR `12312312310@c.us`<br>)
  - name: 👥 Groups
    description: Métodos de grupos (Groups methods).<br>
  - name: ✅ Presence
    description: Informações de presença
  - name: 📅 Events
    description: Mensagem de Evento
  - name: 🏷️ Labels
    description: Etiquetas - disponível apenas para contas WhatsApp Business
  - name: 🔍 Observability
    description: Outros métodos
  - name: 🗄️ Storage
    description: Métodos de armazenamento
externalDocs:
  description: Wappfy - WhatsApp HTTP API
  url: https://wappfy.com.br/
paths:
  /api/{session}/events:
    post:
      tags:
        - 📅 Events
      summary: Enviar uma mensagem de evento
      description: O parâmetro {session} deve ser o instanceName da sessão.
      operationId: EventsController_sendEvent
      parameters:
        - name: session
          required: true
          in: path
          description: Nome da sessão (instanceName)
          example: my-session
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventMessageRequest'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WAMessage'
      security:
        - api_key: []
components:
  schemas:
    EventMessageRequest:
      type: object
      properties:
        chatId:
          type: string
          example: 5511999999999@c.us
        reply_to:
          type: string
          description: ID da mensagem à qual você deseja responder
          example: null
        event:
          $ref: '#/components/schemas/EventMessage'
      required:
        - chatId
        - event
    WAMessage:
      type: object
      properties:
        id:
          type: string
          description: ID da mensagem
          example: false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA
        timestamp:
          type: number
          description: Timestamp Unix de quando a mensagem foi criada
          example: 1666943582
        from:
          type: string
          description: ID do chat para o qual esta mensagem foi enviada
          example: 5511999999999@c.us
        fromMe:
          type: boolean
          description: Indica se a mensagem foi enviada pelo usuário atual
        source:
          enum:
            - api
            - app
          type: string
          description: >-
            The device that sent the message - either API or APP. Available in
            events (webhooks/websockets) only and only "fromMe: true" messages.
          example: api
        to:
          type: string
          description: >-
            * ID for who this message is for.

            * If the message is sent by the current user, it will be the Chat to
            which the message is being sent.

            * If the message is sent by another user, it will be the ID for the
            current user.
          example: 5511999999999@c.us
        participant:
          type: string
          description: Para grupos - participante que enviou a mensagem
        body:
          type: string
          description: Conteúdo da mensagem
        hasMedia:
          type: boolean
          description: Indica se a mensagem possui mídia disponível para download
        media:
          description: Objeto de mídia da mensagem, se houver e foi baixada
          allOf:
            - $ref: '#/components/schemas/WAMedia'
        ack:
          enum:
            - -1
            - 0
            - 1
            - 2
            - 3
            - 4
          type: number
          description: Status de confirmação (ACK) da mensagem
        ackName:
          type: string
          description: Nome do status de confirmação da mensagem
        author:
          type: string
          description: >-
            Se a mensagem foi enviada para um grupo, este campo conterá o
            usuário que enviou a mensagem
        location:
          description: Informações de localização contidas na mensagem
          allOf:
            - $ref: '#/components/schemas/WALocation'
        vCards:
          description: Lista de vCards contidos na mensagem
          type: array
          items:
            type: string
        _data:
          type: object
          description: >-
            Mensagem em formato bruto do WhatsApp. Pode mudar a qualquer
            momento, use com cautela!
        replyTo:
          $ref: '#/components/schemas/ReplyToMessage'
      required:
        - id
        - timestamp
        - from
        - fromMe
        - source
        - to
        - participant
        - body
        - hasMedia
        - mediaUrl
        - ack
        - ackName
    EventMessage:
      type: object
      properties:
        name:
          type: string
          description: Name of the event
          example: John's Nail Appointment 💅
        description:
          type: string
          description: Description of the event
          example: >-
            It's time for your nail care session! 🌟\n\nYou'll be getting a
            *classic gel manicure* – clean, polished, and long-lasting. 💖\n\n📍
            *Location:* Luxe Nail Studio\nWe're on the *2nd floor of the Plaza
            Mall*, next to the flower shop. Look for the *pink neon
            sign*!\n\nFeel free to arrive *5–10 mins early* so we can get
            started on time 😊
        startTime:
          type: number
          description: Start time of the event
          example: 2063137000
        endTime:
          type: number
          description: End time of the event
          example: null
        location:
          description: Location of the event
          allOf:
            - $ref: '#/components/schemas/EventLocation'
        extraGuestsAllowed:
          type: boolean
          description: Whether extra guests are allowed
          example: false
      required:
        - name
        - startTime
    WAMedia:
      type: object
      properties:
        url:
          type: string
          description: URL da mídia na mensagem, se houver
          example: >-
            http://localhost:3000/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga
        mimetype:
          type: string
          description: Tipo MIME da mídia na mensagem
          example: audio/jpeg
        filename:
          type: string
          description: Nome original do arquivo de mídia
          example: example.pdf
        s3:
          description: Atributos S3 da mídia se você estiver usando armazenamento S3
          allOf:
            - $ref: '#/components/schemas/S3MediaData'
        error:
          type: object
          description: Mensagem de erro ao baixar a mídia
          example: null
    WALocation:
      type: object
      properties:
        description:
          type: string
        latitude:
          type: string
        longitude:
          type: string
      required:
        - latitude
        - longitude
    ReplyToMessage:
      type: object
      properties:
        id:
          type: string
          description: ID da mensagem
          example: AAAAAAAAAAAAAAAAAAAA
        participant:
          type: string
          example: 5511999999999@c.us
        body:
          type: string
          example: Hello!
        _data:
          type: object
          description: Raw data from reply's message
      required:
        - id
    EventLocation:
      type: object
      properties:
        name:
          type: string
          description: Name of the location
          example: Luxe Nail Studio 💅
      required:
        - name
    S3MediaData:
      type: object
      properties:
        Bucket:
          type: string
          description: Nome do bucket S3
          example: my-bucket
        Key:
          type: string
          description: Chave do objeto no bucket S3
          example: default/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga
      required:
        - Bucket
        - Key
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)

````