# Webhook

1- Em [Canais>ChatWidget>Código do widget](https://help.cosmobots.io/help/bot-builder/canais/chat-widget/publicando-widget) copie o script fornecido para publicar o widget, por exemplo:

```

 <script
      id="cosmobots-loader"
      src="https://cosmobots.io/js/cosmo-plugin.js"
      cosmo-widget-id="9e146-0524-1105-afa27f0f"
      cosmo-widget-shape="default"
      cosmo-widget-frame="https://chat.cosmobots.io/popwebwidget?bot_id=9e146-0524-1105-afa27f0f"
      cosmo-widget-chat="https://chat.cosmobots.io/widget?bot_id=9e146-0524-1105-afa27f0f">
      </script>
  

```

2-Em **cosmo-widget-chat**, antes de publicar o widget, informe os campos que devem ser preenchidos automaticamente quando o usuário iniciar a interação com o widget, por exemplo:

```
https://chat.cosmobots.io/widget?bot_id=9e146-1105-afa27f0f&u__email=mayara@cosmo.com
```

{% hint style="info" %}
OBSERVAÇÕES:&#x20;

Para passar inserir dados aos campos, basta colocar eles separados por &, por exemplo:

[https://chat.cosmobots.io/widget?bot\_id=9e146-1105-afa27f0f<mark style="color:orange;">**&**</mark>](https://chat.cosmobots.io/widget?bot_id=9e146-1105-afa27f0f&)<mark style="color:purple;">nomedocampo1</mark><mark style="color:orange;">**&**</mark><mark style="color:purple;">nomedocampo2</mark>

Para passar campos vinculados ao objeto usuário, é só digitar u\_\_nomeDoCampo, por exemplo, u\_\_email:

[https://chat.cosmobots.io/widget?bot\_id=9e146-1105-afa27f0f<mark style="color:orange;">**&**</mark>](https://chat.cosmobots.io/widget?bot_id=9e146-1105-afa27f0f&)u\_\_email<mark style="color:orange;">**&**</mark>u\_\_first\_name.
{% endhint %}

![](/files/nSnUzLmUoGoORrXZMoxM)

3-Após inserir os campos, publique o seu widget, seguindo esse tutorial: [**Tutorial**](https://help.cosmobots.io/help/bot-builder/canais/chat-widget/publicando-widget)

4-Quando o usuário iniciar a conversa com seu bot, as informações enviadas nos campos serão automaticamente registradas na base de dados:

![](/files/nfnygNZZc3Lc8jcbFtAd)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.cosmobots.io/help/bot-builder/canais/chat-widget/webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
