Skip to content

Instantly share code, notes, and snippets.

View mpociot's full-sized avatar

Marcel Pociot mpociot

View GitHub Profile
    location /websockets/ {
       proxy_pass             http://127.0.0.1:6001/;
       proxy_set_header Host  $host;
       proxy_read_timeout     60;
       proxy_connect_timeout  60;
       proxy_redirect         off;
 
<?php
use React\EventLoop\Factory;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Cache\ArrayCache;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\Drivers\Slack\SlackRTMDriver;
$loop = Factory::create();
@mpociot
mpociot / CheckAccessToken.php
Last active February 21, 2018 00:52
Validate access tokens sent through Amazon Alexa requests
<?php
namespace App\BotMan\Middleware;
use BotMan\BotMan\BotMan;
use Laravel\Passport\TokenRepository;
use League\OAuth2\Server\ResourceServer;
use Symfony\Component\HttpFoundation\Request;
use BotMan\Drivers\AmazonAlexa\Extensions\Card;
use BotMan\BotMan\Interfaces\Middleware\Received;
@mpociot
mpociot / link-between-messengers.php
Last active May 20, 2019 23:16
Use BotMan to link between multiple messenger services
@mpociot
mpociot / facebook.php
Created January 30, 2018 20:22
Facebook Multitenancy Config
<?php
return [
/*
|--------------------------------------------------------------------------
| Multitenancy Support
|--------------------------------------------------------------------------
|
| Here you can decide wether your chatbot supports multiple
@mpociot
mpociot / web.php
Last active February 6, 2018 03:19
Using link buttons and deep linking for a seamless flow between your service and Slack with BotMan Studio
<?php
use BotMan\Drivers\Slack\SlackDriver;
Route::get('/', function () {
$task_id = uniqid();
// Send the message to the channel
$result = app('botman')->say('example', '#botman-tests', SlackDriver::class, [
'attachments' => json_encode([
<?php
namespace Tests\BotMan;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
@mpociot
mpociot / README.md
Last active March 25, 2021 18:48
Discord + BotMan example

BotMan - Discord example chatbot

Once you set up your discord bot, you need to add it to your server:

Look up your chatbot's client ID and visit this URL:

https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=0

Run the discord.php file through CLI:

@mpociot
mpociot / FetchGitHubTotals.php
Last active November 6, 2024 14:28
GitHub component for the excellent Spatie dashboard package from https://github.com/spatie/dashboard.spatie.be
<?php
namespace App\Components\GitHub;
use App\Events\GitHub\FileContentFetched;
use App\Events\GitHub\TotalsFetched;
use GitHub;
use Illuminate\Console\Command;
class FetchGitHubTotals extends Command
@mpociot
mpociot / RasaNLU.php
Created May 17, 2017 14:43
RasaNLU middleware for BotMan
<?php
namespace App\BotMan\Middleware;
use Mpociot\BotMan\Message;
use Mpociot\BotMan\Http\Curl;
use Mpociot\BotMan\Interfaces\HttpInterface;
use Mpociot\BotMan\Interfaces\DriverInterface;
use Mpociot\BotMan\Interfaces\MiddlewareInterface;