user11677128
user11677128

Reputation: 11

Unable to send message to end user (msteams) via Bot

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"
}

Upvotes: 0

Views: 680

Answers (1)

user11677128
user11677128

Reputation: 11

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  "
   }

Upvotes: 1

Related Questions