我在使用 reminder
方法使用Slack API设置提醒时遇到问题 .
https://api.slack.com/methods/reminders.add
我想在工作区中为各种人设置提醒 . 我对Slack API文档的理解是,我已经创建了权限 workspace
令牌 . 见https://api.slack.com/docs/token-types#workspace
在发布提醒请求时,我总是收到错误 { ok: false, error: 'user_not_specified' }
. 我已将用户指定为有效负载的一部分,以及 text
, time
和承载令牌 .
奇怪,因为文档说 user
是可选的 . 从有效负载中删除用户会导致相同的错误 .
我在Postman和使用Node Slack API库的简单代码段中收到同样的错误:
const { WebClient} = require('@slack/client');
const token = process.env.SLACK_TOKEN || require('./.config').SLACK_API_TOKEN;
const web = new WebClient(token);
web.reminders.add({text: 'clean up duty', time: 'in 1 minute', user: 'U0FKQ3N94'})
.then((res) => {
console.log(res);
})
.catch(console.error);
知道我做错了什么吗?