# cURL para envio de RCS

## 1. Via API Laravel (Recomendado)

### Linux/macOS (genérico /api/messages/send)
curl -s -X POST "http://localhost/api/messages/send" \
  -H "Authorization: Bearer SEU_TOKEN_AQUI" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"channel":"rcs","to":"5547999999999","text":"Teste via RCS"}'

### Linux/macOS (endpoint específico /api/messages/rcs/send)
curl -s -X POST "http://localhost/api/messages/rcs/send" \
  -H "Authorization: Bearer SEU_TOKEN_AQUI" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"recipient":"5547999999999","text":"Teste via RCS"}'

### Windows (PowerShell) – genérico
curl.exe -s -X POST "http://localhost/api/messages/send" `
  -H "Authorization: Bearer SEU_TOKEN_AQUI" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json" `
  -d '{"channel":"rcs","to":"5547999999999","text":"Teste via RCS"}'

### Windows (PowerShell) – específico
curl.exe -s -X POST "http://localhost/api/messages/rcs/send" `
  -H "Authorization: Bearer SEU_TOKEN_AQUI" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json" `
  -d '{"recipient":"5547999999999","text":"Teste via RCS"}'

## 2. Direto na API do Infobip (Para testes)

### Linux/macOS
curl -L -g 'https://nm9ne5.api-us.infobip.com/rcs/2/messages' \
  -H 'Authorization: App a33bee89020dba9394572591e9e4f03a-810484a6-e00e-4616-87ad-7946d155c5e1' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "messages": [
      {
        "sender": "SEU_RCS_SENDER",
        "destinations": [
          { "to": "5547999999999" }
        ],
        "content": {
          "type": "TEXT",
          "text": "Teste direto via Infobip RCS"
        }
      }
    ]
  }'

### Windows (PowerShell)
curl.exe -L -g "https://nm9ne5.api-us.infobip.com/rcs/2/messages" `
  -H "Authorization: App a33bee89020dba9394572591e9e4f03a-810484a6-e00e-4616-87ad-7946d155c5e1" `
  -H "Content-Type: application/json" `
  -H "Accept: application/json" `
  -d '{
    "messages": [
      {
        "sender": "SEU_RCS_SENDER",
        "destinations": [
          { "to": "5547999999999" }
        ],
        "content": {
          "type": "TEXT",
          "text": "Teste direto via Infobip RCS"
        }
      }
    ]
  }'

## Notas Importantes:

### Para API Laravel:
- Substitua SEU_TOKEN_AQUI pelo JWT obtido no login (veja LOGIN_CURL_EXAMPLES.txt)
- Se não houver preço configurado para RCS no banco, a API usa o padrão de R$ 0,091 por mensagem
- Ajuste a URL base (http://localhost) se seu backend estiver em outra porta/host

### Para API Infobip Direta:
- Substitua SEU_RCS_SENDER pelo sender RCS configurado na sua conta Infobip
- Use números no formato E.164 (com código do país, ex: 5547999999999)
- Esta API não faz cobrança nem persiste dados no seu sistema

### Configuração no .env:
Certifique-se de que seu arquivo .env contém:
```
INFOBIP_BASE_URL=https://nm9ne5.api-us.infobip.com
INFOBIP_API_KEY=a33bee89020dba9394572591e9e4f03a-810484a6-e00e-4616-87ad-7946d155c5e1
INFOBIP_RCS_SENDER=seu_rcs_sender_aqui
```