Dmitry Semenov
Dmitry Semenov

Reputation: 11

Send proactive messages to MS Teams from PHP

I have an PHP application that should send proactive messages to individual MS Teams users and send notifications to Teams channel as well. I spent a lot of time reading docs but totally got stack with one-way notification bot for MS Teams.

What done:
I created app with bot by App Studio and register it at botframework. So now I can install it to my Teams.

My questions:
Is is possible to send proactive messages with PHP (without SDK, Rest API) and how create that kind of bot? I can get an token from Rest API but how to identify team and start proactive conversation?

Upvotes: 1

Views: 4049

Answers (1)

Hilton Giesenow
Hilton Giesenow

Reputation: 10804

This is a bit of a troublesome topic for exactly this reason - the docs explain how to Send the message, but not that there are critical variables you need, and that you need to have them already, for instance "ServiceUrl" and "ConversationId". They are unique to every user (for 1-1 chat) or for every conversation. You can get these any time the user calls your bot (they are on the "Activity" object), but also right as your app is installed by the user - there is a "ConversationUpdate" event call that is sent, that contains them too. You then need to store them your side (e.g. in a database), for later use in sending the actual 'proactive message'.

Hopefully that gives you what you need, but if anything is still unclear let me know in the "comments"

Upvotes: 2

Related Questions