Search code examples
slackslack-block-kitslack-dialogslack-bolt

Slack bolt Modal complex input field


I am pretty new to the Slack bolt SDK and modals but I am running into an issue that I can't seem to find an solution too.I have a Slack app that has a button (action) on the home page that loads a modal to prompt the user for some inputs. The modal contains a plain text field, a multi line plain text field, and 2 drop downs. The issue comes when a user enters some special characters into the multi line plain text field. For example a url like https://us-east-1.console.aws.amazon.com/elasticbeanstalk/home?region=us-east-1#/environment/dashboard?applicationName=appnamet&environmentId=e-123xqwewq

When the user submits this modal, they get a error back from Slack stating "We had some trouble connection" If I remove the & and the # characters from the URL the modal submits with no issues.

My question is how can I take in a multi line field with special characters and even URL encoded characters into a modal? Below is example of my input field. Thanks!

{ "type": "input", "block_id": "input_b", "element": { "type": "plain_text_input", "multiline": true, "action_id": "description" }, "label": { "type": "plain_text", "text": "Describe the issue (Please include as many details and/or requirements as possible)", "emoji": true } }

Tried to have a type of mrkdwn but that seems to not be support by modal inputs


Solution

  • Well I found the issue and it had nothing to do with Slack, the SDK, or the modal. Turns out Cloud Flare was blocking the HTTP request to my app. It saw the request as a possible attack, and was posting a interactive challenge back to Slack, those stopping the communication between Slack and my app. Once I whitelisted traffic from Slack to my app, everything started to work as normal. Hope this helps anyone else that might run across the odd "We had some trouble connecting" error.