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

# Entrar no canal

> Inscreve a conta em um canal existente

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** parcial (canal já seguido normalmente é no-op silencioso)

## Descrição

Inscreve a conta (follow) em um canal. Após o `join`, o canal aparece em [`GET /list`](/pt/api/newsletter/list) e mensagens futuras chegam como `message.exchange` com `chat.type = "newsletter"`.

## Exemplos

### Por JID

Inscreve a conta passando o JID canônico do canal (`@newsletter`). É o formato mais direto, sem precisar resolver link ou código antes.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/newsletter/join/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "identifier": "120363422585881117@newsletter"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/newsletter/join/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      identifier: "120363422585881117@newsletter"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/newsletter/join/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "identifier": "120363422585881117@newsletter"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "identifier": "120363422585881117@newsletter"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/newsletter/join/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Por link

Inscreve a conta passando o link de convite completo (`https://whatsapp.com/channel/...`). O servidor extrai o código do final da URL e resolve o JID antes do follow.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/newsletter/join/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "identifier": "https://whatsapp.com/channel/120363422585881117"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/newsletter/join/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      identifier: "https://whatsapp.com/channel/120363422585881117"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/newsletter/join/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "identifier": "https://whatsapp.com/channel/120363422585881117"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "identifier": "https://whatsapp.com/channel/120363422585881117"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/newsletter/join/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Por código

Inscreve a conta passando apenas o código de convite (sufixo do link, sem o domínio). Atalho para quem já extraiu o código previamente.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/newsletter/join/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "identifier": "120363422585881117"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/newsletter/join/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      identifier: "120363422585881117"
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/newsletter/join/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "identifier": "120363422585881117"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "identifier": "120363422585881117"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/newsletter/join/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Resposta de sucesso

A resposta sempre traz o JID canônico do canal em `channelJid`, mesmo quando a entrada foi feita por link ou código de convite. Use esse valor como `identifier` em chamadas subsequentes (`/info`, `/leave`).

```json 200 OK theme={null}
{
  "success": true,
  "message": "Successfully joined newsletter",
  "channelJid": "120363422585881117@newsletter"
}
```

## Parâmetros de rota

<ParamField path="instance" type="string" required>
  Nome da instância.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  `TokenAccount` ou `TokenInstance`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Request body

<ParamField body="identifier" type="string" required>
  JID `@newsletter`, link completo ou código de convite.
</ParamField>

## Notas

<Note>
  * O response sempre traz o **JID canônico** em `channelJid`, útil quando o input foi link / código.
  * Após `join`, a propagação para `GET /list` pode levar alguns segundos.
  * Em raros casos, canais privados exigem aprovação do dono, o `join` retorna sucesso mas o canal só aparece em `list` após a aprovação.
  * Links de convite podem ser revogados pelo dono, códigos antigos passam a falhar com `newsletter not found`.
</Note>

## Erros

| HTTP | Mensagem                                                                   |
| ---- | -------------------------------------------------------------------------- |
| 400  | `The 'identifier' field is required (JID @newsletter or invite link/code)` |
| 400  | `Invalid newsletter identifier (use JID @newsletter or invite link/code)`  |
| 400  | `newsletter not found`                                                     |
| 500  | `failed to follow newsletter: <reason>`                                    |
| 501  | `WhatsApp client does not support FollowNewsletter`                        |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "newsletter not found" }
}
```
