> ## Documentation Index
> Fetch the complete documentation index at: https://chatbotx.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Facebook Ads with Chatbot Flows

> Integrate Facebook Ads JSON and Payload IDs with ChatbotX to automate responses when users click Messenger ads.

Click to Messenger ads are a powerful tool for driving leads and engaging customers directly in conversation on Facebook. When potential customers tap the **Send message** call-to-action button on an ad, the opening conversation experience plays a critical role in whether they continue interacting with your brand.

ChatbotX provides full integration between your Facebook ads and automated chatbot flows using two core Meta formats: **Facebook Ads JSON** (structured messages with buttons and rich media) and **Postback Payload IDs** (background payload tokens that trigger flows).

Unlike legacy chatbot builders that require configuring a separate "Ads JSON tool" with complex intermediate steps, ChatbotX automates this workflow entirely. You simply design your chatbot flow in **Flows** and click **Publish**. ChatbotX automatically compiles the starting step into a compliant Meta message template and syncs it directly to Meta Ads Manager under the partner app name **ChatConnectX**.

## Setting Up a Messaging Campaign in Meta Ads Manager

Before connecting your chatbot flow, create an ad campaign with the messaging objective in Meta Ads Manager.

**1. Select the Engagement campaign objective**

In Meta Ads Manager, click the create campaign button. Keep the buying type as **Auction**. Under campaign objective, select **Engagement** and click **Continue**.

![Facebook Ads Campaign Objective Engagement](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_campaign_objective_engagement.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=b1892c0adcf36dbdce41a32a710f8b74)

This objective optimizes ad delivery to reach people most likely to start a conversation with your business on Messenger.

**2. Configure the ad set**

At the Ad Set level, set the conversion location to **Messaging apps**. Under the app selection, check **Messenger** and choose the Facebook Page connected to your ChatbotX workspace.

**3. Set the Call to Action to Send Message**

Navigate to the Ad level, upload your ad creative, and enter your primary text and headline. In the Call to Action dropdown, select **Send message**.

![Facebook Ads Ad Cta Send Message](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_ad_cta_send_message.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=c5b0ce8821c0e04e9570836817e8942e)

The ad preview on the right will display the Send Message button leading directly into your Page's Messenger inbox.

## Designing the Welcome Flow in ChatbotX

To automate responses when users tap your ad, build a dedicated flow in ChatbotX.

**1. Create a new flow**

From the main navigation menu in ChatbotX, go to **Automation** and select **Flows**. Click **+ Create Flow** to start a new flow tailored for your ad campaign.

**2. Configure the starting message step**

Craft the content for the initial message block (**Send Message #1**). Keep the message concise and welcoming, and use the `{{first_name}}` system variable to personalize the greeting.

> [!NOTE]
>
> The initial message block must contain **Buttons** or **Quick Replies**. Under Meta platform policies, an ad click only creates a new Contact and opens the standard 24-hour customer service window once the user actively taps a button or sends a reply.

**3. Connect follow-up steps**

Connect buttons from the first block to subsequent message blocks or actions (**Send Message #2**) to answer questions, collect contact details, or add segmentation tags.

**4. Publish the flow**

Click the **Publish** button in the top right corner of the canvas.

![Facebook Ads Flow Publish Button](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_flow_publish_button.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=36ae9062339438a37f65ab0c5913ae33)

When you click Publish, ChatbotX automatically converts the starting message into Meta's ad template format and syncs it directly to your ad account.

## Three Methods to Connect Flows to Meta Ads

Once your flow is published in ChatbotX, you can choose from three methods to link it to your Meta ad template.

> [card] Partner App Selection
>
> Recommended for most campaigns. Fastest, fully automated via ChatConnectX with zero manual code handling.

> [card] Paste JSON Code
>
> Ideal for copying ad templates across different ad accounts or storing standalone code snippets.

> [card] Postback Payload ID
>
> Use Meta's native conversation templates while triggering ChatbotX flows when users click buttons.

### Method 1: Select the ChatConnectX Partner App Template

This is the fastest and most reliable method recommended by ChatbotX.

**1. Open Saved templates**

At the Ad level in Meta Ads Manager, scroll down to the **Conversations** section. Click the **Saved templates** tab.

![Facebook Ads Meta Saved Templates Partner App](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_saved_templates_partner_app.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=921f234f6814b17b0f210817996d1bb3)

You will see available template sources, including the **ChatConnectX** partner app folder.

**2. Select the synced flow template**

Click the **ChatConnectX** folder and choose the flow template you published in ChatbotX.

![Facebook Ads Meta Partner Template Selection](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_partner_template_selection.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=bda2b94fe78805011a2d24cc0f350c4f)

The mobile preview on the right shows your exact opening message, personalized greetings, and action buttons. Click **Save and finish** to apply the template.

### Method 2: Paste JSON Code Directly

If you prefer to manage templates manually or use them across accounts that are not directly connected, you can copy the raw JSON code directly from your ChatbotX flow.

**1. Open the flow options menu**

In the ChatbotX flow builder, click the three-dots menu icon (`...`) in the top right corner next to the Publish button. Select **Get JSON for Messenger Ads**.

![Facebook Ads Flow Menu Get Json](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_flow_menu_get_json.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=d8797499cda770c5508639cee156466d)

**2. Copy the JSON snippet**

The **Get JSON for Messenger Ads** modal displays the full structured JSON code for the starting step. Click the **Copy** button to copy the code to your clipboard.

![Facebook Ads Flow Modal Copy Json](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_flow_modal_copy_json.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=5b2ffcf6e5d4c2a155078d82341c943a)

> [!NOTE]
>
> You only need to generate a new JSON code if you modify the starting message block. Changes in subsequent blocks take effect automatically without updating this JSON code.

**3. Create a new template in Meta**

In Meta Ads Manager under **Conversations**, click the **+ Create template** button.

![Facebook Ads Meta Create Template Button](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_create_template_button.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=b18de599677fbc6ba51ded018a1c69f7)

**4. Select the JSON template option**

In the **Select a template** modal, scroll to the **Advanced** section, select **JSON** (*Customize your own template with JSON in our code editor*), and click **Next >**.

![Facebook Ads Meta Template Select Json Advanced](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_template_select_json_advanced.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=c52f3dede0cb8efa8e6b0ee9a285cea3)

**5. Paste the JSON code and save**

Delete the default sample code in the JSON editor and paste the code copied from ChatbotX. Check the live mobile preview on the right to verify message display. Enter a name in the **Template name** field and click **Save**.

![Facebook Ads Meta Paste Json Code Preview](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_paste_json_code_preview.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=85062e8e75755097338866c9ddee2f2b)

### Method 3: Use Postback Payload IDs

This method allows you to use Meta's native **Start conversations** template while attaching a postback payload to trigger your ChatbotX flow when the user taps a button.

**1. Get the Payload ID in ChatbotX**

In the ChatbotX flow builder, click the three-dots menu icon (`...`) in the top right corner and select **Get payload for Messenger Ads**.

![Facebook Ads Flow Menu Get Payload](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_flow_menu_get_payload.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=b6bd9549393752598222ecb234a6d0c1)

**2. Copy the Payload ID**

The **Get payload for Messenger Ads** modal displays your flow's unique payload ID. Click **Copy** to save the ID to your clipboard.

![Facebook Ads Flow Modal Copy Payload](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_flow_modal_copy_payload.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=bd29f80aba1319effeeadf571a58b50f)

**3. Create a template in Meta**

In the Conversations section of Meta Ads Manager, click **+ Create template**.

![Facebook Ads Meta Create Template Button](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_create_template_button.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=b18de599677fbc6ba51ded018a1c69f7)

**4. Select Start conversations**

In the **Select a template** modal, choose **Start conversations** (*Suggest prompts for people to tap to encourage them to start conversations with your business*) and click **Next >**.

![Facebook Ads Meta Template Select Start Conversations](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_template_select_start_conversations.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=0f59237b3521066768562dd119b517f5)

**5. Configure the button action and paste the payload**

Under **Customer actions**, set the format to **Buttons**.

Configure the button:

* Enter a button label.
* Set the **Action** dropdown to **Send a postback**.
* In the **Bot payload** field, paste the Payload ID copied from ChatbotX.

![Facebook Ads Meta Button Send Postback Payload](https://mintcdn.com/chatbotx/2O8c-D8d1rpQb90S/images/facebook_ads_meta_button_send_postback_payload.png?fit=max\&auto=format\&n=2O8c-D8d1rpQb90S\&q=85\&s=911df35c2d026b682937e33de05fd0f1)

Review the greeting and button in the chat preview, then click **Save**.

## Comparing Connection Methods

Choose the method that best aligns with your team's workflow and campaign requirements:

| Feature | ChatConnectX Partner App | Direct JSON Code | Postback Payload ID |
| - | - | - | - |
| **Setup Complexity** | Easiest (select from list) | Moderate (copy & paste code) | Moderate (configure button) |
| **Setup Speed** | Fastest (auto-sync on Publish) | Fast | Moderate |
| **Risk of Syntax Errors** | None | Low (unless code is altered) | None |
| **UI Customization on Meta** | Fixed to initial flow step | Fixed to generated JSON | Fully customizable greeting & prompts |
| **Cross-Account Sharing** | Limited to linked account | Flexible across any ad account | Flexible across any ad account |

## Best Practices for Maximizing Ad Conversions

Follow these practical guidelines to maximize conversation rates and ROI from Click to Messenger ads:

### Optimize First-Button Call to Action

Users who click an ad expect immediate relevance. Use clear, value-driven button text such as claiming a discount, viewing pricing, or requesting a free consultation rather than generic phrases.

### Respect the Meta 24-Hour Messaging Window

Meta enforces a 24-hour messaging policy for business communication. When a user taps a button on your ad greeting, this interaction officially opens the standard 24-hour window, enabling your chatbot to send automated follow-up messages at no additional messaging cost.

### Track Campaign Attribution with Custom Fields

Add an **Add Tag** or **Set Custom Field** action in the subsequent steps of your ChatbotX flow to record which ad campaign or offer brought in the contact. This helps your sales team tailor their conversations and gives marketing clear attribution data.

## Frequently Asked Questions

> [accordion] How quickly does a published flow appear in Meta Ads Manager?
>
> The template appears almost immediately in the Saved templates folder under ChatConnectX. If you do not see it right away, simply refresh your Meta Ads Manager browser tab.

> [accordion] Why hasn't the bot triggered follow-up steps after someone clicked my ad?
>
> This is Meta's standard policy to prevent spam. When a user clicks an ad, they only see the opening greeting and buttons. The chatbot flow only continues once the user actively taps a button or sends a reply message.

> [accordion] Do I need to update my ad if I edit later blocks in my flow?
>
> No. You only need to re-sync or update your ad template if you modify the first message block. Any changes made to subsequent steps update automatically in real time whenever you click Publish in ChatbotX.

> [accordion] Can I use the same flow for multiple ads?
>
> Yes. You can select the same ChatConnectX template or paste the same JSON code across multiple campaigns, ad sets, and ads within the same Facebook Page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.