[英]How to post formatted message into a channel with Slack API
I have a json formatted message like this , I want to post this message into Slack with Slack postMessage API . 我有一个JSON格式的消息像这样 ,我想这个消息后与松弛松弛的postMessage API 。 Pasting the json string into
text
section would not work, how/where should I input that? 将json字符串粘贴到
text
部分中将不起作用,我应该在哪里/在哪里输入?
Thanks 谢谢
Using the link you posted, you'll need to generate an API token for your slack account. 使用您发布的链接,您需要为您的备用帐户生成一个API令牌。 After that, choose a channel to post the message and put
之后,选择发布消息的渠道并放入
*bold* `code` _italic_ ~strike~
next to the "text" field. 在“文本”字段旁边。 The message should be posted in your slack channel.
该消息应发布在您的备用频道中。
Since you're using python, you can use the python slack api to do this. 由于您使用的是python,因此可以使用python slack api来执行此操作。 The code would then be
该代码将是
from slackclient import SlackClient
slack_client = SlackClient(API TOKEN)
slack_client.api_call("chat.postMessage", channel=CHANNEL ID, text="*bold* `code` _italic_ ~strike~", as_user=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.