[英]Send a Slack message to a user on a channel using Python
I am using Slack real time messaging API with Python and want to send a message to a user on a channel, using@ like @hellobot create a directory test2002. 我正在将Slack实时消息传递API与Python结合使用,并希望使用@像@hellobot这样,将消息发送给频道上的用户,创建一个目录test2002。
The given code doesn't work: 给定的代码不起作用:
slack_client.api_call("chat.postMessage", channel='#bot',text="create directory test2002",username='ecstesting1989')
If I use: 如果我使用:
slack_client.api_call("chat.postMessage", channel='#bot',text="@hellobot create directory test2002",username='ecstesting1989')
This sends the command as @hellobot create directory test2002 in text format and doesn't work. 这将以文本格式将命令作为@hellobot create directory test2002发送,并且不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.