Skip to main content

Ampalibe

Video Tutorials · Documentation · Report Bug

Ampalibe is a lightweight Python framework for building Facebook Messenger bots faster. It provides a new concept, it manages webhooks, processes data sent by Facebook and provides API Messenger with advanced functions such as payload management, item length, and more.

Show your support by giving a star 🌟 if this project helped you!

Installation

pip install ampalibe

OR you can install dev version

pip install https://github.com/iTeam-S/Ampalibe/archive/refs/heads/main.zip

if you use mysql as database, you have to install mysql-connector or mysql-connector-python with ampalibe

pip install ampalibe[mysql-connector]

if you use postgresql as database, you have to install psycopg2 with ampalibe

pip install ampalibe[psycopg2]

if you use mongodb as database, you have to install pymongo with ampalibe

pip install ampalibe[pymongo]

Usage

command-line ampalibe is ampalibe.bat for Windows

ampalibe create myproject

OR

$ cd myproject
$ ampalibe init

to run project, just use

ampalibe run

for dev mode with Hot Reload

ampalibe run --dev

Register for an Access Token

You will need to configure a Facebook application, a Facebook page, get the access to the page, link the application to the page, configure a webhook for your app before you can really start using Ampalibe.

This app setup guide should help

OR

See this video on Youtube

Minimal Application

import ampalibe
from ampalibe import Messenger, Model
from ampalibe.messenger import Action

chat = Messenger()
query = Model()

@ampalibe.before_receive()
def before_process(sender_id, **ext):
    #  Put a view for each message received
    chat.send_action(sender_id, Action.mark_seen)
    return True

@ampalibe.command('/')
def main(sender_id, cmd, **ext):
    """
    No need to manage weebhooks and data: messages are received directly in a main function
    """
    chat.send_text(sender_id, 'Enter your name')

    # define the function of the next treatment
    query.set_action(sender_id, '/get_name')

@ampalibe.action('/get_name')
def get_name(sender_id, cmd, **ext):
    query.set_action(sender_id, None)  #  clear current action
    chat.send_text(sender_id, f'Hello {cmd}')  #  greeting with name enter by user

Documentation

Other resource

Deployment

Using container

Go to our dir project and run

$ docker run -d -v "${PWD}:/usr/src/app" -p 4555:4555 ghcr.io/iteam-s/ampalibe

Using heroku container

  • Go to heroku docs for docker deploys

  • Change your Dockerfile like this

FROM ghcr.io/iteam-s/ampalibe

ADD . /usr/src/app/

# RUN pip install --no-cache-dir -r requirements.txt

CMD ampalibe -p $PORT run
  • Customize your Dockerfile if necessary

Using heroku python

Other plateform ?

Maybe just run ampalibe run in the right directory? or specify port if needed ampalibe -p 1774 run

About

Ampalibe is a word of Malagasy origin designating the fruit jackfruit.

We have made a promise to

  • keep it light
  • make it easy to use
  • do it quickly to develop

Contributors

Image des contributeurs GitHub

Community

📌 Extension

📌 Module

Metadata

Release files for ampalibe 1.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ampalibe 1.1.9
File Size Uploaded
ampalibe-1.1.9.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ampalibe 1.1.9
File Interpreter ABI Platform
ampalibe-1.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 54.6 kB

Release files / ampalibe-1.1.9.tar.gz

Download URL ampalibe-1.1.9.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
abbe767108fd22cc673d747971fdcdc11132dd9e23599149f5376eef4ba038b5
BLAKE2b-256 checksum
How to use checksums
7b2076cd920a3ec7d4e7c684ea52bd2906763e091f6bbdbe28afe71b00135d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / ampalibe-1.1.9-py3-none-any.whl

Download URL ampalibe-1.1.9-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a4f2ebc6dfa77e5afd023a48f9c16e89b864662c7b791aea328b4de7172cd1e
BLAKE2b-256 checksum
How to use checksums
3ce09ffa17986aecd5debe6dd5991d0a57a714ff61f04d77908a99aafc0c7cbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page