Open wgroenewold opened 3 years ago
Adding the signing key with putenv("SLACK_SIGNING_KEY=blafoobla");
made it work. Maybe adding it to the example would help the next sleep deprivated person ;)
Glad you got it figured out, and thanks for giving the framework a spin. I hope to add a lot more and better documentation over time. I merged your PR as well. I appreciate any feedback as you are developing.
I also definitely recommend adding a logger as you are developing too. You can attach any PSR-3 logger, but there is one included in the package as well.
Example with the logger included:
<?php
use Psr\Log\LogLevel;
use SlackPhp\Framework\App;
use SlackPhp\Framework\Context;
use SlackPhp\Framework\StderrLogger;
putenv("SLACK_SIGNING_KEY=blafoobla");
App::new()
->withLogger(new StderrLogger(LogLevel::DEBUG))
->command('cool', function (Context $ctx) {
$ctx->ack(':thumbsup: That is so cool!');
})
->run();
Could argue with it:
Using getenv() and putenv() is strongly discouraged due to the fact that these functions are not thread safe, however it is still possible to instruct PHP dotenv to use these functions.
Hi,
First of all, your framework looks like a decent piece of work! Could be my lack of sleep but I'm not getting the quick example to work.
Created a new Slack app at https://api.slack.com/apps/ and added the slash command /cool. Slash command is showing up in my client, however it responds with
/cool failed with the error "dispatch_failed"
and my ngrok endpoint shows a 401. Must be something auth related imho.Added the environment variables with https://packagist.org/packages/vlucas/phpdotenv and used the "Signing Secret" from the Slack API as Signing key. Not sure if that's the right one though.
Any kind of help would be appreciated.