3
votes

We use Microsoft bot framework and have a requirement of sending a message to a bot connected to Microsoft Teams channel from an external application(running in a different environment, e.g on-premise) via REST API. The following REST API helps to create conversation

{
    "bot": {
        "name": "someBot",
        "id": "xxx-some-bot-id"
    },
    "members": [
        {
            "name": "some user",
            "id": "xxx-some-user-id"
        }
    ],
  "channelData": {
    "tenant": {
      "id": "xxx-some-teanant-id"
    }
  },
}

The id returned by this API can be later used for sending messages via /v3/conversations/{id}

A couple of questions here:

  1. Is there any REST API available to get the member Id(user id) and bot id used in the above payload? In other words, how does an external application can read these two internal Ids for use while making API call? Could not find an appropriate API in the Bot API doc page: Bot Framework REST API

  2. Is there a way to get the tenant id via REST API as well for the above case? (I understand it can be read from Teams Application URL)

Thanks

1
I am not sure if there is something exact for what you are looking to achieve, but have you tried this docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/…? This fetches the list of members and their basic profiles(user ID/name/objectID)ranusharao
Thanks. Is there a standard way to identify the team id from the UI or via some other approach? Sorry for asking such basic question. I can find the team id from MS Team URL or by checking the network traffic. However not seen a proper way of getting thatJobinesh

1 Answers

0
votes

Essentially no, you cannot retrieve the Id's externally from Teams (for privacy/spam prevention reasons). There are a few ways your bot will receive them:

  • When installed in a personal context, your bot will receive message of type membersAdded that will contain the necessary information.

  • If your bot is installed in a team the person is a part of, you can retrieve the roster of that team which will also contain the necessary information.

See: https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages