Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with sender id, using bot connector rest api v3 #1191

Closed
ipuneetsingh opened this issue Sep 7, 2016 · 32 comments
Closed

Issue with sender id, using bot connector rest api v3 #1191

ipuneetsingh opened this issue Sep 7, 2016 · 32 comments
Assignees

Comments

@ipuneetsingh
Copy link

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

@jameslew jameslew added the skype label Sep 7, 2016
@jameslew
Copy link
Contributor

jameslew commented Sep 7, 2016

@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?

@ipuneetsingh
Copy link
Author

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
Copy link
Author

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.

@konstlut
Copy link
Member

konstlut commented Sep 8, 2016

@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.

@ipuneetsingh
Copy link
Author

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?

@shijuamt
Copy link

shijuamt commented Sep 8, 2016

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

@shijuamt
Copy link

shijuamt commented Sep 8, 2016

@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?

@ipuneetsingh
Copy link
Author

@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.

@konstlut
Copy link
Member

konstlut commented Sep 8, 2016

@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

@ipuneetsingh
Copy link
Author

@konstlut but what about my issue? 😅

@konstlut
Copy link
Member

konstlut commented Sep 8, 2016

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.

@ipuneetsingh
Copy link
Author

ipuneetsingh commented Sep 8, 2016

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
Copy link
Author

@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.

@konstlut
Copy link
Member

konstlut commented Sep 8, 2016

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.

@ipuneetsingh
Copy link
Author

@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.

@jameslew
Copy link
Contributor

jameslew commented Sep 8, 2016

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?

@ipuneetsingh
Copy link
Author

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

@shijuamt
Copy link

shijuamt commented Sep 9, 2016

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

@ipuneetsingh
Copy link
Author

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

@jameslew
Copy link
Contributor

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

@ipuneetsingh
Copy link
Author

ipuneetsingh commented Sep 13, 2016

@jameslew I created a wrapper for Skype bot api...and wanted to support other channels too but the documentation is not very conducive for developers other than c# or node.js

And for the issue I raised, I think the msg to my bot coming from emulator as I earlier was using apis.skype.com. Now I switched to serviceUrl. I will verify and inform here soon

@dandriscoll
Copy link
Member

Hi @puneetsngh, were you able to get this working?

@ipuneetsingh
Copy link
Author

@dandriscoll i changed from apis.skype.com to serviceUrl and now I think it will work but can't say until a person with id like FOzadrPvGja send me the message again.

I still not getting contextID in response header even after using serviceUrl

@dandriscoll
Copy link
Member

ContextId will be available soon -- it will be included in our next deployment (likely this week).

Looking through the thread, are you certain you aren't seeing the 'FOzadrPvGja' ID from another channel, like Web Chat, or the Bot Framework emulator? IDs in that format are not generated by Skype by they are generated by the Emulator and the ID.

Accordingly, the ServiceUrl and ChannelId will reflect that channel.

@dandriscoll dandriscoll self-assigned this Sep 18, 2016
@dandriscoll
Copy link
Member

Also, another issue: this message is not a v3 Bot Framework message.

{'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'}

@ipuneetsingh
Copy link
Author

@dandriscoll I haven't enabled web chat for my bot, and the msg was not also from emulator, as I personally checked with emulator...there other issue encountered first then this.

1 thing which I feel is that the msg can be from review team as this kind of msges came twice to my bot that too just before my bot got rejected for no response.

{'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'}
Yes it's not a bot response, i am converting json to dict in python and this the only proof I had about that anonymous ID that's why I shared this.

@dandriscoll
Copy link
Member

This appears to be an internal data structure.

Do you have an HTTP trace of the JSON messages being sent/received by your bot?

I'm pretty certain the 'FOzadrPvGja' ID is from a different Bot Framework channel.

@jameslew
Copy link
Contributor

jameslew commented Oct 5, 2016

@puneetsngh ? Have you resolved your issue?

@inornos
Copy link

inornos commented Oct 22, 2016

Hello All
I have same issue i want to get sender Skype id like abcxyz123 which mention in Microsoft Skype Software but i get sender name or some id like 29:af9a0sd9fj0i2j2kk-----
Please what i do for get skype sender id
Please Help

@ipuneetsingh
Copy link
Author

You are getting it all wrong, Skype id's are always like 29:gdt5gfdfg577..... and the one you want will only came from bot emulator

@chrimc62
Copy link
Contributor

Closing due to age. If you still have the problem, please let us know and we will reopen.

@sm-etest
Copy link

id 'FOzadrPvGja' looks like part from link to chat.
for example https://join.skype.com/FOzadrPvGja

Also, I have a question.
I'm using REST API. I create bot and add it to the group in skype.
Now i'd like to make bot send messages to that chat.

I have link to that chat - like this https://join.skype.com/FOzadrPvGja
I can get blob - /get blob
But how can I get conversationId??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants