1
votes

I am building bot with Bot Builder SDK for Node.js

The bot is for slack

I have configured the slack and botframework correctly, as per the doc Connect a bot to Slack

All communication between botframework, slack and node service is through HTTPS. The framework is communicating with slack properly.

In Next step, I am working on slack dialog.open

First of all, I could not find any method in Bot Builder SDK, to open the slack dialog, I even tried to Implement channel-specific functionality

Finally I was able to open dialog with direct post to: https://slack.com/api/dialog.open

But when I submit the form, I am getting error:

We had some trouble connecting. Try again?

Please see the screenshot: slack dialog box with error

The console displays the following error:

Request URL: https://xxxxx.slack.com/api/dialog.submit

Response: {"ok":false,"error":"curl_error"}

Slack send payload with "type":"dialog_submission".

I have tested that by changing the "Interactive Components -> Request URL", to my bot service. To make slack communicate directly to my bot service. Reference: section "Add and Configure Interactive Messages (optional)" in Connect a bot to Slack

So, I am sure message is being sent from the dialog box, when I click on submit button.

The message is lost between slack and my bot service. when Request URL is set to: https://slack.botframework.com/api/Actions

I never receives any indication that service is receiving a message.

Please help me to resolve this problem.

Following is the code that I used to open the dialog:

let RESTClient = require('node-rest-client').Client;
let FrameworkClient = new RESTClient();
let Promise = require('bluebird');
openDialogBox: function(token, trigger_id, callback_id) {
    return new Promise(function(resolve, reject) {
        var dialog = {
          "title": "Issue Details",
          "submit_label": "Submit",
          "callback_id": callback_id,
          "elements": [
            {
                    "type": "text",
                    "label": "Pickup Location",
                    "name": "loc_origin"
            },
            {
                    "type": "text",
                    "label": "Dropoff Location",
                    "name": "loc_destination"
            }
          ]
        };
        var args = {};
        args.headers = {Authorization: 'Bearer ' + token, 'Content-type': 'application/json; charset=utf-8'};
        args.data = {"trigger_id": trigger_id, "dialog": dialog};
        FrameworkClient.post("https://slack.com/api/dialog.open", args , function(data, response) {
          if (data && data.ok) {
            resolve(data);
          } else {
            reject();
          }
        });
    });
}

Thanks

1
I don't know the botframework, but I have implemented dialogs for my Slack apps. They work very differently from Interactive Messages. So if your framework does not officially support it, I doubt you can make it work. Example: any response back to Slack that is not an empty (excepts for an optional error property) will trigger this error. "We had some trouble connecting..." - Erik Kalkoken
A few follow up questions, are you using .net or node sdk? Can you please share your code you have that has gotten you to this point? Is any activity at all coming to your bot after submitting? - D4RKCIDE
Thanks Erik for your response. I think the error it shows actually occurs, if the request URL, to which slack is posting response, does not respond back within 3 seconds. - Jatinder Kumar
@JatinderKumar After talking through this with the team this is not something you would be able to accomplish via the bot framework we do not support this. You would be able to do this by doing your send/receive outside of the bot and sending the resulting data to your bot. Thank you for bringing this to our attention it is now on our radar and something we will look into supporting in the future. - D4RKCIDE
@JasonSowers Any timeline when can we expect this to be supported? Thanks - Bala

1 Answers

1
votes

As per @JasonSowers (Engineer - Microsoft Bot Framework)

Microsoft Bot Framework do not support this right now.

They may support this in future.