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

# Enviar mensagem

> Envia qualquer mensagem da WhatsApp Cloud API. `type` define o tipo: text, image, audio, video, document, sticker, location, contacts, interactive, template, reaction.



## OpenAPI

````yaml openapi.meta.pt.json POST /{phoneNumberId}/messages
openapi: 3.1.0
info:
  title: Meta Cloud API Layer
  version: 1.0.0
  description: >-
    Camada de API do Pilot Status — Meta Cloud API (passthrough da WhatsApp
    Cloud API / Graph API). Base URL
    `https://pilotstatus.com.br/api/layer/meta`. Chame os nós do Graph API como
    em `graph.facebook.com/<versao>/` — o Pilot troca sua chave `ps_` pelo token
    real da Meta do número. O prefixo `vNN.N` é opcional (padrão v22.0). Gestão
    de conta/negócio/auth e (des)registro de número são bloqueados.
servers:
  - url: https://pilotstatus.com.br/api/layer/meta
security:
  - apiKey: []
tags:
  - name: Messages
  - name: Media
  - name: By id
  - name: Templates
  - name: Phone numbers
  - name: Business profile
  - name: Groups
  - name: Calls
paths:
  /{phoneNumberId}/messages:
    post:
      tags:
        - Messages
      summary: Enviar mensagem
      description: >-
        Envia qualquer mensagem da WhatsApp Cloud API. `type` define o tipo:
        text, image, audio, video, document, sticker, location, contacts,
        interactive, template, reaction.
      operationId: post__phoneNumberId_messages
      parameters:
        - name: phoneNumberId
          in: path
          required: true
          schema:
            type: string
          description: ID do número (phone-number id) da Meta vinculado à sua API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                messaging_product:
                  type: string
                  description: Sempre `whatsapp`.
                  enum:
                    - whatsapp
                  example: whatsapp
                recipient_type:
                  type: string
                  description: '`individual` ou `group`.'
                  enum:
                    - individual
                    - group
                  example: individual
                to:
                  type: string
                  description: MSISDN do destinatário (ou id do grupo).
                  example: '5511999999999'
                type:
                  type: string
                  description: Tipo da mensagem — define qual objeto abaixo preencher.
                  enum:
                    - text
                    - image
                    - audio
                    - video
                    - document
                    - sticker
                    - location
                    - contacts
                    - interactive
                    - template
                    - reaction
                  example: text
                text:
                  type: object
                  properties:
                    preview_url:
                      type: boolean
                      description: Renderizar preview do link.
                    body:
                      type: string
                      description: Texto da mensagem.
                  required:
                    - body
                  example:
                    preview_url: false
                    body: Hello from Pilot Status 👋
                image:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Id da mídia de um upload.
                    link:
                      type: string
                      description: URL https pública (alternativa ao id).
                    caption:
                      type: string
                      description: Legenda opcional.
                audio:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Id da mídia de um upload.
                    link:
                      type: string
                      description: URL https pública (alternativa ao id).
                video:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Id da mídia de um upload.
                    link:
                      type: string
                      description: URL https pública (alternativa ao id).
                    caption:
                      type: string
                      description: Legenda opcional.
                document:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Id da mídia de um upload.
                    link:
                      type: string
                      description: URL https pública (alternativa ao id).
                    caption:
                      type: string
                      description: Legenda opcional.
                    filename:
                      type: string
                      description: Nome do arquivo mostrado ao destinatário.
                sticker:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Id da mídia de um upload.
                    link:
                      type: string
                      description: URL https pública (alternativa ao id).
                location:
                  type: object
                  properties:
                    latitude:
                      type: number
                    longitude:
                      type: number
                    name:
                      type: string
                      description: Nome do local.
                    address:
                      type: string
                      description: Endereço.
                  required:
                    - latitude
                    - longitude
                contacts:
                  type: array
                  items:
                    type: object
                  description: Cartões de contato.
                interactive:
                  type: object
                  properties:
                    type:
                      type: string
                      description: '`button`, `list`, `cta_url`, `flow`, `product`…'
                    header:
                      type: object
                    body:
                      type: object
                      properties:
                        text:
                          type: string
                    footer:
                      type: object
                      properties:
                        text:
                          type: string
                    action:
                      type: object
                      description: Botões / seções / parâmetros do tipo interativo.
                  description: Mensagem interativa (botões/lista/CTA/flow).
                template:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Nome do template aprovado.
                    language:
                      type: object
                      properties:
                        code:
                          type: string
                          description: 'ex.: `pt_BR`.'
                    components:
                      type: array
                      items:
                        type: object
                      description: Parâmetros de header/body/botões.
                reaction:
                  type: object
                  properties:
                    message_id:
                      type: string
                    emoji:
                      type: string
                      description: Emoji, ou string vazia para remover.
                context:
                  type: object
                  properties:
                    message_id:
                      type: string
                      description: Responder a este message id.
                  description: Contexto de citação/resposta.
              required:
                - messaging_product
                - to
                - type
      responses:
        '200':
          description: Resposta do Meta Graph API.
          content:
            application/json:
              schema:
                type: object
                properties:
                  messaging_product:
                    type: string
                  contacts:
                    type: array
                    items:
                      type: object
                      properties:
                        input:
                          type: string
                        wa_id:
                          type: string
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Id da mensagem (wamid).
                        message_status:
                          type: string
              example:
                messaging_product: whatsapp
                contacts:
                  - input: '5511999999999'
                    wa_id: '5511999999999'
                messages:
                  - id: wamid.HBgL...
        default:
          description: Erro do Meta Graph API.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: Mensagem de erro.
                      type:
                        type: string
                        description: 'ex.: `OAuthException`.'
                      code:
                        type: integer
                      error_subcode:
                        type: integer
                      error_data:
                        type: object
                      fbtrace_id:
                        type: string
                description: Envelope de erro do Meta Graph API.
              example:
                error:
                  message: (#131030) Recipient phone number not in allowed list
                  type: OAuthException
                  code: 131030
                  fbtrace_id: A...
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Sua chave do Pilot Status (ps_...). Também aceita `Authorization: Bearer
        ps_...` ou `?access_token=ps_...`.

````