Bot-docs: Failed to decrypt conversation id

Created on 19 Aug 2019  路  38Comments  路  Source: MicrosoftDocs/bot-docs

I am deploying bot on microsoft teams and when i am sending bot response for Microsoft teams user then it gives response

"Failed to decrypt conversation id"


https://smba.trafficmanager.net/in/v3/conversations/a:1MvcDR9zbqUyoo0rMVmoKzPEqTwesCZa5RnK8sAB519Ny-3_1TC1f7p5mMEkfPXvwDeVGXks6chC2BA9-pgvn80UI0Pt8DtQb6hUFxuw7zD2ibI7ojELD0KHuM7bmWUjG/activities/1566204912839


Headers
Content-Type: application/json
Authorization: somekey


BODY

{
   "attachments": [
      {
         "contentType": "image/png",
         "contentUrl": "https://aka.ms/DuckOnARock",
         "name": "duck-on-a-rock.jpg"
      }
   ],
   "replyToId": "1566204912839",
   "recipient": null,
   "from": {
      "name": "ms-dev-1",
      "id": "28:e6615a79-d199-4641-9bb3-22191207af64"
   },
   "text": "Sorry, I did not understand that.",
   "type": "message",
   "conversation": {
      "conversationType": "personal",
      "tenantId": "682c77b5-e369-4e80-94e5-daff9d0843ad",
      "id": "a:1MvcDR9zbqUyoo0rMVmoKzPEqTwesCZa5RnK8sAB519Ny-3_1TC1f7p5mMEkfPXvwDeVGXks6chC2BA9-pgvn80UI0Pt8DtQb6hUFxuw7zD2ibI7ojELD0KHuM7bmWUjG"
   },
   "timestamp": "2017-02-01T21:10:07.437Z"
}

RESPONSE

{
    "error": {
        "code": "BadArgument",
        "message": "Failed to decrypt conversation id"
    }
}
question support customer

All 38 comments

Hihi! Lots of questions:

Which doc are you following? This doesn't have the standard link. What bot are you trying to deploy? Is it a sample or a bot you created? How are you deploying? Which SDK are you using?

this microsoft documentation i am following https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-3.0 .

I created bot and it is working with skype but when it comes to microsoft teams it is not able to return the response to the user because above mentioned http request is failing.
I am having java 1.8-SDK

Basically i am integrating microsoft teams platform with my chatbot and for response to user above mentioned http request is used. when bot is responding to user with http request it is failing bcz conversation id is not getting decoded at your end.

@anshuman9198 - Why is your recipient null?

{ "text": "Sorry, I did not understand that.", "type": "message" }
only this much fields are mandatory rest is optional (tested in skype case) , i tried filling recipient when i hit the api with postman but the response was same. Filling recipient will not solve the problem i guess??
@v-kydela

@anshuman9198

  1. Can you provide your relevant bot code?
  2. Are you using a bot channels registration in Azure?
  3. How are you getting that conversation ID?

i registered my bot endpoint on azure and it is successfully sending response of user to my bot in below mention format with all ids. Secret token required for header and for that i am making another call.
FROM MS-TEAMS

{
  "text": "22222222222222",
  "textFormat": "plain",
  "type": "message",
  "timestamp": "2019-08-20T06:53:41.7424308Z",
  "localTimestamp": "2019-08-20T12:23:41.7424308+05:30",
  "id": "1566284021587",
  "channelId": "msteams",
  "serviceUrl": "https://smba.trafficmanager.net/in/",
  "from": {
    "id": "29:1QKK8ef0ZFqdmalsVokXAX1JDZqGt_3IFsarJPhiw87uB8L3EpMf0dH3Yrbn4fITiOjuZP9axH9auJ8SrN42SCA",
    "name": "anshuman mishra",
    "aadObjectId": "3d9be23a-2d38-42ce-af72-14de7317ae5b"
  },
  "conversation": {
    "conversationType": "personal",
    "tenantId": "682c77b5-e369-4e80-94e5-daff9d0843ad",
    "id": "a:1MvcDR9zbqUyoo0rMVmoKzPEqTwesCZa5RnK8sAB519Ny-3_1TC1f7p5mMEkfPXvwDeVGXks6chC2BA9-pgvn80UI0Pt8DtQb6hUFxuw7zD2ibI7ojELD0KHuM7bmWUjG"
  },
  "recipient": {
    "id": "28:e6615a79-d199-4641-9bb3-22191207af64",
    "name": "ms-dev-1"
  },
  "entities": [
    {
      "locale": "en-GB",
      "country": "GB",
      "platform": "Mac",
      "type": "clientInfo"
    }
  ],
  "channelData": {
    "tenant": {
      "id": "682c77b5-e369-4e80-94e5-daff9d0843ad"
    }
  },
  "locale": "en-GB"
}

@v-kydela

@anshuman9198 - Please format your code correctly in future comments so that other people don't have to do it for you

@anshuman9198 - Please do not post authorization tokens publicly

ok

@anshuman9198 - Is there a reason you're using the REST API instead of the Bot Builder SDK?

Bot architecture is like that and also REST API should work
@v-kydela

@anshuman9198 - I asked for your relevant bot code and you posted more JSON instead. Please provide your bot code so that I can see how your bot is extracting the conversation ID from incoming activities and incorporating it into outgoing activities and sending those activities with the API.

I have posted the final format of my api call which i am calling from postman whatever format works there i can manipulate it in code.
@v-kydela

@anshuman9198 - I can reproduce your issue only by including the wrong conversation ID in the URL. I notice your service URL includes "in" which I presume is for India. Your problem may be region-specific so I will try to escalate the issue and see if anyone knows of any problems with that service URL.

@anshuman9198 - For testing purposes, please try running a bot that uses the Bot Builder SDK and see if you can communicate with it. You can use a template or a sample of your choice: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples

@anshuman9198 - Are you able to send plain text messages (without the image attachment)?

@v-kydela i tried without the image attachment and the response was the same.

@anshuman9198 - How are you getting user's unique id which we put in members list? Could you please try following and share your results?

Request:

POST Your Service URL/v3/conversations/
Authorization: Bearer Your Access Token
Content-Type: application/json

{
  "bot": {
    "id": "28:Your Bot Id",
    "name": "Test Bot"
  },
  "members": [
    {
      "id": "29: Your User Id which you got from conversationUpdate Event"
    }
  ],
  "channelData": {
    "tenant": {
      "id": "[Your Tenant Id]"
    }
  }
}

Response:

{
    "id": "a:1vkBYFs6uuO6QlN1z7aM1o1V5SS1PEiLwTib_###################"
}

And now try sending plain text message to this conversation Id. Please let us know the result.

Hey i tried above format and got

{
    "error": {
        "code": "BadSyntax",
        "message": "Invalid user identity in provided tenant"
    }
}

also when i googled it found others facing similar issue
https://stackoverflow.com/questions/57386748/botframework-invalid-user-identity-in-provided-tenant

How are you getting user's unique id which we put in members list? User id is unique per user per Bot. In your case there is a possibility that it is incorrect . Could you please try with any other user in your tenant?

ms-teams sends this much information to bot-endpoint and user's unique id is there
only for secret token i need to make an extra request

{
  "text": "222222222222222222222222",
  "textFormat": "plain",
  "type": "message",
  "timestamp": "2019-08-26T13:55:43.9710731Z",
  "localTimestamp": "2019-08-26T19:25:43.9710731+05:30",
  "id": "15668277######",
  "channelId": "msteams",
  "serviceUrl": "https://smba.trafficmanager.net/in/",
  "from": {
    "id": "29:1QKK8ef0ZFqdmalsVokXAX1JDZqGt_3IFsarJPhiw87uB########################",
    "name": "anshuman mishra",
    "aadObjectId": "3d9be23a-2d38-42ce-####-###########"
  },
  "conversation": {
    "conversationType": "personal",
    "tenantId": "682c77b5-e369-4e80-####-############",
    "id": "a:1MvcDR9zbqUyoo0rMVmoK##################################"
  },
  "recipient": {
    "id": "28:e6615a79-d199-4641-9bb3-#########",
    "name": "ms-dev-1"
  }
}

@anshuman9198 - Are you still working on this?

@anshuman9198 - Could you please confirm you have only one bot which you are using while trying this out? You may get this error if you use conversationId created for one bot to sending message using another bot.

@Wajeed-msft yes i have only one bot registered

@v-kydela yes i am working on it and will try what u suggested

@anshuman9198 - Have you tried it yet?

@anshuman9198 - We can see in our logs that you're using a conversation ID created by a different bot. Your two bots are 3aa02f36-4367-40de-a083-bce835cffe97 & e6615a79-d199-4641-9bb3-22191207af64. Can you verify this?

*e97 is a skype bot and *f64 is ms-teams bot. Unfortunately i lost database so i need to register fresh bot.Also bot registration takes time in Microsoft-teams case.

I will try with new bot and get back to you.

@anshuman9198 - Do you still need help?

@v-kydela thank you for the assistance also one closing question on this thread
audio and video card is supported on teams ?? it is displaying This card's content could not be displayed for both the case

@anshuman9198 - You can see in this thread that Teams does not support audio or video cards. You can also see in that thread that it's recommended to use task modules instead. I'm closing this issue now.

@v-kydela I am getting this error when using virtual assistant & bot skills. SSO / tokens pass along fine to skills when using the Emulator, but fails using Teams. It looks like the post to GetSigninResource from the parent / calling bot is passing in the conversation ID of the skill bot, and I'm not quite sure how to override it. I get the signin/verify back to the parent / calling bot, but then it fails out with a 403 posting back to the conversation.

@weskroesbergen did you ever solve your issue?
Facing the same issue with VA

@bubbis-poncho @v-kydela I never got it resolved. :( Hoping 4.11 might have some fixes for me there, but haven't gotten through other backlog items yet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanteNahuel picture DanteNahuel  路  3Comments

justinbarias picture justinbarias  路  5Comments

MisinformedDNA picture MisinformedDNA  路  4Comments

blueelvis picture blueelvis  路  6Comments

amthomas46 picture amthomas46  路  4Comments