0

I have a logic app which posts a channel chat message to teams automatically when a new item is created in SharePoint. This I have working but our client requires that all the team members receive a banner alert and activity feed which I am having a lot of difficulty with.

What I've already tried...

Using a Incoming web hook on the teams channel - this was a very simple way to post from the logic app but the incoming webhook don't seem to support mentions.

Using the msft graph api - The /team/channel/message endpoint can post messages and user mentions but the this endpoint doesnt support channel or team mentions. It also appears that the graph API needs to use delegated permissions to post messages in teams. I'm using application permissions as this is a logic app. The logic app HTTP post connector doesnt offer the "connect as username@tenant.com" some of the other connectors use.

Using the flowbot post message - Like the above channel and team mentions are supported here so the post is added to the channel but with no notification to the team members

Using a notification only bot - I thought I nearly had it with this one. Microsoft's node bot sample number 57 looked like it can do most of what I want, it iterates through the users in the team and messages them this a customisable alert message...

https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/57.teams-conversation-bot

However I can't see how this bot can be triggered from my logic app as it seems to require an existing conversation context or an @mention from within teams to start communicating with users.

What I'm considering trying next

Iterating users within the logic app - Next I plan to try and get team membership from the graph API and iterate the members in the Logic App, posting a message to each user separately. I had hoped to utilise the group @mention feature as a simpler way so I'd be grateful if anyone had any thoughts on other ways of doing this, or maybe there's something wrong with what I've already tried that you could give me some expertise on.

Thanks in advance ;)

Andy

andy moore
  • 89
  • 2
  • 11

2 Answers2

1

You're on the right track with the Bot, but you're wanting to send something called a "Pro-active" message. You need the bot registered in the channel in order to get access to a few key properties (conversation id, service url, etc.), but you can use those to send a message from -outside- your bot (e.g. in an Azure Function). You might be able to do this directly from a Logic App, but I haven't tested that specifically.

To find out more, see my answer at Programmatically sending a message to a bot in Microsoft Teams but I've also got a recent blog post that you might find interesting for background on this at How Bots Actually Work.

Hope that helps

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
  • Thank you Hilton, I wasnt sure if the bot could be triggered externally so I'll take a look at your blog post. Seems recreating parts of the context is key. Thanks for you quick response! – andy moore Jan 29 '20 at 12:07
  • Yup, that's exactly right - you're creating a "Conversation" context. Good luck with it! Please don't forget to Mark as Answer (or even just upvote) if this helped you out. – Hilton Giesenow Jan 29 '20 at 12:11