Home

How to Send a Message(Card) to specific User from External WebApp

%3CLINGO-SUB%20id%3D%22lingo-sub-320709%22%20slang%3D%22en-US%22%3EHow%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320709%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewe%20have%20an%20external%20ASP.NET%204.7%20App%20(in%20Azure%20App%20Service)%2C%20which%26nbsp%3Bshould%20send%20Messages%2FCards%20to%20one%20specific%20User%20in%20Teams.%3C%2FP%3E%3CP%3EI%20managed%20to%20send%20Cards%20to%20Channels%20via%20the%20Connector%2FWebHook%2C%20but%20cannot%20target%20an%20specific%20User.%3C%2FP%3E%3CP%3EHow%20can%20i%20do%20this%20%2F%20which%20Services%20are%20needed%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(pleas%20as%20simple%20as%20possible%20%3A)%3C%2Fimg%3E%20)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethank%20You%3C%2FP%3E%3CP%3EChristoph%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-320709%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EChat%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-323540%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-323540%22%20slang%3D%22en-US%22%3E%3CP%3EI%20think%20you%20can%20use%20this%20blog%20as%20a%20starting%20point%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fblog.somecreativity.com%2F2016%2F11%2F04%2Fsend-a-notification-to-a-microsoft-teams-user-from-an-app%2F%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fblog.somecreativity.com%2F2016%2F11%2F04%2Fsend-a-notification-to-a-microsoft-teams-user-from-an-app%2F%26nbsp%3B%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20only%20challenge%20I%20think%20you%20will%20have%2C%20is%20that%20you%20will%20need%20a%201%3A1%20conversation%20or%20a%20conversation%20from%20a%20team%2Fchannel%20with%20your%20bot%20first%20from%20the%20user%20who%20will%20need%20to%20be%20notified.%26nbsp%3BThis%20because%20you%20will%20need%20a%20starting%20chat%20reference%20as%20stated%20in%20the%20notification%20only%20bot%20documentation%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20class%3D%22%22%3EThere%20is%20no%20way%20currently%20to%20create%20a%3CCODE%3Epersonal%3C%2FCODE%3E%20scoped%20notification%20only%20bot%20since%20the%20user%20cannot%20message%20your%20notification%20only%20bot%20in%20a%20personal%20chat.%20This%20means%20that%20you%20can't%20receive%20a%20%3CCODE%3EconversationUpdate%3C%2FCODE%3E%20event%20that%20would%20provide%20you%20with%20the%20necessary%20details%20to%20send%20a%20notification.%20Your%20notification%20only%20bot%20will%20only%20function%20correctly%20if%20it%20supports%20the%20%3CCODE%3Eteam%3C%2FCODE%3E%20scope%20and%20is%20added%20to%20a%20team.%20In%20the%20team%20setting%2C%20your%20bot%20will%20have%20access%20to%20the%20necessary%20information%20to%20either%20send%20a%20notification%20to%20a%20channel%20or%20privately%20to%20a%20user.%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-323511%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-323511%22%20slang%3D%22en-US%22%3EThank%20youm%20but%20i%20didnt%20find%20a%20sample%20for%20a%20bot%2C%20which%20is%20triggered%20from%20an%20external%20(http)%20request%20and%20then%20sends%20a%20message%20to%20the%20user%20%3A(%3C%2Fimg%3E%3CBR%20%2F%3EDo%20you%20have%20any%20of%20this%20for%20me%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-323508%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-323508%22%20slang%3D%22en-US%22%3E%3CP%3EI%20got%20some%20answers%20back%20and%20at%20the%20moment%20the%20only%20option%20is%20to%20use%20a%20bot%20for%20this.%20And%20more%20specifically%20a%20notifications%20only%20bot%2C%20as%20I%20mentioned%20before.%20I%20don't%20think%20it%20would%20be%20that%20a%20big%20of%20an%20effort%20to%20develop%20such%20a%20bot.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320805%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320805%22%20slang%3D%22en-US%22%3EWe%20have%20an%20ASP.NET%20Application%2C%20where%20we%20manage%20Entities%2FObjects.%3CBR%20%2F%3E%3CBR%20%2F%3EWhenever%20e.g.%20an%20Ownership%20is%20changing%20from%20one%20coworker%20to%20anotherm%20the%20new%20owner%20should%20get%20an%20notification%20(preferred%20in%20Teams)%20that%20he%20can%20handle%20the%20work%20asap.%3CBR%20%2F%3E%3CBR%20%2F%3EWe%20currently%20do%20this%20with%20Slack%20messages%20to%20the%20responsible%20worker%2C%20but%20(due%20to%20GDPR)%20want(ed)%20to%20switch%20to%20Teams.%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20we%20are%20very%20busy%20enhancing%20and%20extending%20out%20WebApp%20we%20dont%20want%20so%20spend%20to%20much%20effort%20in%20building%20a%20Bot.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320799%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320799%22%20slang%3D%22en-US%22%3E%3CP%3EChristoph%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWould%20you%20mind%20to%20describe%20your%20scenario%20you%20have%20in%20mind%20in%20more%20detail%3F%20I%20would%20like%20to%20address%20this%20scenario%20to%20Microsoft%2C%20in%20order%20to%20look%20if%20there%20are%20other%20possibilities.%20We%20want%20you%20to%20use%20Teams!%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETnx%20in%20advance!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320794%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320794%22%20slang%3D%22en-US%22%3Ei%20didn't%20want%20to%20use%20the%20Bot%20Framework%2C%20as%20i%20prefer%20simple%20solutions%20(like%20the%20connectors%2Fwebhooks).%3CBR%20%2F%3EBut%20if%20this%20is%20the%20only%20way%20(as%20the%20Graph%20API%20does%20not%20support%20direct%20messages)%20i%20will%20have%20to%20think%20about%20staying%20at%20slack%20%3A(%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320790%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320790%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20I've%20understood%20you%20should%20create%20a%20bot%2C%20using%20the%20Bot%20Framework%2C%20in%20your%20Application.%20You%20should%20add%20this%20app%20to%20Teams%20using%20an%20App%20manifest.%20The%20bot%20should%20be%20a%20Notification%20only%20bot%20as%20described%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fconcepts%2Fbots%2Fbots-notification-only%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fconcepts%2Fbots%2Fbots-notification-only%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHave%20you%20already%20added%20your%20application%20as%20an%20App%20to%20Microsoft%20Teams%3F%20This%20way%20it%20should%20be%20able%20to%20start%20a%20proactive%20conversation%20with%20a%20user%20from%20your%20bot%2C%20once%20your%20app%20is%20added%20to%20a%20team%20or%20when%20installed%20by%20user%20(personal%20app).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320784%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320784%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3Esounds%20good%2C%20but%20i%20cannot%20add%20an%20activity%20from%20an%20Application%2C%20as%20i%20have%20to%20have%20an%20authenticated%20User.%3CBR%20%2F%3EAnd%20in%20addition%20to%20this%20i%20can%20create%20an%20activity%2C%20but%20it's%20not%20shown%20in%20the%20Teams%20Acitivity%20feed%20%3A(%3C%2Fimg%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-320772%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Send%20a%20Message(Card)%20to%20specific%20User%20from%20External%20WebApp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-320772%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Christoph%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20could%20use%20the%20Activity%20feed%20API%20in%20Microsoft%20Graph%20in%20order%20to%20send%20a%20message%2Fcard%20to%20a%20specific%20user.%20More%20info%20can%20be%20found%20here%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fconcepts%2Factivity-feed%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fconcepts%2Factivity-feed%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%22%3CSPAN%3EAdditionally%2C%20you%20can%20also%20send%20personal%20chat%20messages%20into%20the%20feed%20as%20preview%20cards%20summarizing%20your%20app's%20activity.%22%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
cschuster
Occasional Contributor

Hi,

 

we have an external ASP.NET 4.7 App (in Azure App Service), which should send Messages/Cards to one specific User in Teams.

I managed to send Cards to Channels via the Connector/WebHook, but cannot target an specific User.

How can i do this / which Services are needed?

 

(pleas as simple as possible :) )

 

thank You

Christoph

9 Replies

Hi Christoph,

 

You could use the Activity feed API in Microsoft Graph in order to send a message/card to a specific user. More info can be found here:

 

https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/activity-feed

 

"Additionally, you can also send personal chat messages into the feed as preview cards summarizing your app's activity."

Hi,
sounds good, but i cannot add an activity from an Application, as i have to have an authenticated User.
And in addition to this i can create an activity, but it's not shown in the Teams Acitivity feed :(

As I've understood you should create a bot, using the Bot Framework, in your Application. You should add this app to Teams using an App manifest. The bot should be a Notification only bot as described here:

 

https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bots-notification-only

 

Have you already added your application as an App to Microsoft Teams? This way it should be able to start a proactive conversation with a user from your bot, once your app is added to a team or when installed by user (personal app).

i didn't want to use the Bot Framework, as i prefer simple solutions (like the connectors/webhooks).
But if this is the only way (as the Graph API does not support direct messages) i will have to think about staying at slack :(

Christoph,

 

Would you mind to describe your scenario you have in mind in more detail? I would like to address this scenario to Microsoft, in order to look if there are other possibilities. We want you to use Teams! :)

 

Tnx in advance! 

We have an ASP.NET Application, where we manage Entities/Objects.

Whenever e.g. an Ownership is changing from one coworker to anotherm the new owner should get an notification (preferred in Teams) that he can handle the work asap.

We currently do this with Slack messages to the responsible worker, but (due to GDPR) want(ed) to switch to Teams.

As we are very busy enhancing and extending out WebApp we dont want so spend to much effort in building a Bot.

I got some answers back and at the moment the only option is to use a bot for this. And more specifically a notifications only bot, as I mentioned before. I don't think it would be that a big of an effort to develop such a bot.

Thank youm but i didnt find a sample for a bot, which is triggered from an external (http) request and then sends a message to the user :(
Do you have any of this for me?

I think you can use this blog as a starting point:

 

https://blog.somecreativity.com/2016/11/04/send-a-notification-to-a-microsoft-teams-user-from-an-app...

 

The only challenge I think you will have, is that you will need a 1:1 conversation or a conversation from a team/channel with your bot first from the user who will need to be notified. This because you will need a starting chat reference as stated in the notification only bot documentation:

 

  • There is no way currently to create a personal scoped notification only bot since the user cannot message your notification only bot in a personal chat. This means that you can't receive a conversationUpdate event that would provide you with the necessary details to send a notification. Your notification only bot will only function correctly if it supports the team scope and is added to a team. In the team setting, your bot will have access to the necessary information to either send a notification to a channel or privately to a user.
Related Conversations