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

# Editar Mensagem

<Card title="Webhook relacionado: Editada" icon="bolt" href="/webhook-reference/events/editado" horizontal>
  A edição de uma mensagem dispara o evento **Editada** no seu webhook.
</Card>

## Descrição

Este endpoint permite editar uma mensagem existente. Você pode atualizar o texto de uma mensagem previamente enviada.

### Parâmetros

<ParamField body="appkey" type="string" required>
  Chave de aplicação.
</ParamField>

<ParamField body="authkey" type="string" required>
  Chave de autenticação do usuário.
</ParamField>

<ParamField body="editMessage" type="string" required>
  ID da mensagem que será editada.
</ParamField>

<ParamField body="to" type="string" required>
  Número de telefone no formato internacional ou ID do grupo para onde a mensagem será enviada.
</ParamField>

<ParamField body="message" type="string" required>
  Novo texto da mensagem.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://chatbot.menuia.com/api/create-message \
    -H "Content-Type: application/json" \
    -d '{
      "appkey": "SUA_APPKEY_AQUI",
      "authkey": "SUA_AUTHKEY_AQUI",
      "editMessage": "3FE2B7FE47A0E950B89A",
      "to": "+558175040503",
      "message": "Olá"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://chatbot.menuia.com/api/create-message', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      appkey: 'SUA_APPKEY_AQUI',
      authkey: 'SUA_AUTHKEY_AQUI',
      editMessage: '3FE2B7FE47A0E950B89A',
      to: '+558175040503',
      message: 'Olá'
    })
  });
  ```

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

  response = requests.post(
      'https://chatbot.menuia.com/api/create-message',
      json={
          'appkey': 'SUA_APPKEY_AQUI',
          'authkey': 'SUA_AUTHKEY_AQUI',
          'editMessage': '3FE2B7FE47A0E950B89A',
          'to': '+558175040503',
          'message': 'Olá'
      }
  )
  ```

  ```php PHP theme={null}
  $response = Http::post('https://chatbot.menuia.com/api/create-message', [
      'appkey' => 'SUA_APPKEY_AQUI',
      'authkey' => 'SUA_AUTHKEY_AQUI',
      'editMessage' => '3FE2B7FE47A0E950B89A',
      'to' => '+558175040503',
      'message' => 'Olá'
  ]);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Sucesso theme={null}
  {
    "status": 200,
    "message": "Mensagem editada com sucesso."
  }
  ```

  ```json 401 - Erro de validação theme={null}
  {
    "status": 401,
    "message": "validation.required"
  }
  ```

  ```json 404 - Dispositivo não encontrado theme={null}
  {
    "status": 404,
    "message": "Nenhum dispositivo encontrado."
  }
  ```
</ResponseExample>
