2017-05-18 47 views
0

我正在使用Slack使用Python的實時消息傳遞API,並希望使用@像@hellobot創建目錄test2002一樣向一個通道上的用戶發送消息。使用Python向使用Python的通道上的用戶發送Slack消息

給定的代碼不起作用:

slack_client.api_call("chat.postMessage", channel='#bot',text="create directory test2002",username='ecstesting1989') 

如果我使用:

slack_client.api_call("chat.postMessage", channel='#bot',text="@hellobot create directory test2002",username='ecstesting1989') 

這將作爲@hellobot文本格式創建目錄test2002和不工作的命令。

回答

0

使用<!頻道>

此外,檢查this

我已經這樣做了here 放JSON作爲

{ 
    "text": "Hello <!channel|>" 
} 

你會得到

Hello @channel 
相關問題