# Buttons and attachments

## How to work with buttons

{% hint style="info" %}
Instagram does not support sending inline and reply buttons at the same time
{% endhint %}

### Keyboard **(reply)**

Instagram supports up to 11 reply buttons. The buttons can only be arranged in a line

Example:

<div data-with-frame="true"><figure><img src="/files/g9cfHfOseeiKyApEoOVy" alt="" width="563"><figcaption></figcaption></figure></div>

Result:

<div data-with-frame="true"><figure><img src="/files/HJ6ISCTj87Ng2Eka3EQX" alt="" width="375"><figcaption></figcaption></figure></div>

### In text (inline)

<div data-with-frame="true"><figure><img src="/files/8MgoKwrk900yN4g4AEQc" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/f9JeNhPlt5AkQ5O4Qe2n" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="danger" %}
Instagram supports no more than 3 inline buttons
{% endhint %}

<div data-with-frame="true"><figure><img src="/files/gbVt5wmVhZiXhvBXY3GZ" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/13TsGZbmULePoGebd5YJ" alt="" width="563"><figcaption></figcaption></figure></div>

The buttons can link to third-party resources. Visually, these buttons are identical.

For instructions on configuring buttons, refer to the **Buttons** section.

## How to work with attachments

You can send attachments in the message.  For more information about which attachments and how to add them, see the [Sending attachments](/chatbot/builder/attachments/tab.md) section in the documentation.

<div data-with-frame="true"><figure><img src="/files/loa9eRHR7LDKqPXFNDI9" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/WoBqCse0S10bFiA53meo" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
You can upload attachments to a block either as a file or by providing a link to the file.

Uploaded video files should not exceed 20 MB, while audio and image files should be no larger than 5 MB.
{% endhint %}

**Attachment requirements:**

| Media file type | Supported format | Maximum size |
| --------------- | ---------------- | ------------ |
| Audio           | M4A              | 5 MB         |
| Image           | JPEG, PNG        | 5 MB         |
| Video           | MP4              | 20 MB        |

{% hint style="warning" %}
It is **NOT** recommended to use the MP4 format for audio attachments. Additionally, **no audio will be sent at all in MP3 format**.
{% endhint %}

## How to create a carousel

The carousel can contain from 2 to 10 cards (slides).

<div data-with-frame="true"><figure><img src="/files/VsUhBLosskpTcNxUCmUp" alt="" width="375"><figcaption></figcaption></figure></div>

Let's use a 3-card carousel as an example. To create the cards, you need to enter the following in the **Calculator** field:

p = \[{"title":"TITLE", "description": "IMAGE DESCRIPTION 1", "image": "LINK TO THE IMAGE 1", "buttons":\[{"text":"BUTTON TEXT 1"}]},{"title":"TITLE", "description": "CARD DESCRIPTION 2", "image": "LINK TO IMAGE 2", "buttons":\[{"text":"BUTTON TEXT 2"}]}, {"title":"TITLE", "description": "CARD DESCRIPTION 3", "image": " LINK TO THE IMAGE 3", "buttons":\[{"text":"BUTTON TEXT 3"}]}]                                              &#x20;

r = send\_carousel(p, '')

<div data-with-frame="true"><figure><img src="/files/rGcoyBnyvspG5dZSWUUf" alt=""><figcaption></figcaption></figure></div>

Copy the link:

<div data-with-frame="true"><figure><img src="/files/P34teCElj79n8OB1k92T" alt=""><figcaption></figcaption></figure></div>

The result:

<div data-with-frame="true"><figure><img src="/files/dHXLEJGGFADaRtFWpzUj" alt="" width="383"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
Please note: the expression `r = send_carousel(p, '')` must start on a new line in the Calculator.
{% endhint %}

That means you need to assign an array containing the title, description, image, and buttons to a variable `p` (name the variable differently if you wish). Then, use this variable in the `send_carousel(p, "")` method.

It leaves `#{None}` in the **"Response"** field.

<div data-with-frame="true"><figure><img src="/files/N7PZt4CW8EIzDa1v2TAN" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
You can add links to the buttons in the carousel cards. When a user clicks the button, they will be directed to the link.
{% endhint %}

To add a link to a button on the card, include it in the array:

p = \[{"title":"title", "description": "CARD DESCRIPTION 1", "image": "LINK TO THE IMAGE 1", "buttons":\[{"text":"BUTTON TEXT 1", "url":"LINK FOR THE BUTTON" }]}]

<div data-with-frame="true"><figure><img src="/files/MGCLCcRFp40J18XgGGcm" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Another optional parameter, `payload`, has been added to the carousel card buttons. It is not displayed to the client but allows you to analyze the client's choice.
{% endhint %}

Since carousel cards often require buttons with identical text, an additional `payload` parameter has been introduced. This parameter is not visible to the client but enables you to analyze their selection.

<div data-with-frame="true"><figure><img src="/files/DBJmIqGKxQlDOghC5ewW" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/AbHANLYFlI8VyNzk5GNS" alt=""><figcaption></figcaption></figure></div>

Pay attention to its proper usage:

p = \[{"title":"title", "description": "CARD DESCRIPTION 1", "image": " 1", "buttons":\[{"text":"BUTTON TEXT 1","payload":"1"}]},{"title":"title", "description": "CARD DESCRIPTION 2", "image": "LINK TO THE IMAGE 2", "buttons":\[{"text":"BUTTON TEXT 1","payload":"2"}]}, {"title":"title", "description": "CARD DESCRIPTION 3", "image": "LINK TO THE IMAGE 3", "buttons":\[{"text":"BUTTON TEXT 1"}]}]

The `payload` parameter can be omitted, as shown in the Figure above.

## How to set introductory phrases

Introductory phrases allow a person to start a chat with a company using a list of frequently asked requests. You can set up to four requests.

<div data-with-frame="true"><figure><img src="/files/cC01KXcWZJmhN8nQdxJK" alt="" width="375"><figcaption></figcaption></figure></div>

To set up introductory phrases, you need to set up a slider in the connected Instagram account, in the “Channels” section.

<div data-with-frame="true"><figure><img src="/files/fUARJELEw2vQYrJmXwrM" alt=""><figcaption></figcaption></figure></div>

After clicking on this slider, a pop-up window appears where you can set the necessary introductory phrases.

<div data-with-frame="true"><figure><img src="/files/Slg4C9eYtPrIsk91tTHz" alt=""><figcaption></figcaption></figure></div>

Then, follow these steps:

1. Set up responses to specific phrases in your funnel.
2. Place the necessary blocks in the "Start" state.
3. Enter the introductory phrase text into the trigger.

{% hint style="warning" %}

#### Please note!&#x20;

Introductory phrases appear for users who have not previously contacted your Instagram account (or if all previous chat history has been deleted).
{% endhint %}

## Set up a keyword response in Direct

To reply to clients in Direct Messages based on keywords, you can use a block with a Trigger (Start and Trigger blocks) and enter the words you want your bot to respond to in the Trigger field:

<div data-with-frame="true"><figure><img src="/files/j13DcyV4WXq29T6dJxAs" alt="" width="375"><figcaption></figcaption></figure></div>

The choice of a match is based on the presence of keywords or a Complete match (recommended options).

In the **"Message text"** field, enter the bot's response that the user will receive. You can also add attachments, buttons, and links.

## **How to check if a user is subscribed to your account**

There are two methods to **check** the subscription status:

1\. Checking subscription using the calculator

**result = check\_insta\_subscription()**

`result` is the variable name where the **check** result will be stored (you can rename it if needed).

The function returns:

* **`True`** if the user is subscribed.
* **`False`** if the user is not subscribed.

<div data-with-frame="true"><figure><img src="/files/yZr5udkFM3L2fOx1zmgi" alt="" width="563"><figcaption></figcaption></figure></div>

The check must be performed in the **"Variable"** field, both on the arrow and in the block.

* `result == True` – an expression in the **"Variable"** field if the client is subscribed to the account.
* `result == False` – an expression if the client is not subscribed.

You can also use other comparison expressions, for example:\
`result != False` (result is not equal to False, meaning the user is subscribed to the account).

<div data-with-frame="true"><figure><img src="/files/of4rJ52kV2DgYurz1D6n" alt=""><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/1WkSjEV36r0my2b4aCFH" alt=""><figcaption></figcaption></figure></div>

2. Data from client card verification

When a user interacts with the bot, the variables `follow` and `followers` are displayed and verified in the client card (under the **Client Variables** subsection).

<div data-with-frame="true"><figure><img src="/files/Q0LOFZKwFM3u9OnNE5FR" alt=""><figcaption></figcaption></figure></div>

**`follow` variable** – verifies subscription status. It takes the value `True` if the client is subscribed to the account, `False` if not subscribed, and `None` if the client's account is closed.

**`verified`** – indicates whether the user has a verified account (blue checkmark). It is `True` if verified and `False` if not.

**`followers`** – shows the number of subscribers/followers the client has.

To check subscription status or restrict funnel progression, you can use the **`follow`** variable in condition blocks or arrow connectors within the **"Variable"** field.

Example:

<div data-with-frame="true"><figure><img src="/files/flucg7cy1apiGzacJMYe" alt="" width="375"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/oA9wzUUvCN7QkjSmoOm5" alt="" width="375"><figcaption></figcaption></figure></div>

In the **Trigger** field, enter any word that will start your funnel.

In the **variable for comparison**, write:\
`follow == True`\
OR\
`follow != False`

* In the first case, you check whether the person is subscribed to your account.
* In the second case, you check whether the person is **not** subscribed to your account.

{% hint style="warning" %}
Please note that the `True` and `False` statuses must be capitalized. Otherwise, the check will not work correctly.
{% endhint %}

To deliver different messages based on subscription status, you need to create two blocks with opposite conditions. If you prefer a less cluttered approach, we recommend defining the conditions on the connections (arrows) instead.

**Triggers on connections:**

<div data-with-frame="true"><figure><img src="/files/AACB7JI9vJOyFlod2kLM" alt="" width="563"><figcaption></figcaption></figure></div>

Enter the trigger in the arrow's **"Variable"** row:\
`follow == True` or `follow != False`

If the trigger condition is met, the client proceeds further down the funnel.

If the client is not subscribed, they go to the block where the verification conditions are not met (`follow == False` or `follow != True`).

If you want the check to be dynamic, we recommend adding a button—for example, **"I have subscribed"**—so the check can be performed and the person can move to the next stage.

{% hint style="danger" %}

#### Attention

We do **NOT** recommend setting a timer without a button on a closed arrow, as the person will receive messages continuously, quickly exhausting your message limit.
{% endhint %}


---

# 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://docs.mavibot.ai/chatbot/messengers/instagram/buttons.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.
