以任何用户名发送松弛消息

时间:2018-02-28 15:13:48

标签: bots slack slack-api

我试图创建一个新的集成来将slack与另一个聊天系统结合起来。 例如,如果有人从skype发送消息,我希望在消息发送到松弛时使用他的名字。现在我使用IncomingWebhook发送消息。

private getWebClient(configuration: ConfigurationData): IncomingWebhook {
    return new IncomingWebhook('https://hooks.slack.com/services/...');
}

const webhook = this.getWebClient(configuration);
await webhook.send(
    {
        text: 'How are you today?',
        as_user: false,
        username: 'slack_integration',
        icon_emoji: ':chart_with_upwards_trend:',
        thread_ts: event.ts
    }
);

正如您所看到的,我也尝试在一个帖子中回复该消息。这也不起作用。我得到的以下事件如下:

{ text: 'How are you today?',
  bot_id: 'B9G8LHME1',
  type: 'message',
  subtype: 'bot_message',
  ts: '1519830326.000061',
  channel: 'C9G4BJ8BW',
  event_ts: '1519830326.000061' }

该消息似乎仍来自我的应用程序。这个名字是" Slack Integration Test" (旁边有徽章App)。

0 个答案:

没有答案
相关问题