server.post(routePath, (req, res) => { this.adapter.processActivity(req, res, async (context) => { if (context.activity.type === ActivityTypes.Message) { try { const input = { message: context.activity.text, channel: `msbf-${context.activity.channelId}`, app: this.container.name, msbfContext: context,
// Listen for incoming requests. server.post('/api/messages', (req, res) => { adapter.processActivity(req, res, async (context) => { if (context.activity.type === ActivityTypes.Invoke) await messageExtension.run(context); else await bot.run(context); }); });
constructor() { super(); this.onMessage(async (context, next) => { TurnContext.removeRecipientMention(context.activity); const text = context.activity.text.trim().toLocaleLowerCase(); await context.sendActivity('You said ' + text); }); }
/** * * @param {ConversationState} conversationState * @param {UserState} userState * @param {Dialog} dialog */ constructor(conversationState, userState, dialog) { super(conversationState, userState, dialog); this.onMembersAdded(async (context, next) => { const membersAdded = context.activity.membersAdded; for (let cnt = 0; cnt < membersAdded.length; cnt++) { if (membersAdded[cnt].id !== context.activity.recipient.id) { await context.sendActivity('Welcome to TeamsBot. Type anything to get logged in. Type \'logout\' to sign-out.'); } } await next(); }); }