botman / studio

Ready to use BotMan + Laravel framework
331 stars 90 forks source link

Override config #92

Open kurumbus opened 4 years ago

kurumbus commented 4 years ago

I'm working on an app, where a user can create bots for facebook. That in turn requires config (app_secret, token and verification) to be dynamic and not set in config/botman/facebook.php.

So question is: If I use botman studio, can I set configuration and credentials dynamically?

So OK, maybe I shouldn't have chosen exactly "botman studio", but it was a while ago.

I tried `

    DriverManager::loadDriver(\BotMan\Drivers\Facebook\FacebookDriver::class);

    $botman = BotManFactory::create([

        'token' => $x,

        'app_secret' => $y,

        'verification'=> $z,

    ]);

` but it doesn't work. in the log I found that token=null in the sent request

What did work though was setting credentials in the config and just $botman = resolve('botman'); I did that to eliminate the possibility that I messed up the integration part, or that I misunderstood about some token or something.

Thank you for your app and the whole infrastructure though, my work would not be possible without it in the first place

kurumbus commented 4 years ago

ugh silly me, I missed driver key

it should have been

not

[
        'token' => $x,

        'app_secret' => $y,

        'verification'=> $z,
 ]

but


[ 'facebook' =>

        'token' => $x,

        'app_secret' => $y,

        'verification'=> $z,

    ]
]
kurumbus commented 4 years ago

But maybe it would make sense do give an example here? https://botman.io/2.0/driver-facebook-messenger image