question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invalid `trigger_id` modal.push

See original GitHub issue

I found a bug in Shortcut Modal Push (https://api.slack.com/surfaces/modals/using#pushing_api).

I created a modal by this guide (https://github.com/slackapi/python-slackclient/blob/a86536766274b02f8e6a7532f9b5494f1a8ae354/docs-src/basic_usage.rst#opening-a-modal) and filled it with proper elements (input, submit and etc.) and everything works fine in slack. But when I send client.views_push() I get an error from slack’s server invalid 'trigger_id' Also I tried to reproduce this issue without python-slackclient using requests library and got same result. According to logs I respond to server less then 3 second.

Reproducible in:

client = WebClient(token=slack_token)
view = {
        "type": "modal",
        "title": {"type": "plain_text", "text": "Show me result"},
        "blocks": []
}
try:
        api_response = client.views_push(
            trigger_id=payload["trigger_id"],
            view=view,
        )
        logger.info(api_response)
    except Exception as e:
        logger.error(repr(e))
        raise

The Slack SDK version

slackclient==2.8.2

Python runtime version

Python 3.8.2

OS info

Linux semu 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Steps to reproduce:

  1. if payload[“type”] == “shortcut”: api_response = client.views_open()
  2. elif payload[“type”] == “view_submission”: api_response = client.views_push()

Expected result:

Expected result [‘ok’] == True and slack API except trigger_id.

Actual result:

slack.errors.SlackApiError: The request to the Slack API failed. The server responded with: {'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] invalid 'trigger_id' [json-pointer:/trigger_id]']}}

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
seratchcommented, Sep 13, 2020

Hi @kompotkot thanks for writing in!

In response to a view_submission type request, please use response_action: push in its HTTP response instead of calling views.push API methods. Refer to this document for details: https://api.slack.com/surfaces/modals/using#pushing_views

If you’re using Flask as with the doc you mentioned, constructing a JSON response body containing response_action: push and view, plus building an HTTP response using Flask’s make_response utility method should work for you.

1reaction
seratchcommented, Sep 17, 2020

As I’ve already answered the question here, let me close this issue now. Thanks for asking the question!

Read more comments on GitHub >

github_iconTop Results From Across the Web

invalid `trigger_id` modal.push · Issue #804 - GitHub
I found a bug in Shortcut Modal Push (https://api.slack.com/surfaces/modals/using#pushing_api). I created a modal by this guide ...
Read more >
Why slack gives me invalid trigger error? - Stack Overflow
I am using node.js, here is how my code looks like: dialog_url = "https://slack.com/api/dialog.open" dialog = { "callback_id": "ryde-46e2b0" ...
Read more >
views.push method - Slack API
Push a new view onto the existing view stack by passing a view object and a valid trigger_id generated from an interaction within...
Read more >
45213 – "suffix or operands invalid for `push'" triggered by ... - GNU.org
The bug is in gcc. "pushq $imm32S" only takes 32bit signed extended immediate. You can't push 0xbf800000. Instead, you push -1082130432 or 0xffffffffbf800000....
Read more >
iOS: Invalid token error for push notifications
Handling gateway errors when testing iOS push. ... An invalid token error may be given when testing notifications for a development/enterprise build of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found