It's the bot for pizzerias shop based on Moltin.
The bot can show all products, choose a product, and show its description and its image. You can buy pizza or several pizzas and place your order. To place your order, send your location via bot and pay the order via bot.
Temporality users data stored in Redis.
Bot in Telegram (find it @dvmn_pizzashop_bot):
Bot in FB Messanger:
Bot in VK(write it in https://vk.com/club182098076):
-
Create your online shop on Moltin, and create your goods. Get your Client ID and Client secret.
-
Create a bot in Telegram @via BotFather, and get it API token.
-
via @BotFather choose your bot, choose Payments and bank for your payments. And get Bank token.
-
Create redis account in Redislabs, and after that create cloud database (you can choose free plan). Get your endpoint database url and port.
-
Create page in Facebook, create Facebook's app and setting messenger permissions for it. You need to choose
messages
andmessaging_postbacks
. Get access token and write it into .env. Plug in webhook into your app. -
For VK, you have to create public group and create app for bot. After that create your token via Implicit Flow and get access_token from browser
-
Some parameters you need for it:
client_id
= app id (get it from app setting)group_ids
= id your public group,redirect_uri=https://oauth.vk.com/blank.html
scope=messages,photos
Create file .env in the root and write in it:
MOLTIN_CLIENT_ID=your moitin client id
MOLTIN_CLIENT_SECRET=your moltin secret key
TG_TOKEN=your telegram bot's token
TG_TRANZZO_TOKEN=bank token for payments
PAYMENT_PAYLOAD=you very secure payload
REDIS_URL=redis database endpoint without port
REDIS_PORT=redis database port
REDIS_PASSWORD=redis password
FB_PAGE_TOKEN=your token from FB app
FB_VERIFY_TOKEN=digits for verify your webhook
VK_TOKEN=token for vk
Python3 must be already installed.
Should use virtual env for project isolation.
Then use pip (or pip3, if there is a conflict with Python2) to install dependencies:
pip install -r requirements.txt
Set env vars:
export TG_TOKEN=token
export MOLTIN_CLIENT_ID=id client
export MOLTIN_CLIENT_SECRET=client secret
export YANDEX_API_KEY=yandex key to use map
export TG_TRANZZO_TOKEN=telegram tranzo token
export PAYMENT_PAYLOAD=payload for tg payment
Install redis local and restart it in Ubuntu:
sudo systemctl enable redis-server.service
And run bot:
python async_tg_bot.py
To run telegrem bot:
python tg_bot.py
To run facebook bot you must configure Flask webhook on the server:
To run locally use ngrok
and run script:
python fb_bot.py
To run VK bot:
python vk_bot.py