如何使用Slack传出Webhook向irccat.etsy.com发送POST请求

时间:2019-07-01 17:56:20

标签: python-3.x slack-api etsy

我正在尝试复制FYI bot,但在下面的步骤中遇到了麻烦。我需要有关如何使用松弛的传出Webhook向irccat.etsy.com发送发布请求的代码的帮助。 我能够创建传出的Webhook,但是我不确定要保留在URL中的内容以及如何向irccat.etsy.com

发送发帖请求

我正在尝试执行的步骤:

“当将:fyi:reacji添加到Slack消息中(或使用?fyi irccat命令)时,传出的Webhook将带有消息详细信息的POST请求发送到irccat.etsy.com。这将触发PHP脚本将消息文本保存到SQLite数据库,并将确认发送回Slack传入Webhook端点。确认中显示“确定!已添加您的FYI”,因此用户知道其FYI已成功添加到数据库中。

此应用无法使用事件API实施,因此以下是我配置发送网络挂钩的方式。 Outgoing Webhook

我需要导致使用传出Webhook的URL并生成对irccat.etsy.com的发布请求

1 个答案:

答案 0 :(得分:0)

you can refer this: https://realpython.com/getting-started-with-the-slack-api-using-python-and-flask/

its like:
Add a new function under channel_info named send_message:

    def send_message(channel_id, message):
        slack_client.api_call(
            "chat.postMessage",
            channel=channel_id,
            text=message,
            username='pythonbot',
            icon_emoji=':robot_face:'
        )

send_message takes in the ID for a channel, then posts a message from our “Python bot” to that channel. In addition, modify the main function so that when we run this file, main will call our new send_message function:
相关问题