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

# Criar Assinante WhatsApp

> Criar um Assinante/Contato no WhatsApp

# Criar Assinante

Esta API permite criar um novo assinante/contato na sua conta do WhatsApp Business.

## Endpoint da API

<ParamField method="POST" type="string">
  Criar um novo assinante/contato na sua conta do WhatsApp
</ParamField>

## Parâmetros

<ParamField query="apiToken" type="string" required>
  Sua chave de API
</ParamField>

<ParamField query="phoneNumberID" type="string" required>
  Número de telefone da conta do WhatsApp ID
</ParamField>

<ParamField query="name" type="string" required>
  Nome do seu assinante
</ParamField>

<ParamField query="phoneNumber" type="string" required>
  Número de telefone do assinante com código do país (sem o sinal de +)
</ParamField>

## Exemplo de Solicitação

<CodeGroup>
  ```bash POST theme={null}
  curl -X POST \ 
  'https://app.wizebot.com.br/api/v1/whatsapp/subscriber/create' \
  -d 'apiToken=API-KEY' \
  -d 'phoneNumberID=PHONE-NUMBER-ID' \
  -d 'name=NAME' \
  -d 'phoneNumber=MOBILE'
  ```
</CodeGroup>

## Exemplo de Resposta

<CodeGroup>
  ```json Sucesso theme={null}
  {
    "status": "1",
    "mesasge": "WhatsApp subscriber has been created."
  }
  ```

  ```json Erro - Conta não encontrada theme={null}
  {
    "status": "0",
    "message": "WhatsApp account not found."
  }
  ```

  ```json Erro - Limite de assinantes theme={null}
  {
    "status": "0",
    "message": "Subscriber limit has been exceeded. You cannot have more subscribers."
  }
  ```

  ```json Erro - Assinante já existe theme={null}
  {
    "status": "0",
    "message": "Something went wrong or subscriber already exist."
  }
  ```
</CodeGroup>

## Teste a API

<Note>
  Para testar esta API, você precisará de sua chave API (apiToken) que pode ser encontrada no painel da WizeBot em Configurações > API.
</Note>

<Playground method="POST" endpoint="https://app.wizebot.com.br/api/v1/whatsapp/subscriber/create">
  ```json theme={null}
  {
    "apiToken": "SUA_API_KEY_AQUI",
    "phoneNumberID": "SEU_PHONE_NUMBER_ID",
    "name": "João Silva",
    "phoneNumber": "5511999999999"
  }
  ```
</Playground>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
    'https://app.wizebot.com.br/api/v1/whatsapp/subscriber/create' \
    -d 'apiToken=SUA_API_KEY_AQUI' \
    -d 'phoneNumberID=SEU_PHONE_NUMBER_ID' \
    -d 'name=João Silva' \
    -d 'phoneNumber=5511999999999'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const data = {
    apiToken: 'SUA_API_KEY_AQUI',
    phoneNumberID: 'SEU_PHONE_NUMBER_ID',
    name: 'João Silva',
    phoneNumber: '5511999999999'
  };

  axios.post('https://app.wizebot.com.br/api/v1/whatsapp/subscriber/create', data)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Erro:', error);
  });
  ```

  ```php PHP theme={null}
  <?php
  $url = 'https://app.wizebot.com.br/api/v1/whatsapp/subscriber/create';

  $data = array(
    'apiToken' => 'SUA_API_KEY_AQUI',
    'phoneNumberID' => 'SEU_PHONE_NUMBER_ID',
    'name' => 'João Silva',
    'phoneNumber' => '5511999999999'
  );

  $options = array(
    'http' => array(
      'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
      'method'  => 'POST',
      'content' => http_build_query($data)
    )
  );

  $context  = stream_context_create($options);
  $result = file_get_contents($url, false, $context);

  echo $result;
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json Sucesso theme={null}
  {
    "status": "1",
    "mesasge": "WhatsApp subscriber has been created."
  }
  ```

  ```json Erro - API Key Inválida theme={null}
  {
    "status": "0",
    "message": "Invalid API Key."
  }
  ```

  ```json Erro - Conta não encontrada theme={null}
  {
    "status": "0",
    "message": "WhatsApp account not found."
  }
  ```

  ```json Erro - Limite de assinantes theme={null}
  {
    "status": "0",
    "message": "Subscriber limit has been exceeded. You cannot have more subscribers."
  }
  ```

  ```json Erro - Assinante já existe theme={null}
  {
    "status": "0",
    "message": "Something went wrong or subscriber already exist."
  }
  ```
</ResponseExample>
