# Facebook Messenger

## How to connect a Facebook page

If you already have a Facebook business page, you can connect a bot to it.

{% hint style="warning" %}

#### **IMPORTANT!**

Make sure to create a **Page**, not a Group. Chatbots on Facebook can only be connected to Pages.
{% endhint %}

{% hint style="danger" %}
A bot can only be connected by a page owner or an administrator.
{% endhint %}

First, create a Facebook Business page.

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

To connect Facebook to MaviBot, go to the "Messengers" section and select Facebook.

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

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

Log in to authorize access to your account in the pop-up window. After authorization, you will see a list of your business pages available for connection. Select the one you want to use.

{% hint style="info" %}
You may be offered to connect your **Instagram Business** accounts as well, but this is optional.
{% endhint %}

Next, select the page you want to connect the bot to. Then, choose the permissions for the bot. Be sure to enable all the toggles.

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

If the process was successful, you will see the following window.

{% hint style="warning" %}
Messages must be enabled for the page.
{% endhint %}

You will see a default "Start" button after entering the group.

Don’t forget to include this word in the conditions of the start block.

The welcome message that the user sees before clicking the "Start" button is configured in the Facebook page settings.

### What to do if the required page is not in the list

If you don’t see the group you need in the list, it probably means the builder doesn’t have permissions for that group. You need to grant them.

**To do this:**

Log out from the system using the button in the top right corner.

Click "Log in with Facebook."

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

Click **"Edit settings"**.

Choose the page you want and follow all the steps described at the beginning of the article.

## How to create broadcasts on Facebook

It applies to any messages you send: through chatbots, mass broadcasts, or messages sent manually.

When a user subscribes to a chatbot or initiates a conversation with the company’s page, you have a 24-hour window from that moment to send the user any messages, including promotional ones.

1. If the user doesn’t respond within 24 hours, Facebook allows you to send one more message. This message may include a button and a strong offer to attract the subscriber’s attention and prompt a response.
2. If the user replies within the 24-hour window, a new 24-hour window opens.   &#x20;This happens every time he responds to a message from the chatbot.

This rule has a few exceptions.&#x20;More details: [https://developers.facebook.com/docs/messenger-platform/policy/policy-overview\ <br>](https://developers.facebook.com/docs/messenger-platform/policy/policy-overview)One of them is **Message tags** — a permitted type of message that can be sent even after the 24-hour window has passed.\
\
There are 16 types of Message tags. We chose to use **confirmed\_event\_update** – "Event Reminder." In the future, we may add the option to choose which type of message you want to send.

{% hint style="danger" %}
A**fter 24 hours from the user’s last interaction**, you are only allowed to send messages related to event reminders — such as confirming upcoming bookings, notifying about schedule changes, or reminding users of appointments or events they’ve signed up for.

**Sending any kind of promotional content after the 24-hour window is strictly prohibited.**\
Violating this rule may lead to your Facebook page being blocked.
{% endhint %}

\
An advantage of this solution is that broadcasts don’t require moderation.&#x20;It also gives you a way to work around the 24+1 rule.

## How to work with Facebook Pixel

{% hint style="success" %}
To install the Pixel on our mini landing page, you need to link your own domain to it.
{% endhint %}

Facebook requires the use of verified domains. For detailed instructions on installing the Pixel, read HERE.

## How to create a carousel

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

{% hint style="success" %}
A carousel may contain from 2 to 10 cards (slides).
{% endhint %}

Let’s consider an example of a carousel with 3 cards. To create the cards, you need to enter the following into the "Calculator" field.

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

r = send\_carousel(p, '')

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

{% hint style="info" %}
Please note: The line **r = send\_carousel(p, '')** should be entered on a new line in the calculator input field.
{% endhint %}

{% hint style="danger" %} <mark style="color:red;">**PLEASE NOTE!**</mark>

When creating a carousel card description like

\
{"**title**":"TITLE", "**description**": "DESCRIPTION OF CARD 1", "**image**": "LINK TO IMAGE 1", "buttons":\[{"text":"BUTTON TEXT 1"}]} <br>

it’s important to **fill** in either the **title** <mark style="color:red;">**and**</mark> **description or the image parameter**.
{% endhint %}

First, assign an array with title, description, image, and buttons to the variable p (you can name the variable differently). Then, use it in the method send\_carousel(p, '').

You can also use the table to simply insert the needed titles, links, etc., and then just copy the result into your block.

In the "Response" field, leave #{None}.

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

{% hint style="info" %}
You can insert URLs into the buttons on carousel cards. When a user clicks a button, he will be redirected to the link.
{% endhint %}

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

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

{% hint style="info" %}
An additional optional parameter **payload** has been added to carousel card buttons.&#x20;This parameter won’t be visible to the user but allows you to track and analyze the user’s choice.
{% endhint %}

Since it’s often necessary to have carousel cards with the same button text, an additional parameter called **payload** has been added.

This parameter won’t be visible to the user but allows you to analyze their choice:

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

Please pay attention to its correct usage:\
p = \[{"title": "title","description": "DESCRIPTION OF CARD 1","image": "LINK TO IMAGE 1","buttons":\[{"text": "BUTTON TEXT 1", "payload": "1"}]},{"title": "title","description": "DESCRIPTION OF CARD 2","image": "LINK TO IMAGE 2","buttons": \[{"text": "BUTTON TEXT 1", "payload": "2"}]}, {"title": "title","description": "DESCRIPTION OF CARD 3","image": "LINK TO IMAGE 3","buttons": \[{"text":"BUTTONTEXT 1"}]}]

The payload parameter is optional and can be omitted, as shown in the figure of button 3.


---

# 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/facebook-messenger.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.
