PHPackages                             rtippin/messenger-bots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rtippin/messenger-bots

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rtippin/messenger-bots
======================

Messenger Bots Addon

v1.16.0(1y ago)82.0k↓79.6%8MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Jun 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/RTippin/messenger-bots)[ Packagist](https://packagist.org/packages/rtippin/messenger-bots)[ Docs](https://github.com/rtippin/messenger-bots)[ GitHub Sponsors](https://github.com/RTippin)[ RSS](/packages/rtippin-messenger-bots/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (42)Used By (0)

Messenger Bots
==============

[](#messenger-bots)

[![Latest Version on Packagist](https://camo.githubusercontent.com/eff3f32f121fccd5ceb0974cf3e3af44b7e4ff9000977feb41432709c4f844be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7274697070696e2f6d657373656e6765722d626f74732e7376673f7374796c653d706c61737469632663616368655365636f6e64733d33363030)](https://packagist.org/packages/rtippin/messenger-bots)[![Total Downloads](https://camo.githubusercontent.com/cffa87e443f77338b6d9cfe003cff254d7d871b48823d3f35a616062a6855c4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7274697070696e2f6d657373656e6765722d626f74732e7376673f7374796c653d706c61737469632663616368655365636f6e64733d33363030)](https://packagist.org/packages/rtippin/messenger-bots)[![Tests](https://camo.githubusercontent.com/d386af19dc7c4746123a9a5968022e8c02d82b22514a52ceacdbb1ffb8b50b43/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7274697070696e2f6d657373656e6765722d626f74732f746573742e796d6c3f6272616e63683d6d6173746572267374796c653d706c6173746963)](https://github.com/RTippin/messenger-bots/actions)[![StyleCI](https://camo.githubusercontent.com/7b7ed486075485e14d2042c69c86c1b141b6749f12cfeb5eb16205cb3471431d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3337313533393030352f736869656c643f7374796c653d706c61737469632663616368655365636f6e64733d33363030)](https://styleci.io/repos/371539005)[![License](https://camo.githubusercontent.com/0bfcf4d9bf7e469747fd01a6297f58bad6d4ad4afffbd775f5404629d73b8e1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5254697070696e2f6d657373656e6765722d626f74733f7374796c653d706c6173746963)](https://packagist.org/packages/rtippin/messenger-bots)

---

[![Preview](https://raw.githubusercontent.com/RTippin/messenger-demo/master/public/examples/image2.png)](https://raw.githubusercontent.com/RTippin/messenger-demo/master/public/examples/image2.png)

This package is an addon for [rtippin/messenger](https://github.com/RTippin/messenger)
--------------------------------------------------------------------------------------

[](#this-package-is-an-addon-for-rtippinmessenger)

Notice
------

[](#notice)

- This package is not required to use the bots feature built into `Messenger`.
- For more documentation on creating custom bot handlers and packages, visit the official [Chat Bots](https://github.com/RTippin/messenger/blob/1.x/docs/ChatBots.md) documentation.

### Features:

[](#features)

- Ready-made bot action handlers and packages that will plug into the core messenger package.
- Register only the selected bots you wish to use, or let us auto-register all bots we provide.
- Included Bot Handlers:
    - Chuck Norris Bot
    - Coin Toss Bot
    - Commands Bot
    - Dad Joke Bot
    - Document Finder Bot
    - Giphy Bot
    - Insult Bot
    - Invite Bot
    - Joke Bot
    - Kanye West Bot
    - Knock Bot
    - Location Bot
    - Nuke Bot
    - Random Image Bot
    - Reaction Bomb Bot
    - Reaction Bot
    - Reply Bot
    - Rock Paper Scissors Bot
    - Roll Bot
    - Weather Bot
    - Wikipedia Bot
    - YoMomma Bot
    - YouTube Bot
- Included Packaged Bots:
    - Games Package
    - Jokester Package
    - Neo package

---

Prerequisites
=============

[](#prerequisites)

- To use this package, you must already have the core [Messenger](https://github.com/RTippin/messenger) package installed.
- You must have bots enabled from within the [messenger.php](https://github.com/RTippin/messenger/blob/1.x/config/messenger.php) config, or your `.env`.
- The built-in bot subscriber should also be enabled, unless you wish to register your own event subscriber.
- If the subscriber is queued, be sure to have your queue worker process the defined channel, `messenger-bots` is the default.

```
MESSENGER_BOTS_ENABLED=true
```

```
'bots' => [
    'enabled' => env('MESSENGER_BOTS_ENABLED', false),
    'subscriber' => [
        'enabled' => true,
        'queued' => true,
        'channel' => 'messenger-bots',
    ],
],
```

Installation
============

[](#installation)

### Via Composer

[](#via-composer)

```
composer require rtippin/messenger-bots
```

---

Config
======

[](#config)

```
'weather_api_key' => env('BOT_WEATHER_API_KEY'),
'ip_api_key' => env('BOT_LOCATION_API_KEY'),
'youtube_api_key' => env('BOT_YOUTUBE_API_KEY'),
'giphy_api_key' => env('BOT_GIPHY_API_KEY'),
'random_image_url' => env('BOT_RANDOM_IMAGE_URL', 'https://source.unsplash.com/random'),
'auto_register_all' => env('BOT_AUTO_REGISTER_ALL', false),
```

### Publish the config file

[](#publish-the-config-file)

```
php artisan vendor:publish --tag=messenger-bots
```

- To use weather bot, you must get an API key from [Weather API](https://www.weatherapi.com)
- To use YouTube bot, you must get an API key from [Google Developers Console](https://console.developers.google.com)
- To use Giphy bot, you must get an API key from [Giphy](https://developers.giphy.com)
- You may use the location bot without an API key, but for commercial use, you must get an API key from [IP API](https://ip-api.com)
- Random image bot will use unsplash as the default endpoint to grab a random image from. You may overwrite this endpoint.

---

Auto Registering Handlers and Packages
======================================

[](#auto-registering-handlers-and-packages)

- If you plan to use all the bot handlers and packaged bots provided, you can skip registering them manually by enabling the `BOT_AUTO_REGISTER_ALL` flag.

***Update your `.env`***

```
BOT_AUTO_REGISTER_ALL=true
```

---

Manually Registering Handlers and Bot Packages
==============================================

[](#manually-registering-handlers-and-bot-packages)

- Inside your `MessengerServiceProvider` (or any of your providers), you must register all bot handlers and bot packages you want enabled in your application.
- You can use the `MessengerBots` facade to register the handlers and packages. Be sure you do it inside the `boot` method.

***Example:***

```
