1
votes

I have mode progress on my bot, but have not solved my problem. You can view my new post that goes into more detail (and has actual code) here.

I previously used Telegram as my messaging service, it had a RESTful API where I could make a bot forward a message to a certain conversation identified by a chat ID. I have been trying to find a way to replicate similar functionality for Teams using the Microsoft Bot SDK. I've looked into the MS documentation on proactive messaging and RESTful API, but I dont think they perform a similar task.

To be more detailed, my goal is this: From my app send a POST request to my bot that contains

  • The necessary credentials
  • A message/attachment to forward
  • The conversation ID of who to forward this message to

As requested, a step by step explanation of the work flow:

  1. User in my web app triggers alarm.
  2. This alarm triggers a POST request with a message that is sent to the bot to dispatch to MS Teams users.
  3. The bot receives the POST request and sends the message to the specified conversations
    • The users and group chats would be specified in the POST request, or stored in a database the bot can reach

No need to keep track of replies to the message, this bot is purely for notifications.

If anyone can offer advice or can point me towards resources they think would be helpful, I'd be very grateful.

Edit: I am currently looking into the strategy of sending a POST request to the bot with an additional JSON field that specifies that the message be forwarded and to whom. Will update if I find it works.

Thanks.

1
You can post your message to specific conversation using Proactive Message. Did you try it?Wajeed-MSFT
Yes, but in the documentation examples I found for proactive messaging it always had the user initiate the conversation, then the context would be saved in memory until a proactive message was sent. For me the user and bot do not interact at all, so the context doesnt get stored.Peter Andreoli
Just to clarify I'm going to write down my understanding of how your bot works, please tell me if this is right and maybe update the question a little. Someone is talking to your bot through an application (webchat/directline channel). This application sends a message/POST to your bot with the information you mention, and the bot should take this information and send a proactive message (notification) to someone in teams.Mark B
Your understanding is correct. I'll update my post. I think proactive messaging is what I needed, I just havent found an example thats similar to my situation. Im slowly getting closer to my goal and will update the post as I progress.Peter Andreoli
I asked a new question about the topic with my progress. The new post has more detail. stackoverflow.com/q/53197560/10609586Peter Andreoli

1 Answers

0
votes

You can post your message to specific conversation using Proactive Message.

    var parameters = new ConversationParameters
    {
        Bot = new ChannelAccount(botId, botName),
        Members = new ChannelAccount[] { new ChannelAccount(userId) },
        ChannelData = new TeamsChannelData
        {
            Tenant = channelData.Tenant
        }
    };

    var conversationResource = await connectorClient.Conversations.CreateConversationAsync(parameters);

Note: posting answer from comments.