Slack app_home_opened event calling twice

Viewed 689

I have build a slack app.But for onbording process slack app_home_opened event calling twice. I have checked both events are triggered at almost same time. Code

from slackeventsapi import SlackEventAdapter

slack_events_adapter = SlackEventAdapter(
    Constants.ENV["SLACK_APP_SIGNING_SECRETS"], "/slack/events", app
)


@slack_events_adapter.on("app_home_opened")
def app_home_opened(event_data):
    threading.Thread(target=handleOnBording).start()
    return "", 200


First event payload:

{
    'token': '*****',
    'team_id': 'T311FQLU8CT',
    'api_app_id': 'K711C41FET3',
    'event': {
        'type': 'app_home_opened',
        'user': 'F511MQLU8KB',
        'channel': 'E211HGWLUKG',
        'tab': 'messages',
        'event_ts': '1590756776.195938'
    },
    'type': 'event_callback',
    'event_id': 'Ev014P7CG7N0',
    'event_time': 1590756776
}

Second event payload:

{
    'token': '*******',
    'team_id': 'T311FQLU8CT',
    'api_app_id': 'K711C41FET3',
    'event': {
        'type': 'app_home_opened',
        'user': 'F511MQLU8KB',
        'channel': 'E211HGWLUKG',
        'tab': 'messages',
        'event_ts': '1590756776.212203'
    },
    'type': 'event_callback',
    'event_id': 'Ev014FLBULHK',
    'event_time': 1590756776
}

I am using slackeventsapi package of python to interact with slack.I understand slack retries the request if we don't respond in 3 seconds but i am responding within 3 seconds to every request.

1 Answers

This might not really be the expected resolution to this issue, but: I've reached out to the Slack team about this, and it turns out it's a bug, and they are aware of it, though they don't seem to have an ETA on when it's going to be fixed.

With that in mind, I'm afraid if you're experiencing this issue, you should look into implementing a workaround in your events API, that will guarantee you'll only handle one of the events in the series. Depending on your use case and your infrastructure (database, frameworks, etc.), the actual solutions may differ.

Related