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.

"Sorry, this didn't work" error with working Message Shortcut

See original GitHub issue

Hello Slack! I am building Slack app according to your documentation (https://api.slack.com/surfaces/modals/using#modal_response_url) and I have an issue with Slack Message Shortcut. It works almost fine, when I create modal.open - it opens modal window with proper elements. But in Slack application window appears Error in lower right corner “Sorry, this didn’t work. Try again?”. Furthermore everything works fine and I don’t get any errors in logs on my server side. I wondering how to remove this error message. Do I need to send any additional response to Slack server when I execute message shortcut?

In mobile ios application everything works without any additional Errors.

Preview: https://imgur.com/Ag3KcBq

Reproducible in:

def form_and_push_msg_modal(payload):
    # Forming view
    payload = {
        "token": slack_token,
        "trigger_id": payload["trigger_id"],
        "view": view_str,
    }
    r = requests.post("https://slack.com/api/views.open", data=payload, timeout=1)
    r.raise_for_status()

if payload["type"] == "message_action":
    form_and_push_msg_modal(payload)

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. Parse with any library request from Slack if payload[“type”] == “message_action”:
  2. Return any result, even empty body return

Expected result:

Same as I get, but Error message doesn’t appear in slack application.

Actual result:

INFO:     52.23.240.52:0 - "POST /slack/interactions HTTP/1.1" 200 OK
[INFO] slack.reactions (Source: slack/reactions.py:61, Time: 2020-09-17 02:53:13,226) - Slack conversation info response
[INFO] slack.interactions (Source: slack/interactions.py:663, Time: 2020-09-17 02:53:14,376) - SHORTCUT: create-msg

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
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Sep 17, 2020

Modifying the lines should work for you.

diff --git a/integration_tests/samples/basic_usage/views.py b/integration_tests/samples/basic_usage/views.py
index 49ccbb2..5e4de6e 100644
--- a/integration_tests/samples/basic_usage/views.py
+++ b/integration_tests/samples/basic_usage/views.py
@@ -39,8 +39,8 @@ def slack_app():
     if "payload" in request.form:
         payload = json.loads(request.form["payload"])
 
-        if payload["type"] == "shortcut" \
-            and payload["callback_id"] == "open-modal-shortcut":
+        if payload["type"] == "message_action" \
+            and payload["callback_id"] == "(your own callback id here)":
             # Open a new modal by a global shortcut
             try:
                 api_response = client.views_open(

Just in case, I verified this sample works with message shortcuts. I didn’t see any issues.

If your views.open API calls result in {'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] invalid trigger_id [json-pointer:/trigger_id]']}}, make sure your access token (=SLACK_API_TOKEN in this sample).

0reactions
seratchcommented, Sep 28, 2020

It’s great to know you’ve figured out the cause. Let me close this issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Sorry, this didn't work" error with working Message Shortcut
Hello Slack! I am building Slack app according to your documentation (https://api.slack.com/surfaces/modals/using#modal_response_url) and I ...
Read more >
I get an error message 'shortcut has been moved or changed'
I was sorting out my pictures in 'my pictures' folder by dragging and dropping and one of my named folders disappeared!
Read more >
Shortcuts: "There was a problem wi… | Apple Developer Forums
I'm playing with Shortcuts. Siri is telling me "There was a problem with the app" whenever I call the completion handler with a...
Read more >
Shortcut Keys Stop Working - Language Forum @ LingQ
I am using the latest version of chrome on both Windows 11 and a Levovo chromebook. In both environments the shortcut keys stop...
Read more >
7 Common Siri Shortcut Issues + How To Fix Them! - YouTube
Siri Shortcuts are great…when they work. ... Siri Doesn't Run Shortcut on HomePod (Personal Requests) 6:02 - Issue #6: Other People Can't ...
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