> ## 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.

# Unirse al newsletter

> Suscribe la cuenta a un newsletter existente

**Auth:** `TokenAccount` o `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** parcial (un newsletter ya seguido suele ser un no-op silencioso)

## Descripción

Suscribe (sigue) la cuenta a un newsletter. Después del `join`, el newsletter aparece en [`GET /list`](/es/api/newsletter/list) y los mensajes entrantes llegan como `message.exchange` con `chat.type = "newsletter"`.

## Ejemplos

### Por JID

Suscribe la cuenta pasando el JID canónico del newsletter (`@newsletter`). Es el formato más directo, no hace falta resolver un enlace o código primero.

<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 enlace

Suscribe la cuenta pasando el enlace de invitación completo (`https://whatsapp.com/channel/...`). El servidor extrae el código del sufijo de la URL y resuelve el JID antes de seguir.

<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

Suscribe la cuenta pasando solo el código de invitación (sufijo del enlace, sin el dominio). Un atajo cuando ya tienes el código extraído.

<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>

## Respuesta exitosa

La respuesta siempre devuelve el JID canónico del newsletter en `channelJid`, incluso cuando el input fue un enlace o código de invitación. Usa ese valor como `identifier` en llamadas posteriores (`/info`, `/leave`).

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

## Parámetros de ruta

<ParamField path="instance" type="string" required>
  Nombre de la instancia.
</ParamField>

## Cabeceras

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

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

## Cuerpo de la solicitud

<ParamField body="identifier" type="string" required>
  JID `@newsletter`, enlace completo o código de invitación.
</ParamField>

## Notas

<Note>
  * La respuesta siempre devuelve el **JID canónico** en `channelJid`, útil cuando el input fue un enlace / código.
  * Después del `join`, la propagación a `GET /list` puede demorar unos segundos.
  * En casos raros, los newsletters privados requieren aprobación del propietario, `join` devuelve éxito pero el newsletter solo aparece en `list` después de la aprobación.
  * Los enlaces de invitación pueden ser revocados por el propietario, los códigos antiguos comienzan a fallar con `newsletter not found`.
</Note>

## Errores

| HTTP | Mensaje                                                                    |
| ---- | -------------------------------------------------------------------------- |
| 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`                        |

Envoltorio:

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