onMembersAdded event is not firing when installing Teams Bot app from zip - node.js

I would like to send the user a welcome message when they install my MS Teams Bot app. All the samples and documentation point to using the ActivityHandler onMembersAdded event. Unfortunately I can't get this event to fire. I also noticed that when installing the zip file in Teams and watching the requests in ngrok nothing happens; so I'm not entirely sure the problem is in my bot app. Is there something I need to do in the manifest?
If I chat with my app the onMessage event will fire, but like I said above, I need to send a "Welcome" message when the app is installed before the user starts typing.
Background:
I created the manifest for my app using App Studio in Teams and exported it to a zip
The node app is built with the using botbuilder 4.9.2

onMembersAddedAsync works everywhere, but not in Teams :) For Teams, there is a set of separate methods that work only in Teams. You need to use OnTeamsMembersAddedAsync. You can read more about that here: https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/create-a-bot-for-teams

Related

ms teams custom app starting a chat session with a bot

I'm building a teams app that contains some tabs and a bot.
Is it possible to, when an action is performed on a tab (i.e. clicking a button), initialize automatically a chat with the bot, or send a specific message?
Tks
Based on the comments above, what you're looking to do is implement "pro-active" messaging, where the bot itself initiates the conversation. It's definitely possible, and you can read more to get started here and here. The most important thing to know is that your user has to have installed the bot already, to get a "conversation context", but if they've installed the app, which includes the bot, to get the tab, then you're fine. You need to get some variables when they do install the app, which you hook into the conversationUpdate event to get access to. Give it a go and let me know if you have specific questions, here on SOverflow.

luis bot not speaking

I'm using the LUIS bot in NodeJS and I am using session.say() to get the bot the speak but there is not audio output. I am trying to say a list of movies from a list like this session.say('hi', list.shift()) I know it works because 'hi' prints in the chat but no audio, I even put it in SSML format
session.say('hi','<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">hey</speak>');
Any ideas why my bot isn't saying anything, but still printing stuff in the chat?
To use the text to speech feature on the Bot Framework Emulator, the user has to use the microphone on the emulator first. Basically, the bot will only speak to the user if the user speaks to the bot first. Note, there are several steps you need to follow to enable the microphone feature on the emulator:
If you do not already have a microsoftAppId and microsoftAppPassword for your bot, you will either have to create a new bot or register your bot on the Azure Portal. Be aware that if you choose to register your bot, you will not be able to deploy it later without creating a new bot.
Once you have your microsoftAppId and microsoftAppPassword, you will have to create a .env file to store them. It should look like:
MicrosoftAppId=YOUR_MICROSOFT_APP_ID
MicrosoftAppPassword=YOURR_MICROSOFT_APP_PASSWORD
Also, make sure you have configured thedotenv in your app.js file.
Now, you have to either add your microsoftAppId and microsoftAppPassword to the developer endpoint in your bot file or add it through the emulator. To add it in the emulator, right click on your bot under the ENDPOINT section and select Edit Settings. It should open a prompt where you can fill in the microsoftAppId and microsoftAppPassword.
Once you have completed all of the steps above, run your bot and connect to it in the emulator. You should be able to use the microphone to talk to your bot, and the bot should respond by speaking some text. Hope this helps.

send typing notification in MSBOT framework in node.js

I have developed a bot in Bot framework. Once user responds to the bot and bot is processing it, i need to show the typing indicator to the user in the meanwhile for every 2 seconds . It should be working across all conversations of the chat.
Easy as pie. Node.js bots send a typing indicator to the user by executing session.SendTyping();
If you want to see what this looks like in the framework, you can find the code here
Also, Microsoft has a documentation page that talks specifically about this.

Microsoft Bot Framework integration with Slack is broken

I am developing chatbot for Slack using Microsoft Bot Framework. The Web app is hosted on azure. We have few installations.
Everything worked fine before this morning when I saw that new bot just didn't respond (the old one is still working).
We've been experimenting on permissions and auth keys on slack, so I thought that was the reason. But I tried to reinstall the app, bot user, auth keys etc from scratch and it didn't help. My configured endpoint just don't hit.
I think the issue is in communication between Slack and Microsoft Bot Framework, 'cos when I'm testing from chatbot panel's web client everything is working fine. Also, Slack representatives confirmed that there's no problem from their side.
UPDATE: I re-checked all credentials again and seems like it's working, don't know what was the issue. But two side questions still actual:
1) Can I test this channel of communication somehow? Cos when my endpoint didn't hit I can't get any info on what is happening. I have 0 errors on Microsoft Bot Framework web console.
2) Docs on configuring slack channel have changed recently and now it suggesting to add "Subscribe to Bot Events", while everything worked w\o it. Can you elaborate on that? Also, it's not quite clear what is {YourBotHandle} docs referring to in https://slack.botframework.com/api/Events/{YourBotHandle}
Usually, the Bot Framework Portal is the place to see if any channel is reporting errors with your bot. You can also check https://github.com/Microsoft/BotBuilder/issues just in case there is a general problem with a channel.
Regarding the second question, {YourBotHandle} refers to the handle that you provided at the time of registering your bot, as explained here.
As far as why you need to subscribe to bot events, first I would recommend you to read the documentation about Events on Slack (here), but long story short, this allows the bot to subscribe to events and be notified when those happen instead of having the bot asking Slack if something happened or not.
One way to use the Events API is as an alternative to opening
websocket connections to the real time messaging API. Instead of
maintaining one or more long-lived connections for each team an
application is connected to, you simply set up one or more endpoints
on your own servers to receive events atomically in near real-time.

Send unprovoked messages using NodeJS

Is there a way to send messages to channels without being provoked? For example every few hours a skype chatbot might remind you to call your mom.
I'm using Microsoft's new Bot Framework and the NodeJS sdk.
Yes... All of the built in Bot classes have a beginDialog() method which can be used to initiate a bot originated conversation with the user. The basics-naturalLanguage example shows a sample of this using the TextBot class and there's also the testBot example which shows this in action for all of the bots. For the TestBot you have to look at the 'dialogs/run-async.js' file to see the actual call.

Categories

Resources