# Request transcript on close

With this tutorial we demonstrate how to easily get the request transcript in JSON format using the request's close event. This event is very useful if you want to send, for example, a personalized email, or if you want to save the conversation messages on an external system or save it on your own CRM.

## Create a new Project

**Step 1** - Fork the backend

To work with webhooks we'll need a web application endpoint where all the chatbot's requests will be forwarded. We'll use the [Replit](https://repl.it) service to fast create our own NodeJS web application endpoint.

Start forking the following app: [Webhook example App on Replit](https://replit.com/@tiledesk/webhook-get-transcript-on-close#index.js)

**Step 2** - Create the Tiledesk project

To use Tiledesk APIs or integrate your own chatbots it is mandatory to signup a new user on [Tiledesk](https://tiledesk.com/). Then go to the console, available on the following link <https://panel.tiledesk.com/v3/dashboard>

After signup please follow the proposed wizard to create your first Tiledesk project.

We choosed "Transcript project" as Project name:

![image](https://user-images.githubusercontent.com/32564846/160700738-3b28d8b9-36b4-4790-b592-a280b8186fe8.png)

As soon as you create the project you will be redirected to the project home (for this tutorial you can ignore the last step, relative to the widget's installation).

Now move in the Settings > Project Settings > Developer section and click on "MANAGE WEBHOOK".

![image](https://user-images.githubusercontent.com/32564846/160711091-bfd89cf5-d21d-4af4-ba03-81ba5919e97b.png)

Add this new webhook, taking care that the endpoint corresponds to the endpoint of your forked replit application followed by */webhooks*.

In our case this is the endpoint.

<https://webhook-get-transcript-on-close.tiledesk.repl.co/webhooks>

Please use your application endpoint so you can modify the code as needed.

![image](https://user-images.githubusercontent.com/32564846/160711171-3751392d-66d2-4295-a39d-f3e2bdf67855.png)

Now the webhook is connected to our backend.

## Analyzing the backend on Replit

The endpoint is the *app.post('/webhooks'...*

The code is explained in the following picture:

![image](https://user-images.githubusercontent.com/32564846/160710821-5b960bd0-cc77-4c70-8063-67e76a8149fc.png)

## Let's run

To run simply choose the "Simulate visitor" button on top of the console. As soon as you close a request the webhook is invoked and the transcript downloaded.

See you on our next tutorial!

Do you have suggestions on this article? Please send us your feedback writing an email to <info@tiledesk.com>


---

# 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://developer.tiledesk.com/apis/tutorials/webhooks/get-transcript-on-close.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.
