Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iTeam-S/Ampalibe

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.
https://github.com/iTeam-S/Ampalibe

ampalibe ampalibe-framework bot chatbot-framework facebook-messenger facebook-messenger-bot framework hacktoberfest hacktoberfest2023 messenger-api messenger-platform python

Last synced: about 1 month ago
JSON representation

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.

Awesome Lists containing this project

README

        

# 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

```s
pip install ampalibe
```

OR you can install dev version

```s
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

```s
pip install ampalibe[mysql-connector]
```

----------------------

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

```s
pip install ampalibe[psycopg2]
```

----------------------

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

```s
pip install ampalibe[pymongo]
```

## Usage

> command-line __ampalibe__ is __ampalibe.bat__ for _Windows_

```s
ampalibe create myproject
```

OR

```shell
$ cd myproject
$ ampalibe init
```

to run project, just use
```s
ampalibe run
```

for dev mode with __Hot Reload__
```s
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](https://developers.facebook.com/docs/messenger-platform/getting-started/app-setup) should help

OR

See [this video](https://www.youtube.com/watch?v=Sg2P9uFJEF4&list=PL0zWFyU4-Sk5FcKJpBTp0-_nDm0kIQ5sY&index=1) on Youtube

### Minimal Application

```python
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):
# Mark as seen 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

- [Ampalibe Readthedocs](https://ampalibe.readthedocs.io/)

#### Other resource

- [ [Youtube] Create a Facebook Bot Messenger with AMPALIBE Framework (EN) ](https://www.youtube.com/playlist?list=PL0zWFyU4-Sk5FcKJpBTp0-_nDm0kIQ5sY)
- [ [Youtube] Tutoriel Framework Ampalibe (FR)](https://www.youtube.com/playlist?list=PLz95IHSyn29U4PA1bAUw3VT0VFFbq1LuP)
- [ [Youtube] Ampalibe Framework Episode (Teny Vary Masaka) ](https://www.youtube.com/playlist?list=PLN1d8qaIQgmKmCwy3SMfndiivbgwXJZvi)

## Deployment

**Using container**

> Go to our dir project and run

```s
$ 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](https://devcenter.heroku.com/articles/container-registry-and-runtime)

- Change your Dockerfile like this

```dockerfile
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**

- Go to heroku docs for [Getting Started on Heroku with Python](https://devcenter.heroku.com/articles/getting-started-with-python?singlepage=true)

- Define your Procfile like this `web: ampalibe -p $PORT run`


**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](https://contrib.rocks/image?repo=iTeam-S/Ampalibe)

## Community

### ๐Ÿ“Œ Extension

- [Ampalibe extension](https://marketplace.visualstudio.com/items?itemName=iTeam-S.ampalibe) by [Raja Rakotonirina](https://github.com/RajaRakoto)

A VScode extension that allows the user to write a snippet of code using easy to remember prefixes


### ๐Ÿ“Œ Module

- [Ampalibe Odoo Addons](https://apps.odoo.com/apps/modules/15.0/ampalibe/) by [Rivo Lalaina](https://github.com/rivo2302)

An Odoo module to synchronize the Ampalibe Framework with Odoo ERP.

### ๐Ÿ“Œ Star History



Star History Chart