Slackbot 附件 - 这有什么问题吗?
Slackbot Attachment - Is something wrong with this?
我正在使用 howdy 的 botkit 来调用 api postMessage 方法。当我传递附件 属性 时出现 invalid_array_arg
错误。它的发布方式有问题吗
bot.api.chat.postMessage(
{
channel : '#general',
text : 'hi',
parse : true,
username: '@' + bot.identity.name,
as_user : true,
icon_url: listOfMessages.logoUrl,
attachments: [{"pretext": "pre-hello", "text": "text-world"}]
}, function (err,res) {
if(err) console.log(err);
console.log(res);
}
);
我 运行 遇到了同样的问题并通过字符串化数组修复了它。
attachments: JSON.stringify([{"pretext": "pre-hello", "text": "text-world"}])
我正在使用 howdy 的 botkit 来调用 api postMessage 方法。当我传递附件 属性 时出现 invalid_array_arg
错误。它的发布方式有问题吗
bot.api.chat.postMessage(
{
channel : '#general',
text : 'hi',
parse : true,
username: '@' + bot.identity.name,
as_user : true,
icon_url: listOfMessages.logoUrl,
attachments: [{"pretext": "pre-hello", "text": "text-world"}]
}, function (err,res) {
if(err) console.log(err);
console.log(res);
}
);
我 运行 遇到了同样的问题并通过字符串化数组修复了它。
attachments: JSON.stringify([{"pretext": "pre-hello", "text": "text-world"}])