# Instagram API

### What is a persistent menu

<div data-with-frame="true"><figure><img src="/files/2cLEwEACUiRmoW8OoO62" alt="" width="230"><figcaption></figcaption></figure></div>

A persistent menu allows you to create and send a menu of your business’s main functions, such as business hours, store locations, and products. It will always be visible during a person’s conversation with your company in Messenger.

#### Supported buttons:

The persistent menu consists of a set of buttons. The following types of buttons are supported in the persistent menu:

● URL buttons (web\_url)\
● Callback buttons (postback)

### How to add a persistent menu

**response = ig\_set\_persistent\_menu(login, buttons),** where:\
**login** - your Instagram login (can be found in the **"Channel"** MaviBot menu)\
**buttons** - a dictionary containing buttons

**Example of how to structure the button dictionary**:\
buttons = {"default": \[\["postback", "Button 1", "callback\_text 1"], \["postback", "Button 2", "callback\_text 2"], \["web\_url", "Site link", "<https://mavibot.ai/"]]}\\>
**default** - a required key that defines the array of buttons to be shown in the menu by default, regardless of the user's localization.\
The value should be an array of buttons. Each button is described as a separate array in the following format:

\["button\_type", "Button display text", "Callback text sent to the bot"]

**Button types and their description:**\
\&#xNAN;*- callback button:*\
\["postback", "Button display text", "Callback text sent to the bot"]\
\&#xNAN;*- URL button:*\
\["web\_url", "Link display text", "<https://example.com>"]

### How to configure the menu based on user localization

You can set up buttons for different regions by adding additional keys to the button dictionary corresponding to specific locales.

For example, to add buttons for English locale:

buttons = {"default": \[\["postback", "Button 1", "callback\_text 1"], \["postback", "Button 2", "callback\_text 2"], \["web\_url", "Site link", "<https://mavibot.ai/>"]], **"en\_EN"**: \[\["postback", "Button", "callback\_text 1"], \["postback", "Button 2", "callback\_text 2"], \["web\_url", "Link", "<https://mavibot.ai/"]]}>

{% hint style="info" %}
Note: In this case, the key represents the locale for which the buttons will be displayed.
{% endhint %}

**Supported locales**:\
af\_ZA, ar\_AR, as\_IN, az\_AZ, be\_BY, bg\_BG, bn\_IN, br\_FR, bs\_BA, ca\_ES, cb\_IQ, co\_FR, cs\_CZ, cx\_PH, cy\_GB, da\_DK, de\_DE, el\_GR, en\_GB, en\_UD, en\_US, es\_ES, es\_LA, et\_EE, eu\_ES, fa\_IR, ff\_NG, fi\_FI, fo\_FO, fr\_CA, fr\_FR, fy\_NL, ga\_IE, gl\_ES, gn\_PY, gu\_IN, ha\_NG, he\_IL, hi\_IN, hr\_HR, hu\_HU, hy\_AM, id\_ID, is\_IS, it\_IT, ja\_JP, ja\_KS, jv\_ID, ka\_GE, kk\_KZ, km\_KH, kn\_IN, ko\_KR, ku\_TR, lt\_LT, lv\_LV, mg\_MG, mk\_MK, ml\_IN, mn\_MN, mr\_IN, ms\_MY, mt\_MT, my\_MM, nb\_NO, ne\_NP, nl\_BE, nl\_NL, nn\_NO, or\_IN, pa\_IN, pl\_PL, ps\_AF, pt\_BR, pt\_PT, qz\_MM, ro\_RO, ru\_RU, rw\_RW, sc\_IT, si\_LK, sk\_SK, sl\_SI, so\_SO, sq\_AL, sr\_RS, sv\_SE, sw\_KE, sz\_PL, ta\_IN, te\_IN, tg\_TJ, th\_TH, tl\_PH, tr\_TR, tz\_MA, uk\_UA, ur\_PK, uz\_UZ, vi\_VN, zh\_CN, zh\_HK, zh\_TW

**Example of a request:**

```
buttons = {"default": [["postback", "Button 1", "callback_text 1"], ["postback", "Button 2", "callback_text 2"], ["web_url", "Site link", "https://mavibot.ai/"]], "en_EN": [["postback", "Button", "callback_text 1"], ["postback", "Button 2", "callback_text 2"], ["web_url", "Link", "https://mavibot.ai/"]]}
response = ig_set_persistent_menu('login', buttons)
```

In case of successful execution, the function returns:\
{"result":"success"}

Otherwise, an error description is returned:

**"Error parse buttons data"** indicates an error in the buttons dictionary.\
{"error":{"message":"(#100) param persistent\_menu\[0]\[call\_to\_actions] must be non-empty.","type":"OAuthException","code":100,"fbtrace\_id":"AJtVczu7TEJJxbMfnO"}}

### How to delete a permanent menu

**response = ig\_delete\_persistent\_menu('login')**, where login - account name

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

In case of successful execution, the function returns:

{"result":"success"}

Otherwise, an error description is returned:

**"Bot not found"**


---

# 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/api.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.
