【发布时间】:2021-08-22 16:04:36
【问题描述】:
我目前正在使用 BoltJS 编写一个 Slack 机器人,并希望使用 integrated verify() method 添加验证,这需要签名密钥以及传入的请求。问题是,触发 app.command() 方法的命令不提供整个请求。它仅提供有效负载,因此 verify() 方法会引发以下错误:
TypeError: stream.on is not a function
因为没有提供的参数是有效的。
//These are the parameters of the app.command method
export interface SlackCommandMiddlewareArgs {
payload: SlashCommand;
command: this['payload'];
body: this['payload'];
say: SayFn;
respond: RespondFn;
ack: AckFn<string | RespondArguments>;
}
//This is what the SlashCommand Object is made of for context
export interface SlashCommand extends StringIndexed {
token: string;
command: string;
text: string;
response_url: string;
trigger_id: string;
user_id: string;
user_name: string;
team_id: string;
team_domain: string;
channel_id: string;
channel_name: string;
api_app_id: string;
enterprise_id?: string;
enterprise_name?: string;
is_enterprise_install?: string;
}
有什么方法可以在命令处理程序接收到请求之前捕获它,我可以用它来验证它,还是我完全错过了其他东西?我在文档中没有找到任何关于此的内容,但我会在此期间继续查找。
【问题讨论】:
标签: javascript slack slack-api slack-commands