Detect bot application open event - c#

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

Related

How to react to an activity with an emoji

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.

Kaizala API: Sending message to member

I am working on a replacement for our SMS server and, since we have O365, I am looking to use Kaizala to facilitate this.
You can target users via mobile numbers who are subscribed, so we can use the current SMS backend without much modification. Sending messages to specific subscribers is working, BUT I can't send a message targeting my number.
I am the creator of the group and so I am seen as a "Member" and not a "Subscriber". When I try to send a message via the API to my number it says "No valid subscriber found!" (that is a copy and paste from VS). I have googled and looked at a few sites, but they all only focus on the part of the code that is working.
I have tried adding myself as a subscriber, but I get an error so not sure if that is an system problem or a me problem. :)
I am also on the standby rotation, so when it is my turn for standby the SMS's need to come to me. I am hoping someone can give me a nudge in the right direction!
TIA
PS:
using Newtonsoft.Json;
using RestSharp;

Is there a way in Teams to stop people posting to a channel without using a Bot message extension

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.

c# WPF app sending message using SKYPE4COMLib, but message is not delivered until recipient open app

I am trying to use SKYPE4COM to send message from a WPF app to iPhone Skype app.
Have done those things:
Install Skype 7.17 in OS Windows 10.
Register SKYPE4COM component.
Add reference to WPF project. (VS2013)
Send message this way:
Skype skype = new Skype();
skype.Attach(skype.Protocol, true);
skype.SendMessage("lucy", "Hello, how are you?");
My issue:
Once I send Message through a button click, the message "Hello, how are you?" is shown at the chat window, but it is always showing sending status, not delivered. Please see below print screen. (Message will be delivered once recipient opens Skype app on iPhone ).
I try to send a message in Skype software instead of my WPF app, the message was sent right away. And the recipient got notification on the iPhone right away. Like this (Please see the second message, was delivered right away)
I am not sure whether I did something wrong in my WPF code or the skype4COMlib is not working with Skype 7.17 version?
Did a lot researches and only get this
http://blogs.skype.com/2013/11/06/feature-evolution-and-support-for-the-skype-desktop-api/
Anyone experiences this issue and has a solution? Thanks in advance.
I tried the same library and code you provided.
When I attached to Skype it showed me a notification with the following link:
https://support.skype.com/en/faq/FA12384/how-does-my-3rd-party-application-work-with-skype-and-how-will-changes-to-skype-impact-my-3rd-party-application
According to this FAQ entry (which contains the link you have in your question as well):
As communicated in this blog post, due to technology improvements we are making to the Skype experience, some features of the API will stop working with Skype for desktop. For example, delivery of chat messages using the API will cease to work.
So it really seems it's not possible to send messages using this library.

How receive SMS in windows mobile application and put it into the Inbox

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.

Categories