Skip to main content

API de Mensagens

Envie mensagens WhatsApp via API. Todos os endpoints usam o ID da instância como parâmetro de rota.
POST https://grwthy.com/v1/messages/:type/:id

Campos Comuns

Todos os tipos de mensagem (exceto reação) aceitam estes campos opcionais:
quoted
object
Responder a uma mensagem específica.
quoted.id
string
required
ID da mensagem a ser respondida.
webhookUrl
string
URL customizada para receber o status desta mensagem.

Enviar Texto

POST https://grwthy.com/v1/messages/text/:id
number
string
required
Número do destinatário com código do país, sem +. Ex: 5511999999999
text
string
required
Conteúdo da mensagem.
Habilitar pré-visualização de links. Padrão: false.

Exemplo

curl -X POST https://grwthy.com/v1/messages/text/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "text": "Olá do Grwthy!"
  }'

Enviar Mídia

POST https://grwthy.com/v1/messages/media/:id
number
string
required
Número do destinatário.
mediatype
string
required
Tipo de mídia: image, video ou document.
media
string
required
URL pública da mídia ou conteúdo em base64.
mimetype
string
MIME type do arquivo (ex: image/jpeg, application/pdf).
caption
string
Legenda da mídia.
fileName
string
Nome do arquivo (usado para documentos).

Exemplo — Imagem

curl -X POST https://grwthy.com/v1/messages/media/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "mediatype": "image",
    "media": "https://exemplo.com/foto.jpg",
    "caption": "Confira nossa promoção!"
  }'

Exemplo — Documento

curl -X POST https://grwthy.com/v1/messages/media/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "mediatype": "document",
    "media": "https://exemplo.com/relatorio.pdf",
    "fileName": "relatorio-mensal.pdf"
  }'

Enviar Áudio

POST https://grwthy.com/v1/messages/audio/:id
number
string
required
Número do destinatário.
audio
string
required
URL pública do áudio ou conteúdo em base64.
mimetype
string
MIME type do áudio. Formatos aceitos pela Meta: audio/aac, audio/mp4, audio/mpeg, audio/amr, audio/ogg, audio/opus.

Exemplo

curl -X POST https://grwthy.com/v1/messages/audio/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "audio": "https://exemplo.com/audio.ogg",
    "mimetype": "audio/ogg"
  }'

Enviar Template

POST https://grwthy.com/v1/messages/template/:id
Templates devem ser pré-aprovados no seu WhatsApp Business Account.
number
string
required
Número do destinatário.
name
string
required
Nome do template aprovado.
language
string
required
Código do idioma (ex: pt_BR, en_US).
components
array
Componentes com parâmetros dinâmicos. Segue o formato da API do WhatsApp.

Exemplo

curl -X POST https://grwthy.com/v1/messages/template/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "name": "confirmacao_pedido",
    "language": "pt_BR",
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "João" },
          { "type": "text", "text": "#12345" }
        ]
      }
    ]
  }'

Enviar Localização

POST https://grwthy.com/v1/messages/location/:id
number
string
required
Número do destinatário.
latitude
number
required
Latitude.
longitude
number
required
Longitude.
name
string
Nome do local.
address
string
Endereço do local.

Exemplo

curl -X POST https://grwthy.com/v1/messages/location/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "latitude": -23.5505,
    "longitude": -46.6333,
    "name": "São Paulo",
    "address": "Av. Paulista, 1000"
  }'

Enviar Contato

POST https://grwthy.com/v1/messages/contact/:id
number
string
required
Número do destinatário.
contact
array
required
Lista de contatos a enviar.
contact[].fullName
string
required
Nome completo do contato.
contact[].phoneNumber
string
required
Telefone do contato.
contact[].organization
string
Empresa.
contact[].email
string
E-mail.
contact[].url
string
Website.

Exemplo

curl -X POST https://grwthy.com/v1/messages/contact/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "contact": [
      {
        "fullName": "João Silva",
        "phoneNumber": "5511888888888",
        "organization": "Grwthy"
      }
    ]
  }'

Enviar Botões

POST https://grwthy.com/v1/messages/buttons/:id
number
string
required
Número do destinatário.
title
string
required
Título da mensagem.
buttons
array
required
Lista de botões (máximo 3).
buttons[].reply.id
string
required
ID do botão (retornado quando o usuário clica).
buttons[].reply.title
string
required
Texto exibido no botão.

Exemplo

curl -X POST https://grwthy.com/v1/messages/buttons/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "title": "Como podemos ajudar?",
    "buttons": [
      { "reply": { "id": "btn_vendas", "title": "Vendas" } },
      { "reply": { "id": "btn_suporte", "title": "Suporte" } },
      { "reply": { "id": "btn_horario", "title": "Horários" } }
    ]
  }'

Enviar Lista

POST https://grwthy.com/v1/messages/list/:id
number
string
required
Número do destinatário.
title
string
required
Título da mensagem.
buttonText
string
required
Texto do botão que abre a lista.
description
string
Descrição da mensagem.
Texto do rodapé.
sections
array
required
Seções da lista.
sections[].title
string
required
Título da seção.
sections[].rows
array
required
Itens da seção.
sections[].rows[].id
string
required
ID do item.
sections[].rows[].title
string
required
Título do item.
sections[].rows[].description
string
Descrição do item.

Exemplo

curl -X POST https://grwthy.com/v1/messages/list/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "title": "Nossos serviços",
    "buttonText": "Ver opções",
    "sections": [
      {
        "title": "Planos",
        "rows": [
          { "id": "starter", "title": "Starter", "description": "Para pequenos negócios" },
          { "id": "pro", "title": "Pro", "description": "Para empresas em crescimento" }
        ]
      }
    ]
  }'

Enviar Reação

POST https://grwthy.com/v1/messages/reaction/:id
number
string
required
Número do destinatário.
messageId
string
required
ID da mensagem (wamid) para reagir.
reaction
string
required
Emoji da reação. Envie string vazia "" para remover a reação.

Exemplo

curl -X POST https://grwthy.com/v1/messages/reaction/clux1a2b3c4d5e6f7g8h9i0j \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: SUA_API_KEY" \
  -d '{
    "number": "5511999999999",
    "messageId": "wamid.HBgNNTUxMTk5OTk5OTk5FQIAEhgUM0EB",
    "reaction": "👍"
  }'