0
votes

Facing issue to send proactive message to the end user (msteams), via bot service,

I try using the bot framework python SDK, where I am getting the following error even for getting conversation id.

botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'

Hence I try to simulate calls via postman and rest API's, in here I am able to get conversation id successfully, but if I try to use that conversation id to further send a message via activities I am not able to do it. following is rest endpoint and payload. In here I am getting an error of incorrect payload.

https://smba.trafficmanager.net/apis/v3/conversations/8:orgid:949a3f72-b82c-4b89-b2de-9defbe6ae7cd/activities

{
    "type": "message",
    "recipient": {
        "id": "29:1ZcsKdk0rsLmsywvI2SNQ2J7OIz"
    },
    "from": "bot",
    "channelData": {
        "notification": {
            "alert": "true"
        }
    },
    "text": "Hello world"
}
1
The Bot Framework authenticates messages going to and coming from the bot. Do you have a Microsoft app ID and password? Do you have a bot channels registration in the Azure portal? Are you following a specific sample? - Kyle Delaney
Yes, i have bot channel registered in portal.azure.com, i have app id and password with which i am able to generate conversation id, issue is i am not able to send message to user with that conversation id. In our case i am using Rasa Stack as messaging end point and from here i wish to send message to specific end user. Other issue is i get sender_id from MsTeams but unable to get profile of user or unable to find link of it with azure ad user profile - user11677128
Please focus on this one issue only. Are you getting the unauthorized error on every channel or just Teams? - Kyle Delaney
I am getting issue with channel and teams both, Is there is any document which will suggest required settings on Azure side to resolve this issue - user11677128
Is your bot code configured to use your Microsoft app ID and password to authenticate incoming and outgoing messages? - Kyle Delaney

1 Answers

1
votes

There was an issue with payload, I added BOT_ID along with name and able to successfully post message to end user. Following is working payload. Payload:

  { "type":"message",
   "recipient":{  
     "id":"29:1dUxQXVlH6QGByu1T9MR4p5g0c5URMaBtKqGU74C3zdowO78nPbuu2dg- qj9o02OkJ4MYXt2I-nxDgf9ga9EY5w"
     },
   "from":{  
      "id":"28:d7afe8c9-f0cd-434f-8906-be2b744229ac",
      "name":"bot"
    },
    "channelData":{  
    "notification":{  
     "alert":"true"
    }
   },
   "text":"Hello  "
   }