Skip to content

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.

License

Notifications You must be signed in to change notification settings

iTeam-S/Ampalibe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ampalibe

Ampalibe is a light Python framework for quickly creating bots Facebook Messenger.
It provides a new concept for creating bots, it manages webhook sides, processes data sent by facebook and provides api messengers with advanced functions.

Documentation status Repository size

Installation

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

Dependencies:

Usage

ampalibe create myproject

OR

$ cd myproject
$ ampalibe init

to run project, just use

ampalibe run

Documentation

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

Advantages

  • No need to manage weebhooks and data: messages are received directly in a main function
import ampalibe
from conf import Configuration

bot = ampalibe.init(Configuration())
chat = bot.chat

@ampalibe.command('/')
def main(sender_id, cmd, **extends):
    chat.send_message(sender_id, 'Hello world')
    chat.send_message(senser_id, f'This is your message: {cmd}')
    chat.send_message(senser_id, f'and this is your facebook id: {sender_id}')

  • Manages the actions expected by the users: define the function of the next treatment
import ampalibe
from conf import Configuration

bot = ampalibe.init(Configuration())
chat = bot.chat
query = bot.query

@ampalibe.command('/')
def main(sender_id, cmd, **extends):
    chat.send_message(sender_id, 'Enter your name')
    query.set_action(sender_id, '/get_name')
    
@ampalibe.action('/get_name')
def get_mail(sender_id, name, **extends):
    query.set_action(sender_id, None)  #  clear current action
    chat.send_message(sender_id, f'Bonjour {name}')

  • Manage temporary data: set, get, and delete
import ampalibe
from conf import Configuration

bot = ampalibe.init(Configuration())
chat = bot.chat
query = bot.query

@ampalibe.command('/')
def main(sender_id, cmd, **extends):
    chat.send_message(sender_id, 'Enter your mail')
    query.set_action(sender_id, '/get_mail')
    
@ampalibe.action('/get_mail')
def get_mail(sender_id, mail, **extends):
    # save the mail in temporary data
    query.set_temp(sender_id, 'mail', mail)
    chat.send_message(sender_id, f'This is your mail: {mail}')

    chat.send_message(sender_id, f'Enter your password')
    query.set_action(sender_id, '/get_password')


@ampalibe.action('/get_password')
def get_password(sender_id, password, **extends):
    query.set_action(sender_id, None)  # clear current action
    mail = query.get_temp(sender_id, 'mail')  # get mail in temporary data

    chat.send_message(sender_id, f'your mail and your password are {mail} {password}')
    query.del_temp(sender_id, 'mail')  # delete temporary data

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages