All Projects → Bogdaan → Viber Bot Php

Bogdaan / Viber Bot Php

Licence: mit
Php bot interface to work with Viber API

Labels

Projects that are alternatives of or similar to Viber Bot Php

Line Bot Sdk Go
LINE Messaging API SDK for Go
Stars: ✭ 654 (+223.76%)
Mutual labels:  bot, sdk
Matrix Bot Sdk
TypeScript/JavaScript SDK for Matrix bots
Stars: ✭ 63 (-68.81%)
Mutual labels:  bot, sdk
Line Bot Sdk Nodejs
LINE Messaging API SDK for Node.js
Stars: ✭ 683 (+238.12%)
Mutual labels:  bot, sdk
Pymessager
Python API to develop chatbot on Facebook Messenger Platform
Stars: ✭ 580 (+187.13%)
Mutual labels:  bot, sdk
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+4596.04%)
Mutual labels:  bot, sdk
Line Bot Sdk Php
LINE Messaging API SDK for PHP
Stars: ✭ 601 (+197.52%)
Mutual labels:  bot, sdk
Circuit Sdk
JavaScript and Node.js SDK for Circuit
Stars: ✭ 18 (-91.09%)
Mutual labels:  bot, sdk
Botlibre
An open platform for artificial intelligence, chat bots, virtual agents, social media automation, and live chat automation.
Stars: ✭ 412 (+103.96%)
Mutual labels:  bot, sdk
Mirai Ts
🔧 Mirai(QQ Bot) JavaScript/TypeScript SDK for Node.js/Browser
Stars: ✭ 86 (-57.43%)
Mutual labels:  bot, sdk
Line Bot Sdk Python
LINE Messaging API SDK for Python
Stars: ✭ 1,198 (+493.07%)
Mutual labels:  bot, sdk
Line Bot Sdk Java
LINE Messaging API SDK for Java
Stars: ✭ 484 (+139.6%)
Mutual labels:  bot, sdk
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+995.05%)
Mutual labels:  bot, sdk
Botbuilder Js
Welcome to the Bot Framework SDK for JavaScript repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using JavaScript.
Stars: ✭ 469 (+132.18%)
Mutual labels:  bot, sdk
Botbuilder Dotnet
Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
Stars: ✭ 631 (+212.38%)
Mutual labels:  bot, sdk
Line Bot Sdk Ruby
LINE Messaging API SDK for Ruby
Stars: ✭ 425 (+110.4%)
Mutual labels:  bot, sdk
Botframework Sdk
Bot Framework provides the most comprehensive experience for building conversation applications.
Stars: ✭ 6,673 (+3203.47%)
Mutual labels:  bot, sdk
Line Bot Sdk Perl
LINE Messaging API SDK for Perl
Stars: ✭ 69 (-65.84%)
Mutual labels:  bot, sdk
Botframework Emulator
A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
Stars: ✭ 1,532 (+658.42%)
Mutual labels:  bot, sdk
Js Realtime Sdk
LeanCloud Realtime Message JavaScript SDK
Stars: ✭ 193 (-4.46%)
Mutual labels:  sdk, im
Pay
支付 SDK 的集合与重构,支持支付宝、微信支付、银联支付。
Stars: ✭ 198 (-1.98%)
Mutual labels:  sdk

PHP sdk for Viber api

Build Status

Library to develop a bot for the Viber platform. Create you first Viber bot step by step, see demo at viber://pa?chatURI=viber-bot-php&context=github.com

Installation

composer require bogdaan/viber-bot-php

Example

<?php

require_once("../vendor/autoload.php");

use Viber\Bot;
use Viber\Api\Sender;

$apiKey = '<PLACE-YOU-API-KEY-HERE>';

// reply name
$botSender = new Sender([
    'name' => 'Whois bot',
    'avatar' => 'https://developers.viber.com/img/favicon.ico',
]);

try {
    $bot = new Bot(['token' => $apiKey]);
    $bot
    ->onConversation(function ($event) use ($bot, $botSender) {
        // this event fires if user open chat, you can return "welcome message"
        // to user, but you can't send more messages!
        return (new \Viber\Api\Message\Text())
            ->setSender($botSender)
            ->setText("Can i help you?");
    })
    ->onText('|whois .*|si', function ($event) use ($bot, $botSender) {
        // match by template, for example "whois Bogdaan"
        $bot->getClient()->sendMessage(
            (new \Viber\Api\Message\Text())
            ->setSender($botSender)
            ->setReceiver($event->getSender()->getId())
            ->setText("I do not know )")
        );
    })
    ->run();
} catch (Exception $e) {
    // todo - log exceptions
}

See more in examples directory.

Library structure

.
├── Api
│   ├── Entity.php               
│   ├── Event                     # all remote events ("callbacks")
│   │   ├── Conversation.php      # fires when user open 1v1 chat
│   │   ├── Delivered.php         # fires when message delivered (for each device)
│   │   ├── Factory.php           # Event factory
│   │   ├── Failed.php            # fires when delivery failed (for each device)
│   │   ├── Message.php           # fires when user send message
│   │   ├── Seen.php              # fires when user read message (for each device)
│   │   ├── Subscribed.php        # fires when user subscribe to PA
│   │   ├── Type.php              # available types
│   │   └── Unsubscribed.php      # fires when user unsubscribed
│   ├── Event.php                 # base class for all events
│   ├── Exception                 #
│   │   └── ApiException.php      # remote or logic error
│   ├── Keyboard                  #
│   │   └── Button.php            # all types of buttons here
│   ├── Keyboard.php              # button container
│   ├── Message                   #
│   │   ├── CarouselContent.php   #
│   │   ├── Contact.php           #
│   │   ├── Factory.php           #
│   │   ├── File.php              #
│   │   ├── Location.php          #
│   │   ├── Picture.php           #
│   │   ├── Sticker.php           #
│   │   ├── Text.php              #
│   │   ├── Type.php              # available message types
│   │   ├── Url.php               #
│   │   └── Video.php             #
│   ├── Message.php               # base class for all messages
│   ├── Response.php              # wrap api response
│   ├── Sender.php                # represent bot-sender
│   ├── Signature.php             # signature helper (verify or create sign)
│   ├── User                      #
│   │   └── State.php             # user state (online/offline etc)
│   └── User.php                  # viber user
├── Bot                           #
│   └── Manager.php               # manage bot closures
├── Bot.php                       # bot class
└── Client.php                    # api client

Read more

Features

  • [x] all api entities
  • [x] validate request and response signs
  • [x] provide webhook interface
  • [x] provide event interface
  • [ ] wrap all api response to entities
  • [ ] validate api entities before submit?
  • [ ] implement log levels with monolog?
  • [ ] post on public page

Contributing

Pull requests are welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].