Slack API Channel.history

我有一个NodeJS文件的两个API调用松懈,通过api张贴消息工作正常,但试图获得渠道历史返回JSON { error: "channel_not_found", ok: false }

令牌是硬编码的。

chat.js

 Chat.sendMessage = function (text, callback) { slack.api('chat.postMessage', { text:text, as_user:true, channel:'#webhooksapi' }, function(err, response){ callback(null,response); }); } //Getting error on this function Chat.getMessage = function (channel, callback){ slack.api('channels.history', { token:apiToken, channel:'#webhooksapi' }, function(err, response){ callback(null, response); }); } 

根据api手册“通道价值无效”。 api.slack.com/methods/channels.history

当从闲置运行channels.history api时,您需要传递频道ID而不是名称。 所以在我的情况下channel: 'C1234567890'