Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Аiober

asyncAIO viBER – Python library for easy creation of Viber bots Currently, Viber bots can only be works using webhooks.

Introduction

...

Let's get started !

Installing

Creating a viber bot is easy !

  1. Install the library with pip install aiober or using git
  2. From aiober import Bot and Dispatcher to your projects
  3. Build a simple script like in Example
  4. Make viber bot here
  5. Using ngrok make your address global (for webhooks)
  6. Run your script
  7. Open Postman and make post request to https://chatapi.viber.com/pa/set_webhook with data {"url":"https://your-domain/update, "auth_token": "auth-token"} for set webhook to viber bot Good, webhook is registred !

Example

Simple echo bot

import asyncio

from aiober import Bot, Dispatcher
from aiober.types import Message

bot = Bot('auth-token')
dp = Dispatcher(bot=bot)

# router
@dp.messages()
async def echo(message: Message):
    await message.copy_to(message.sender.id)


async def main():

    # start webhook
    await dp.start_webhook(
        host='127.0.0.1',
        port=8000,
        path='/update'
    )

asyncio.run(main())

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages