slack-ruby / slack-ruby-bot-server-events

Slack commands, interactive buttons, and events extension for slack-ruby-bot-server.
MIT License
71 stars 10 forks source link

Can't handle interaction via block_actions #19

Closed ook closed 1 year ago

ook commented 1 year ago

Hello, I have a app_home_opened that offers static select:

SlackRubyBotServer::Events.configure do |config|
  config.on :event, 'event_callback', 'app_home_opened' do |event|
    # […]
    slack_client.views_publish(view: app_home, user_id: user)
  end
  config.on :action, 'block_actions' do |action|
    # […]
  end
end

No problem with the app_home_opened, the block_kit is correctly published. But when I select a value, the block_actions never enter the config.on :action, 'block_actions' block.

I see that warning on grape level:

18:07:13 web.1  | W, [2023-03-28T18:07:13.802178 #87405]  WARN -- : Grape::Exceptions::ValidationErrors: token is missing, type is missing
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/grape-1.6.2/lib/grape/endpoint.rb:369:in `run_validators'
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/grape-1.6.2/lib/grape/endpoint.rb:263:in `block in run'
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/notifications.rb:208:in `instrument'
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/grape-1.6.2/lib/grape/endpoint.rb:241:in `run'
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/grape-1.6.2/lib/grape/endpoint.rb:320:in `block in build_stack'
18:07:13 web.1  |   /Users/thomas/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/newrelic_rpm-8.8.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'

Any idea on what I do wrong?

Thank you.

ook commented 1 year ago

Ok, found the "issue". The request_url for interactivity was set to /api/slack/event (same as EventSubscription) instead of /api/slack/action, messing the matchers.

crazyoptimist commented 1 year ago

Awesome!