The MS BotFramework seems to have some logic which results in the following behavior:
* if I speak to the bot (rather than type), it will respond with speech.
* if I type to the bot, it will respond only with typed text.
I am looking for the place in the SDK where this logic resides, and if there is a place to influence it? E.g. have the bot be silent, even if I spoke to it?
The logic for this shows up in a few different places, nearly all of which are "your" code.
In your bot, it's up to you to formulate a response to an incoming message. There's nothing "automatic" about this process. The SDK's have some basic channel feature discovery, but they're all there only to help the developer formulate a channel relevant response.
The exception is if you're using Adaptive Cards, and your card has SSML on it. In that case, it's up to the client (Cortana, Web Chat, etc) to "render" the card according to your device capabilities - either as a card, or with voice instead.
Related
I'm using Bot Builder v4 but I can't find the API to post an emoji reaction. Is there such an API?
ITurnContext<IMessageActivity> seems to have methods to send, update and delete activities. No methods to post a reaction.
The sample pages only offer an example of how to receive events for reactions. No example of how to post a reaction programmatically.
For example, here's a :heart: reaction, supported by most chat platforms (Slack, Teams, WhatsApp, etc.). How can a bot post such a reaction?
The ActivityHandler class has a few methods that may serve your needs. They are OnMessageReactionActivityAsync(), OnReactionsAddedAsync(), and OnReactionsRemovedAsync(). Unfortunately, I'm not familiar with the WhatsApp adapter to speak to how message data from WhatsApp is returned. When working with ABS connector channels in Azure that data is returned in the activity.channelData property. The connector does the dirty work of converting a client/service event into an Event activity type in BotFramework, for example.
The adapter may or may not do that. If it does, then great. Check these APIs and see which one it comes thru. It's possible, however, that all WhatsApp messages are treated as Message activity types and it will be up to you to read the channel data. Then you can either call another activity handler or just handle it where it is.
Be aware that one API may, unexpectedly, be the sole recipient of all incoming messages. I don't remember which client I was working with and this was in JS, but my bot would only catch reactions in OnReactsAdded(). This was true for both reactions added and reactions removed.
Another consideration: If the adapter doesn't quite work the way you need it to, don't be afraid to clone the repo and add the required functionality.
I'm currently creating a Message Extension bot for our escalation channel in Teams and would like it so our company has to use the Bot messaging extension to log escalation issues, this is to help our dev team gather as much information about issues as possible. When other departments log issues straight into the channel important information is sometimes missed out, causing us to lose time asking. Does anyone know a way of achieving this functionality?
I don't think this is possible, unfortunately, and the bot doesn't automatically receive every message in the channel either.
Perhaps you could look at an alternative: have the users connect to the bot directly, in 1-1 conversations, and whatever they log via the bot, the bot could -repost- into the channel as a pro-active message (I've posted some steps on that here).
In your bot, you could show an adaptive card to help with data entry, but I suppose you're doing something like that already with the message extension? If so, you can just re-use the same card.
I'm working on a message extension using bot framework v3 (c#). When i install the application in teams and open the bot in 1-1 chat with bot, and send message i'm getting a welcome text.
But i want the welcome text as soon as i open/ access the bot without sending any message to the bot, so i there any way to achieve this.
For welcome text on message event i'm using activity.GetActivityType() == ActivityTypes.Message
So similarly is there any activity type to get bot access event.
If you're using C#, you're listening for the OnMessageActivityAsync event, and implementing your check in there. However, if you want to send the message straight away, without the user having to send one first, you need to also hook into the OnMembersAddedAsync event, and send it there first. For more info, see Send welcome message to users.
In Teams, there's even a modified version of this now, specifically for Teams. I haven't looked into yet myself, but see Subscribe to conversation events for more.
Related to this, especially if the bot is installed into a Team or group chat, you need to do a bit of work in the OnMembersAddedAsync to check if the -bot- is the new member being added, and to make sure you only send 1 message, not multiple (otherwise it can end up sending this 'welcome' a few times). This is shown in the links I provided above. Baically member.Id != turnContext.Activity.Recipient.Id might need to change, based on what you're trying to do.
hope that helps
I have made a simple IM client in both Python and C#, using a few different XMPP libraries for each.
They work very well as simple autoresponders, or trivial bots, but when I turn them into chat rooms (ie, a message gets reflected to many other JIDs), I suddenly start getting 503 service-unavailable responses from the Google talk server.
Where should I start looking to resolve this issue? Given that I have used several languages and libraries, I don't think this is a problem with my particular setup. I am using the various examples provided with the libraries.
Do you have all people you try to send messages to in your rooster?
Otherwise GTalk won't allow the message to be sent and instead return Error 503.
There was a pidgin bug tracker describing a similar problem:
Pidgin #4236
If you're sure you have all the JIDs in your rooster you should also check how manny messages are send in parallel. Google will limit the count of messages a single
JID is allowed to send in a specified period of time.
If you're looking to create actual chat rooms, why not rather get a jabber server to host those (following http://xmpp.org/extensions/xep-0045.html - ejabberd has these as default and there are plugins for most jabber servers to implement them), and then have your bot join that room (most clients support this - Google Talk doesn't unfortunately)?
I am doing sample application using windows mobile 5.0. When I receive an SMS, I want to check for certain criteria (eg: "Honda"). If I find that word, I will do my process, if not, it must be stored in the Inbox.
I wrote the code receiving SMS and searching the criteria, but I don't know how to put the SMS in the Inbox.
Anybody got an idea for doing this just give me hint I will do on my own.
Chris has written a sample application which is similar to what you are looking for. Mobile SMS Remote Read the blog post and try out the samepl code. Once you understand how it works then try your code. If you have any questions, post it here. Please avoid asking us to code the entire project for you.
The first step in catching received SMS text messages is to create an instance of the MessageInterceptor class that lives in the Microsoft.WindowsMobile.PocketOutlook assembly. You need to be careful about where you define this instance as if it goes out of scope and is garbage collected the message interception will stop.
MessageInterceptor interceptor =
new MessageInterceptor(InterceptionAction.NotifyAndDelete);
An InterceptionAction is passed to the constructor. This parameter defines the behavior that occurs when a message is received.
The two options are:
Notify - The message interceptor gets a chance to process the message but it is also received by the standard SMS inbox application.
NotifyAndDelete - The message does not become visible to the user and is only seen by the message interceptor.