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

# Quick Start

> Do zero a recebendo mensagens WhatsApp em menos de 10 minutos.

## 1. Gere uma API Key

No painel do Coexy, vá em **Configurações → API Keys** e crie uma nova chave.

Guarde o valor — ele só é exibido uma vez.

## 2. Crie um canal

```bash theme={null}
curl -X POST https://<project-ref>.supabase.co/functions/v1/api/channels \
  -H "x-api-key: crt_pk_sua-chave" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Suporte Principal" }'
```

A resposta inclui `connect_url` — compartilhe esse link com o responsável pelo número WhatsApp para conectar.

## 3. Crie um webhook

```bash theme={null}
curl -X POST https://<project-ref>.supabase.co/functions/v1/api/webhooks \
  -H "x-api-key: crt_pk_sua-chave" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Meu CRM",
    "url": "https://meuapp.com/webhook/coexy",
    "events": ["messages", "message_status"]
  }'
```

<Warning>
  Salve o `hmac_secret` retornado. Ele **não pode ser recuperado** depois — use-o para verificar a autenticidade dos eventos recebidos.
</Warning>

## 4. Implemente o receptor

```typescript theme={null}
export async function POST(request: Request): Promise<Response> {
  const body = await request.text()
  const signature = request.headers.get('x-coexy-signature') ?? ''

  const valid = await verifySignature(body, signature, process.env.COEXY_HMAC_SECRET!)
  if (!valid) return new Response('Unauthorized', { status: 401 })

  // Responder 200 ANTES de processar (timeout de 10s)
  processEvent(JSON.parse(body)).catch(console.error)

  return new Response('OK', { status: 200 })
}
```

Pronto. Veja a [implementação completa](/receiving-events/overview) e o [guia de segurança](/receiving-events/security).
