> For the complete documentation index, see [llms.txt](https://docs.suvvy.ai/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.suvvy.ai/en/main-settings/prompts/prompts/sending-images-in-chat.md).

# Sending images in chat

## Sending images via a Knowledge Base file call

To send an image to the chat at the right moment in the dialogue, you need to perform a few simple steps. &#x20;

1. Create a file in **Direct Questions** and name it appropriately.

For example: **Photograph of Portrait Sizes**

<figure><img src="/files/StnolZG9UR7O0bLcTqbw" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
In the file contents, you can write direct text to be sent along with the photo, or write instructions that the agent will execute when calling this file with the image.
{% endhint %}

2. Attach the photo you need to send

You can read in detail how to attach a photo to a file in the [Direct Questions](/en/knowledge-base/baza-znanii/pryamye-voprosy.md) section.

3. In the main prompt, include instructions for the agent as to when they should call the file and send the photo to the chat.

For example:

```
If a client asks to send a visual example of portrait sizes, call the get_file_text("Photograph of Portrait Sizes") function.
```

In this case, Savvi will call this file, execute the text instructions specified in the file's Contents, and send the attached photo to the chat.

## Sending images via a spreadsheet

The essence of this method is that the agent takes a link to an image from a table and sends the full-size image stored at this link to the user in the chat.

If you need an agent to find data in a table for a specific client request and send a photo corresponding to that item, you need to complete a few simple steps:

1. **We create a table** and fill it with the necessary data.

You can read about how to properly prepare and upload a table in the [Working with Tables section.](/en/working-with-tables/tablicy-csv-xls-google.md)

2. We fill one of the table columns with links to images that will be sent to the chat.

<figure><img src="/files/Y5dztCoFGM3PsSDGRHut" alt=""><figcaption></figcaption></figure>

#### Link preparation rule:

Please note that image links must be direct. This means all links must end in .jpg , .jpeg , etc.

The correct format for links is:

{% hint style="warning" %}
✅ <https://i.ibb.co/Y73hfqbM/6732956-C-A157-47-BD-B92-C-D2-CE44-E2054-E.jpg>

❌<https://drive.google.com/file/d/1DGtDpoVjGVDFsWQEnSOUSTyF9F96C0tv/view?usp=drive\\_link>
{% endhint %}

One of the services that can provide you with a direct link to the image: <https://postimages.org/> .

*Please note that the **Postimages** service is not our responsibility and we cannot guarantee its functionality*.

3. After connecting the spreadsheet to Suvvy, you need to create an additional action with a webhook that will convert the link into an image before sending it to the chat.

To do this:

{% stepper %}
{% step %}

### Go to the Actions tab and click Add

<figure><img src="/files/IMRKYm6CrgmWMhOfFunL" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select the Step type - Webhook

<figure><img src="/files/1kUpNQjwQRnCSuEglEZD" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Fill in the action settings fields and enter the `url_photo` argument.

<figure><img src="/files/ZhDyQhcORQn9CzxhfU6D" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### In the URL field, add our argument, enable the Return response as file flag, and select Type - Image.

<figure><img src="/files/DRLLIaXPB06dZc4e4xPt" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Click Save

<figure><img src="/files/kzeefyvf5M28443QCiCm" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

4. We add instructions for this action to our agent's main Prompt.

{% hint style="info" %}
After that, you should get all the url\_photo parameters from the photo\_works column and pass these parameters to the url\_to\_photo function.
{% endhint %}

This instruction is used to pass the resulting links to a function with a webhook after a table query to convert the link into a full-size image and send the images to the chat.
