howdyai / botkit

Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
MIT License
11.38k stars 2.29k forks source link

Webex Teams Adapter Doesn't Support direct_mention Event Type #2221

Open bbrougher-cerium opened 2 years ago

bbrougher-cerium commented 2 years ago

What was the result you received?

When trying to have my bot respond to a direct_mention event, nothing happened. The event came across into the express server and my controller event was never triggered.

What did you expect?

I expected my controller event handler (snippet below) to run, but nothing happened.

import { Botkit } from "botkit";
import { WebexAdapter } from "botbuilder-adapter-webex";
import { Express } from "express";

const adapter = new WebexAdapter({
  enable_incomplete: true,
  access_token: process.env.ACCESS_TOKEN,
  public_address: process.env.PUBLIC_ADDRESS,
});

const controller = new Botkit({
  webhook_uri: "/api/messages",
  adapter,
});

controller.on("direct_mention",
  async (bot, message): Promise<void> => {
    console.log("Received message: ");
    console.info(message);
    await bot.reply(message, "Hello!");
  }
);

controller.ready(() => {
  console.log("Bot loaded.");
});

const app: Express = controller.webserver;

app.get("/", (req, res) => {
  res.send(`This app is running. Botkit version: ${controller.version}`);
});

Context:

I have a PR with some small code changes that seem to be working for my use case that I will submit shortly.