松弛对话框。打开框未关闭

时间:2021-01-21 14:49:03

标签: python-3.x slack-api

我看到已经有类似的问题,但建议的解决方案由于某种原因似乎不起作用。

到目前为止,这是我的代码,斜杠命令工作正常,打开弹出窗口,但输入文本并单击请求,弹出窗口没有关闭

from flask import Flask, request, make_response
from slackclient import SlackClient

app = Flask(__name__)
channel = 'GMK3QAU' #test-private
client = SlackClient("xoxb-129609-51804835-PEdmr0WAq")


def dostuff(trigger_id, dialog):
    response = client.api_call(
        "dialog.open",
        channel=channel,
        headers={'content-type': 'x-www-form-urlencoded'},
        trigger_id=trigger_id,
        dialog=dialog)
    return response


@app.route('/refresh-projects', methods=['POST'])
def hello_there():
    trigger_id = request.form['trigger_id']
    dialog = {
        "callback_id": 'refresh_project',
        "title": "Type the string",
        "submit_label": "Request",
        "state": "Limo",
        "elements": [{
            "type": "textarea",
            "label": "Additional information",
            "name": "infobox"}]}
    response = dostuff(trigger_id, dialog)
    return make_response("", 200)


if __name__ == '__main__':
    app.run()

enter image description here

0 个答案:

没有答案