Git Product home page Git Product logo

internals's Introduction

BotMan

Latest Version on Packagist Build Status codecov Scrutinizer Code Quality Packagist StyleCI Slack Monthly Downloads

https://phppackagedevelopment.com

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course.

About BotMan

BotMan is a framework agnostic PHP library that is designed to simplify the task of developing innovative bots for multiple messaging platforms, including Slack, Telegram, Microsoft Bot Framework, Nexmo, HipChat, Facebook Messenger and WeChat.

$botman->hears('I want cross-platform bots with PHP!', function (BotMan $bot) {
    $bot->reply('Look no further!');
});

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course.

Documentation

You can find the BotMan documentation at https://botman.io.

Stand Alone Configuration

If you are installing Botman in a stand alone Laravel application, you can publish the configuration file with the following command:

php artisan vendor:publish --tag=config --provider="BotMan\BotMan\BotManServiceProvider"

Support the development

Do you like this project? Support it by donating

Contributing

Please see CONTRIBUTING for details.

0 1 2 3 4 5 6 7

Security Vulnerabilities

If you discover a security vulnerability within BotMan, please send an e-mail to Marcel Pociot at [email protected]. All security vulnerabilities will be promptly addressed.

License

BotMan is free software distributed under the terms of the MIT license.

internals's People

Contributors

mpociot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

internals's Issues

Add botman command cache

Laravel has artisan command php artisan route:cache that caches all routes in order to increase app speed.

I am not sure how significant speed increase that would be but we could cache is similar way commands and events.

Consider the case where on one server is bot and web access point, admin dashboard for example. route/botman.php is loaded (processed) on every page hit.

Add a "initialize" method to the Conversation class

If a developer wants to quick access some fields in a conversation, he can extends the Conversation class and add those fields. In case those fields needs to be instantiated, the extended class can implements a "initialize" method that will be executed before the run method.

Add getLanguageCode to src/Users/User.php shared methods

Add to User.php:

class User implements UserInterface
{
    /** 
    * @return string
    */
    public function getLanguageCode() {
    }
}

The function MUST return the IETF language tag of the user's language if available, null otherwise.

Note:

  • Telegram returns exactly the IETF language tag of the user's language
  • Facebook returns the locale in the form en_US, in such case the function MUST return the first two chars

Support for Facebook Messenger `element_share`

Botman should support the share_contents field for the button of type element_share.
Here's the facebook documentation: https://developers.facebook.com/docs/messenger-platform/reference/buttons/login#example_body
and here an example of the payload:

"buttons": [
    {
      "type": "element_share",
      "share_contents": { 
        "attachment": {
          "type": "template",
          "payload": {
            "template_type": "generic",
            "elements": [
              {
                "title": "I took Peter's 'Which Hat Are You?' Quiz",
                "subtitle": "My result: Fez",
                "image_url": "https://bot.peters-hats.com/img/hats/fez.jpg",
                "default_action": {
                  "type": "web_url",
                  "url": "http://m.me/petershats?ref=invited_by_24601"
                },
                "buttons": [
                  {
                    "type": "web_url",
                    "url": "http://m.me/petershats?ref=invited_by_24601", 
                    "title": "Take Quiz"
                  }
                ]
              }
            ]
          }
        }
      }
    }
  ]

Add getParameter() to IncomingMessage class to enable deep linking

Some drivers have a deep linking mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot โ€” or an auth token to connect the user's Telegram account to their account on some external service.

class IncomingMessage
{
    /**
    * @return string
    */
    public function getParameter() {
    }
}

This function MUST return the parameter passed in the link.

Note:

  1. Telegram: https://core.telegram.org/bots#deep-linking
  2. Facebook: https://developers.facebook.com/docs/messenger-platform/discovery/m-me-links

Manage Slack OAuth flow

In order to facilitate App distribution the Slack Driver can support the OAuth flow, here's the Slack docs: https://api.slack.com/docs/oauth

Before activating public distribution, please remove any hard-coded information from your app, such as OAuth tokens and webhook URLs. Going forward, you should authorize your app for use on your workspace with OAuth, just like anybody installing your app on their own workspace would do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.