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

# Listar Modelos WhatsApp

> Obter lista de modelos de mensagem do WhatsApp

# Listar Modelos de Mensagem

Esta API permite obter a lista de modelos de mensagem disponíveis para sua conta do WhatsApp Business.

## Modelos de Mensagem

Os modelos de mensagem são formatos pré-aprovados pelo WhatsApp que permitem enviar mensagens fora da janela de 24 horas. Eles são essenciais para campanhas de marketing, notificações e comunicações programadas.

## Endpoint da API

<ParamField method="POST" type="string">
  Obter lista de modelos de mensagem disponíveis para sua conta
</ParamField>

## Parâmetros

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

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

## Exemplo de Solicitação

<CodeGroup>
  ```bash POST theme={null}
  curl -X POST \ 
  'https://app.wizebot.com.br/api/v1/whatsapp/template/list' \
  -d 'apiToken=API-KEY' \
  -d 'phone_number_id=PHONE-NUMBER-ID'
  ```
</CodeGroup>

## Exemplo de Resposta

<CodeGroup>
  ```json Sucesso theme={null}
  {
    "status": "1",
    "message": {
      "id": 48,
      "template_id": "437509121867805",
      "whatsapp_business_id": 11,
      "template_name": "ada",
      "template_type": "single",
      "locale": "en_US",
      "header_type": "media",
      "header_subtype": "image",
      "header_content": "",
      "body_content": "To send an interactive message template, make a POST call to /PHONE_NUMBER_ID/",
      "footer_content": "",
      "button_content": "[]",
      "template_json": "{\"name\":\"template_23_1666095188\",\"language\":\"en_US\",\"category\":\"transactional\",\"components\":[{\"type\":\"header\",\"format\":\"image\",\"example\":{\"header_handle\":[\"https:\\/\\/example.com\\/assets\\/images\\/template\\/image.jpg\"]}},{\"type\":\"body\",\"text\":\"To send an interactive message template, make a POST call to \\/PHONE_NUMBER_ID\\/\"}],\"access_token\":\"EAAHFAlhZBSyEBAIRZCsHKZA5ZAdOWMRL7AwuuCBKd3tZChAQQ1PHojPUS5k76aMVyzzxG9bYp2JQ57aLMfQBCZCpvXKac4KLDZAhejOuw1zkNCxGjvK7J5YwNmZBwTTd8Iig2YDq0vGZBoS20ipsLB4scbOOh0WmQrj7oLI9ZC5rFlsFC9mYctgQKIyJCvZBfgn5pGE1YPiBllrqwZDZD\"}",
      "button_type": "none",
      "variable_map": "{\"header\":[],\"body\":[]}",
      "updated_at": "2022-10-18 12:13:09",
      "user_id": 1,
      "status": "Rejected",
      "system_template": "0",
      "map_needed": "0",
      "check_wp_type": "general"
    }
  }
  ```

  ```json Erro theme={null}
  {
    "status": "0",
    "message": "Invalid API Key."
  }
  ```
</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/template/list">
  ```json theme={null}
  {
    "apiToken": "SUA_API_KEY_AQUI",
    "phone_number_id": "SEU_PHONE_NUMBER_ID"
  }
  ```
</Playground>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
    'https://app.wizebot.com.br/api/v1/whatsapp/template/list' \
    -d 'apiToken=SUA_API_KEY_AQUI' \
    -d 'phone_number_id=SEU_PHONE_NUMBER_ID'
  ```

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

  const data = {
    apiToken: 'SUA_API_KEY_AQUI',
    phone_number_id: 'SEU_PHONE_NUMBER_ID'
  };

  axios.post('https://app.wizebot.com.br/api/v1/whatsapp/template/list', 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/template/list';

  $data = array(
    'apiToken' => 'SUA_API_KEY_AQUI',
    'phone_number_id' => 'SEU_PHONE_NUMBER_ID'
  );

  $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",
    "message": {
      "id": 48,
      "template_id": "437509121867805",
      "whatsapp_business_id": 11,
      "template_name": "ada",
      "template_type": "single",
      "locale": "en_US",
      "header_type": "media",
      "header_subtype": "image",
      "header_content": "",
      "body_content": "To send an interactive message template, make a POST call to /PHONE_NUMBER_ID/",
      "footer_content": "",
      "button_content": "[]",
      "template_json": "{\"name\":\"template_23_1666095188\",\"language\":\"en_US\",\"category\":\"transactional\",\"components\":[{\"type\":\"header\",\"format\":\"image\",\"example\":{\"header_handle\":[\"https:\\/\\/example.com\\/assets\\/images\\/template\\/image.jpg\"]}},{\"type\":\"body\",\"text\":\"To send an interactive message template, make a POST call to \\/PHONE_NUMBER_ID\\/\"}],\"access_token\":\"EAAHFAlhZBSyEBAIRZCsHKZA5ZAdOWMRL7AwuuCBKd3tZChAQQ1PHojPUS5k76aMVyzzxG9bYp2JQ57aLMfQBCZCpvXKac4KLDZAhejOuw1zkNCxGjvK7J5YwNmZBwTTd8Iig2YDq0vGZBoS20ipsLB4scbOOh0WmQrj7oLI9ZC5rFlsFC9mYctgQKIyJCvZBfgn5pGE1YPiBllrqwZDZD\"}",
      "button_type": "none",
      "variable_map": "{\"header\":[],\"body\":[]}",
      "updated_at": "2022-10-18 12:13:09",
      "user_id": 1,
      "status": "Rejected",
      "system_template": "0",
      "map_needed": "0",
      "check_wp_type": "general"
    }
  }
  ```

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

  ```json Erro - Parâmetros Inválidos theme={null}
  {
    "status": "0",
    "message": "Missing required parameters."
  }
  ```
</ResponseExample>
