简体   繁体   English

通过带有文件附件的 slack api 发布消息

[英]Post message via slack api with file attachment

I am trying to use Python SDK to post a file to Slack.我正在尝试使用 Python SDK 将文件发布到 Slack。 However, I am also trying to mention some people with @ in the uploaded message.但是,我也试图在上传的消息中提及一些带有@人。

I am trying this code:我正在尝试这个代码:

import os
import slack
client = slack.WebClient(token='xoxp-asksjdfj')
res = client.files_upload(channels='#uploads', file='a.txt', title='@john')

However, the title doesn't show up as a mention.但是,标题并未显示为提及。 Is there a way to do that ?有没有办法做到这一点 ? Thanks谢谢

与其将您的提及放在titleinitial_comment将其放在initial_comment

res = client.files_upload(channels='#uploads', file='a.txt', initial_comment='@john')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM