Criar canal

POST /newsletter/create

Cria um novo canal/newsletter no WhatsApp.

Observações:

  • name é obrigatório
  • picture é opcional
  • picture aceita URL HTTP/HTTPS, base64 puro ou data URI
  • imagens acima de 1 MB são rejeitadas

Autenticação

[
  {
    "token": []
  }
]
{
  "token": {
    "name": "token",
    "type": "apiKey",
    "in": "header"
  }
}

Corpo da requisição

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Canal de Promoções"
          },
          "description": {
            "type": "string",
            "example": "Ofertas e novidades da loja"
          },
          "picture": {
            "type": "string",
            "description": "URL, base64 puro ou data URI da imagem do canal.",
            "example": "https://example.com/newsletter.png"
          }
        }
      }
    }
  }
}

Respostas

{
  "200": {
    "description": "Canal criado com sucesso",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "response"
          ],
          "properties": {
            "response": {
              "type": "object",
              "description": "Metadata do canal retornada pelo WhatsApp.",
              "additionalProperties": true
            }
          }
        }
      }
    }
  },
  "400": {
    "description": "Payload inválido",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "name is required"
            }
          }
        }
      }
    }
  },
  "401": {
    "description": "Instância não autenticada ou cliente não encontrado",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "client not found"
            }
          }
        }
      }
    }
  },
  "500": {
    "description": "Erro interno ao criar o canal",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "connection closed"
            }
          }
        }
      }
    }
  },
  "502": {
    "description": "O WhatsApp não devolveu o canal criado (resposta vazia)",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "WhatsApp did not return the created channel"
            }
          }
        }
      }
    }
  }
}

Guias relacionados

Autenticação · Erros e retries · Server URL