> For the complete documentation index, see [llms.txt](https://docs-convai.wavy.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-convai.wavy.global/tips-and-best-practices/gathering-user-feedback.md).

# Gathering user feedback

This tutorial will teach you how to gather feedback from your users about the quality of the bot and send that feedback to an external database for further analysis. In this example we will send the feedback data to Airtable.

* Start by creating a flow in your Chatlayer.ai bot that contains rating options, for example:

![](/files/-MFgED-E8QXJThzTBEU4)

* Make sure you save the rating of the user as a variable "star\_rating" with a number value
* As a Go To, create a new input validation called "long text feedback"

![](/files/-MFgED-G23gcO-IGUyNB)

* Save the additional comments under the "comment" variable, and Go To a newly created Action "send feedback to Airtable"
* In the newly created Action, add a "Code" plugin that contains the following header:

![](/files/-MFgED-IVaCEYS8-XwnJ)

* The "nextDialogState" is where your bot will go after saving the feedback to Airtable
* Create a new Airtable with these columns:

![](/files/-MFgED-JHXoEzY3uN11q)

{% hint style="info" %}
In this tutorial, we will be using [this Airtable](https://airtable.com/shrip6vQuFSy5z7Tz). Feel free to reuse it!
{% endhint %}

* Add the following code to your Code plugin in Chatlayer.ai

```javascript
const body = {
    "records": [{
        "fields": {
            "star_rating": args.star_rating,
            "comment": args.comment,
            "sessionId": args.sessionId
        }
    }]
}
const airtableResult = await fetch('https://api.airtable.com/v0/(insert app name here)/(insert table name here)', {
    method: 'POST',
    body: JSON.stringify(body),
    headers: {
        'Authorization': 'Bearer (insert your bearer token here)',
        'Content-Type': 'application/json'
    }
}).then(r => r.json())

ChatlayerResponseBuilder()
    .setNextDialogState(args.nextDialogState)
    .send()
```

{% hint style="warning" %}
Remember to get the right app id, table name and bearer token for your Airtable. You can find it [here](https://airtable.com/api).
{% endhint %}

* Add a small confirmation to the "feedback recorded" bot dialog
* Ready to test!

![](/files/-MFgED-Kby0E6ur9309H)

* The feedback data from the user shows up in the Airtable, ready for analysis!

![](/files/-MFgED-LCfKPwhmJtPHX)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs-convai.wavy.global/tips-and-best-practices/gathering-user-feedback.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.
