> 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="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FZPPzoH2l3diMgQA3Z8iB%2Fimage.png?alt=media&amp;token=6a74a4da-97b4-4607-82df-ad5af1a2e874" 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="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FaB1lzaEl5NOijKSVTnD7%2Fimage.png?alt=media&amp;token=b9cef8a7-c115-4b77-81fe-32b49381ace1" 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="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FZxkYu5MM8Rcdx6RTXG8E%2Fimage.png?alt=media&amp;token=968a25ef-c40e-4382-9df2-5eab3ad812ea" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select the Step type - Webhook

<figure><img src="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FiThM1Z2xBac1DorBUuQn%2Fimage.png?alt=media&amp;token=32097486-a811-41b2-ae82-d78ec5dab058" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

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

<figure><img src="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FR74L8SM4aR2qAbs415hL%2Fimage.png?alt=media&amp;token=a6abcea0-44bd-4aea-b8f5-8c891f3b20d6" 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="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2FJfE5N85wyIHtJnkGywgB%2Fimage.png?alt=media&amp;token=a766d932-bfec-4adf-aa29-434b8bcaa4ee" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Click Save

<figure><img src="https://2542240793-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnmK9dnkx224HgS0VSB5J%2Fuploads%2F38u112tu56zIbknQT9yM%2Fimage.png?alt=media&amp;token=22f9c556-a808-4d95-8868-1931f4c7030f" 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.
