Simple framework for building Instagram chat bots with menu driven interface
Project description
instachatbot
Simple framework for building Instagram chat bots with menu driven interface
Installation
pip3 install instachatbot
To install development version:
pip3 install git+https://github.com/art-vasilyev/instachatbot.git
How to use
Create sample script main.py:
from instachatbot.bot import InstagramChatBot
from instachatbot.nodes import (
MenuNode, MenuItem, MessageNode, QuestionnaireNode, NotifyAdminNode)
menu = MenuNode(
'💡Choose menu:\n',
[
MenuItem(
'text message',
MessageNode('This is a message😀')),
MenuItem(
'questionnaire',
QuestionnaireNode(
[
'What is your favourite book? 📚',
'What is your favourite fruit? 🍐 🍊 🍋'
],
header='Please answer the following questions',
admin_username='<user to send results to>',
response='Thank your for your answers')),
MenuItem(
'send notification to admin',
NotifyAdminNode(
'Thank you',
notification='Sample notification from bot user',
admin_username='<username to send notification to>'
)
),
],
error_message='Failed to select menu.'
)
chatbot = InstagramChatBot(menu=menu)
chatbot.login(
username='<instagram-username>',
password='<instagram-password>')
chatbot.start()
Run the script:
python3 main.py
Persistent conversation state
By default conversation state is discarded on bot restart, to make it persistent you should provide persistent storage on bot initialization:
chatbot = InstagramChatBot(menu=menu, storage=FileStorage())
Menu triggers
By default a bot sends the menu on any message it receives. If you want menu to appear only if bot receives special message, set trigger argument on bot initialization:
chatbot = InstagramChatBot(menu=menu, trigger='/menu')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file instachatbot-0.4.tar.gz.
File metadata
- Download URL: instachatbot-0.4.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b78f750f5a4f0da8df82d49385e570f85f1ab6e69802c52d8fef59ede9e8444
|
|
| MD5 |
4ba97088fbaec22b24826322f99deb94
|
|
| BLAKE2b-256 |
82626a7a61d1c42f9467158a0da8e8b30650dacaa045a776d43f5a26c8fdaee5
|
File details
Details for the file instachatbot-0.4-py3-none-any.whl.
File metadata
- Download URL: instachatbot-0.4-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bfc6ca6eeaf75f24e00156792a04d55c39a472accbd36f6c6efc89880ea3b50
|
|
| MD5 |
aa101d2b2250eeaacd7a659d8cfc3c9f
|
|
| BLAKE2b-256 |
0dae95e1c53387df77058796699a671ea5b204d7d52ef32d5d07f78e77a91557
|