botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Issue with sender id, using bot connector rest api v3

Open ipuneetsingh opened this issue 10 years ago • 32 comments

As per the documentation the sender id should be format 29:1Gusfsfsf2323ds..... something like this but today my bot gets a request from sender id FOzadrPvGja and the bot didn't send any reply to the user. The response I receive is 400. Can you explain the issue here please, is it my fault or the user using some old device.

Please also provide the documentation in this regard as I didn't find sender id like FOzadrPvGja in the rest api's

ipuneetsingh avatar Sep 07 '16 16:09 ipuneetsingh

@puneetsngh the sender id format is specific per channel. the 29: format is specific to Skype. Which channel are you interacting with, and could you share code for the appropriate section of your code that's receiving the error?

jameslew avatar Sep 07 '16 17:09 jameslew

I am using Skype bot rest api latest v3 version and the documentation say that the sender id starts with 29: and bots id by 28:, but i get a msg from a sender id FOzadrPvGja and as a result i am able to listen to user but unable to reply. What might be the issue?

ipuneetsingh avatar Sep 07 '16 19:09 ipuneetsingh

My bot is in python

` payload = { "type": "message/text", "text": text }

    r = requests.post('https://apis.skype.com/v3/conversations/'+sender+'/activities/',headers={"Authorization": "Bearer "+token,"Content-Type":"application/json"},json=payload)

`

now here in place of sender in url the sender id in format 29:4ft..... goes and responseI receive is 201 ok.

but for the above issue the sender id is coming as FOzadrPvGja so the url taking this in place of sender. And the response I receive is 400.

ipuneetsingh avatar Sep 08 '16 02:09 ipuneetsingh

@puneetsngh that looks like you are using skype directly (apis.skype.com) bypassing bot connector (skype.botframework.com). Thus we will need some addtional information: ContextId and Date header values of the request skype made to your bot service when you get FOzadrPvGja.

konstlut avatar Sep 08 '16 10:09 konstlut

I am sorry but I didn't have the context id for that msg...I wasn't logging that but I have the Json converted to dict. and the date of the msg. {'attachments': None, 'sender_name': 'FOzadrPvGja', 'text': u'hi', 'sender_id': u'FOzad rPvGja', 'isGroup': False, 'recipient_name': u'Sift Bot', 'recipient_id': u'siftbot', ' content_type': 'text', 'timestamp': u'2016-09-07T16:40:25.8397524Z', 'conversation_id': u'4FqRyxTqKNN', 'type': u'message', 'message_id': u'K69MN5F8aDl'} Date - 07-Septembe 2016, Time - 22:10:25 IST

I hope that this will help, Secondly, as you are saying I am bypassing Service URL, but the documentation of SkypeBot listed that domain only. Is that mean that I can also use skype.botframework,com for my skype bot I am creating in python?

ipuneetsingh avatar Sep 08 '16 11:09 ipuneetsingh

I have same dout how to get this "conversationId" for sending message

shijuamt avatar Sep 08 '16 12:09 shijuamt

@puneetsngh I tried to send messages use the following request request({ url: 'https://api.skype.com/v3/conversations/29:f2ca6a4a-93bd-434a-9ca5-5f81f8f9b455/activities', method: "POST", json: true, headers: { Authorization: ' Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjIifQ.eyJpYXQiOjE0NzMzMTk4MDEsImV4cCI6MTQ3MzQwNjIwMSwic2t5cGVpZCI6ImFfefefeNjIiLCJzY3AiOjk1OCwiY3NpIjoiMCIsImNpZCI6ImVhODhhYWFmMmFkMjYwYzEiLCJhYXQiOjE0NzMzMTk4MDF9.ZrC0weALCz7QbUHFslJZD7L16k_ciFSCNY-q29h99x70qNrpB5e71KYrD18FTZ-3tI8Ck37_91yMHleQZvEziyEq5-t9EOaGM32RiF0iwnKZcbkOkvgqofWmcGdPT63HEyjWBHg3e_NLIE-RnDob4vMCQrHTkqmuQq6cVaIDkjke1Yi4xjONUNIB9QpWmpuRju0Kxi7oIJqiHWQK', 'Content-Type': 'application/json' }, body: { "type": "message/text", "text": "Hi! (wave)" } }, function(error, info, body)

I'm try to send use this request i got error { status: { code: 40499, text: 'No handler found for resource' } } How to make a valid request?

shijuamt avatar Sep 08 '16 12:09 shijuamt

@shijuamt I am sorry buddy but I don't know anything about node.js syntax. But the url is correct, body content is correct and the token need to be refreshed every hour.

ipuneetsingh avatar Sep 08 '16 12:09 ipuneetsingh

@puneetsngh

I tried to send messages use the following request request({ url: 'https://api.skype.com/v3/conversations/29:f2ca6a4a-93bd-434a-9ca5-5f81f8f9b455/activities', ... I'm try to send use this request i got error { status: { code: 40499, text: 'No handler found for resource' } } How to make a valid request?

the host should be apis.skype.com

konstlut avatar Sep 08 '16 12:09 konstlut

@konstlut but what about my issue? 😅

ipuneetsingh avatar Sep 08 '16 12:09 ipuneetsingh

I am sorry but I didn't have the context id for that msg...I wasn't logging that but I have the Json converted to dict. and the date of the msg. {'attachments': None, 'sender_name': 'FOzadrPvGja', 'text': u'hi', 'sender_id': u'FOzad rPvGja', 'isGroup': False, 'recipient_name': u'Sift Bot', 'recipient_id': u'siftbot', ' content_type': 'text', 'timestamp': u'2016-09-07T16:40:25.8397524Z', 'conversation_id': u'4FqRyxTqKNN', 'type': u'message', 'message_id': u'K69MN5F8aDl'} Date - 07-Septembe 2016, Time - 22:10:25 IST

Could you please add ContextId and Date header values to the logs and get back to me if the problem ever reproduces.

I hope that this will help, Secondly, as you are saying I am bypassing Service URL, but the documentation of SkypeBot listed that domain only. Is that mean that I can also use skype.botframework,com for my skype bot I am creating in python?

For the replies you should use message's serviceUrl field, when you get a message (activity) from Skype.

konstlut avatar Sep 08 '16 12:09 konstlut

POST /v3/conversations/29:f2ca6a4a-93bd-434a-9ca5-5f81f8f9b455/activities HTTP/1.1
Host: apis.skype.com
Authorization: Bearer <redacted oauth2 token>

{
"type": "message/text",
"text": "Hi! (wave)"
}

HTTP/1.1 201 Created
Cache-Control: no-store, must-revalidate, no-cache
Pragma: no-cache
Content-Length: 0
ContextId: tcid=6292595202568151987,server=CO2SCH020010627
Date: Mon, 21 Mar 2016 15:44:12 GMT

if I user the serviceUrl which is skype.botframework.com I get response 202 whereas the url which is also mentioned in the documentation apis.skype.com gives response 201 and send the reply to the user.

Everything is working fine as the documentation also mentioned that the id's will be in the form 29:... in v3 but how and who can anyone send my bot msg with id FOzadrPvGja as my bot is only for skype and I also haven't share any endpoint data with anyone?

ipuneetsingh avatar Sep 08 '16 13:09 ipuneetsingh

@konstlut ok I delved into the serviceUrl and now with response 202 they are too working, I just changed the type to message from message/text. So, now again what about the requests with id like FOzadrPvGja received by my bot. I still believe that changing the serviceUrl will not resolve the issue.

ipuneetsingh avatar Sep 08 '16 15:09 ipuneetsingh

So, now again what about the requests with id like FOzadrPvGja received by my bot. I still believe that changing the serviceUrl will not resolve the issue.

Are you seeing it still? Anyway, to answer that we will need the mentioned header values, please.

konstlut avatar Sep 08 '16 16:09 konstlut

@konstlut I got this sender id 2 times and both times just before my bot got rejected, it seems like these ids are from bot review teams. I again sent my bot for review if the third time I get same kind of sender id then it will be for sure coming from bot review teams.

As you mentioned you need header info for the troubleshooting. But the issue is I haven't logged contextID header yet. And from now on I will log that too. I was seeing the request headers and I didn't find the contextID mentioned in it. There were cookies, authentication token, user agent, content type but no contextid.

Should I have to generate the contextId. If yes then can you guide me about it a little as I didn't found much information about context id in bot framework documentation.

ipuneetsingh avatar Sep 08 '16 16:09 ipuneetsingh

A side question @puneetsngh ; have you created or are using a python SDK for the Bot Framework, or are you coding to the REST API directly?

jameslew avatar Sep 08 '16 20:09 jameslew

@jameslew is there sdk available in Python for bot framework? because I am using rest api for skype bot

ipuneetsingh avatar Sep 09 '16 00:09 ipuneetsingh

@puneetsngh Is it possible to share that rest api request format please Please tell how to get conversationId??

shijuamt avatar Sep 09 '16 10:09 shijuamt

@shijuamt you can see my repository for Python Skype bot api wrapper

ipuneetsingh avatar Sep 09 '16 10:09 ipuneetsingh

@puneetsngh no, there is not at this time. I thought you might have been building one :).

jameslew avatar Sep 12 '16 16:09 jameslew