Mobile Chatbot Development for Facebook Messenger

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Mobile Chatbot Development for Facebook Messenger
Simple
from 4 hours to 2 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Facebook Messenger Chatbot Mobile Development

Facebook Messenger Platform is a mature API with a rich set of UI components: Quick Replies, Generic Templates, Buttons, Webview. A bot is registered as a Facebook App and attached to a Facebook Page. For international projects, it's a fully-featured channel.

Setup: App, Page, Webhook

A Messenger bot requires:

  1. Facebook Developer App (developers.facebook.com)
  2. Facebook Page (business page)
  3. HTTPS webhook on your server
  4. Permissions: pages_messaging, pages_read_engagement

Webhook verification is a GET request with hub.verify_token and hub.challenge:

from fastapi import FastAPI, Request, Query

app = FastAPI()
VERIFY_TOKEN = "my_secret_verify_token"
PAGE_ACCESS_TOKEN = "EAAxxxxxxx"  # From Page settings in Developer Console

@app.get("/webhook")
async def verify(
    hub_mode: str = Query(alias="hub.mode"),
    hub_verify_token: str = Query(alias="hub.verify_token"),
    hub_challenge: str = Query(alias="hub.challenge")
):
    if hub_mode == "subscribe" and hub_verify_token == VERIFY_TOKEN:
        return int(hub_challenge)
    return 403

After verification, subscribe the App to required fields via Graph API: messages, messaging_postbacks, messaging_optins.

Sending Messages: Send API

All messages POST to https://graph.facebook.com/v18.0/me/messages?access_token=PAGE_ACCESS_TOKEN:

import httpx

async def send_message(recipient_id: str, message: dict):
    async with httpx.AsyncClient() as client:
        await client.post(
            f"https://graph.facebook.com/v18.0/me/messages",
            params={"access_token": PAGE_ACCESS_TOKEN},
            json={"recipient": {"id": recipient_id}, "message": message}
        )

# Plain text
await send_message(user_id, {"text": "Hi! How can I help?"})

# Quick Replies — one-time buttons under the message
await send_message(user_id, {
    "text": "Choose a category:",
    "quick_replies": [
        {"content_type": "text", "title": "Shipping", "payload": "DELIVERY"},
        {"content_type": "text", "title": "Returns", "payload": "RETURN"},
        {"content_type": "location"}  # Location sharing button
    ]
})

Quick Replies disappear after clicking — this is intentional. For a persistent menu, use messenger_profile with Persistent Menu.

Generic Template: Cards with Buttons

Generic Template is a horizontal carousel of cards. Maximum 10 cards, each with: image, title, subtitle, up to 3 buttons:

await send_message(user_id, {
    "attachment": {
        "type": "template",
        "payload": {
            "template_type": "generic",
            "elements": [
                {
                    "title": "iPhone 15 Pro",
                    "subtitle": "Titanium. So strong. So light.",
                    "image_url": "https://cdn.example.com/iphone15.jpg",
                    "buttons": [
                        {"type": "web_url", "url": "https://example.com/iphone15",
                         "title": "Learn more"},
                        {"type": "postback", "title": "Add to cart",
                         "payload": "ADD_TO_CART:iphone15"}
                    ]
                }
            ]
        }
    }
})

postback is a button without a URL that generates a messaging_postbacks event on your webhook with the specified payload. Used for bot commands.

Sender Actions: Typing Indicator

typing_on and typing_off show a typing indicator. Display it before long responses (database queries, LLM calls):

async def send_with_typing(recipient_id: str, message: dict, delay: float = 1.0):
    await send_action(recipient_id, "typing_on")
    await asyncio.sleep(delay)  # Simulate "thinking"
    await send_action(recipient_id, "typing_off")
    await send_message(recipient_id, message)

Without a typing indicator, responses appear "out of nowhere" — especially critical during LLM latency.

Webview and Extensions

Messenger Extensions lets you open your web app directly in Messenger via a web_url button with messenger_extensions: true. This is similar to Telegram Mini App but with fewer APIs. Use cases: payment forms, catalogs, registrations.

MessengerExtensions.getContext() returns the user's psid for authentication on your server.

Platform Limitations

24+1 window: after the user's last message, the bot can write for 24 hours. After that, only through approved Message Tags (e.g., CONFIRMED_EVENT_UPDATE for event notifications) or the user's subscription to One-Time Notifications.

Development Process

Creating a Facebook App and attaching it to a Page. Webhook setup and subscriptions. Implementing handlers: text messages, postbacks, attachments. UI components: Quick Replies, Generic Template, Persistent Menu. Webview integration for complex forms. Analytics via Facebook Insights.

Timeline Estimates

A basic bot with Quick Replies and Generic Template — 2–3 weeks. A full-featured bot with Webview integration, payment forms, and analytics — 6–10 weeks.