SkPy
SkPy copied to clipboard
How to send SMS ?
Hello, First thank you for such nice project it is really great, before I was using Skype4Py for sending SMS for Pethospital appointment, I was hopping there is same feature in SkPy
I have tried the web.skype.com and it allows it, so should be possible
I see in doc chat.rst there is SMS capability
"properties": {"capabilities": ["AddMember",
"ChangeTopic",
"ChangePicture",
"EditMsg",
"CallP2P",
"SendText",
"SendSms",
"SendFileP2P",
"SendContacts",
"SendVideoMsg",
"SendMediaMsg",
"ChangeModerated"],
but I do not see in code the function allowing doing it . Is this feature available ? If not, how to add it ? Thanks,
Not at present -- I don't have Skype SMS set up on my account, so I'm unsure what any of the API calls look like.
If you're able to do it from Skype for Web and track the HTTP requests it makes, we can look into reproducing it here, though it may be tricky to test locally.
When you have skype credit you can call or sms a phone number. same windows as chat. Ok. For what can see in google developer tools in network tab there are several exchanges . I will try to isolate the communication process and understand how skpy works
Any news about this demand?
My request above still stands, as I've not touched Skype since then, let alone the SMS parts.
Meu pedido acima ainda está de pé, já que não toquei no Skype desde então, muito menos nas partes do SMS.
I can even create the chat and send an sms but after a few seconds it appears in the sms above the delivery failed, I don't know what it can be.
I can even create the chat and send an sms
With SkPy, or in Skype for Web?
If you can successfully send a message with the latter but not the former, please get a sample HTTP request from your browser so we can tell what it's doing differently. Without that I don't know what needs to change.
Posso até criar o chat e enviar um sms
Com o SkPy ou no Skype para Web?
Se você conseguir enviar uma mensagem com o último, mas não com o primeiro, obtenha um exemplo de solicitação HTTP de seu navegador para que possamos saber o que está fazendo de diferente. Sem isso, não sei o que precisa mudar.
I checked the request on the web and tried to reproduce it on SkyPy the request creates the chat with the number and sends the sms but after a few seconds it gets the message as in the photo above you want it to send as is the headers, body and which endpoint make the requisition?
headers, body and which endpoint
All of the above, same as what you'd get using SKPY_DEBUG_HTTP=1
with SkPy.
headers, body and which endpoint
All of the above, same as what you'd get using
SKPY_DEBUG_HTTP=1
with SkPy.
The parameter requestId is a str(uuid4()).
**HEADERS**
Accept: application/json
Accept-Encoding: gzip, deflate, br
Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6
Authentication: skypetoken=eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMiIsIng1dCI6IjNNSnZRYzhrWVNLd1hqbEIySmx6NTRQVzNBYyIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MTQyOTI0NzMsImV4cCI6MTYxNDM3ODg2OSwic2t5cGVpZCI6ImxpdmU6bmVnb2Npb3NhcHBsZSIsInNjcCI6OTU4LCJjc2kiOiIxNjE0MjkyNDY5IiwiY2lkIjoiZDYzZDRmM2MxN2VlNGZhMiIsImFhdCI6MTYxNDI2ODc5Nn0.d-WH5Y1kDw3uPOW0CX1YfPqBJdICZ_Ov0FTQvnsMtv9B00ulhK_w9ckc18-8t69-F-NiQ84DhSvgOYZ0fNwtilOJgp7SU6tjG0F1mSlGv8dDhMRhHJZUI2LHBO8x-Nb3bemKyqqpiJUEg5M_NFz3NWzjdXoSlSKEjSfcHeq2JrIAD3aJSVrX7rrtNUu0xzjIjJyNrySwltcC_7xvHYvxmGs2QZfmEAxpwLU5o1HqI7qncduW0hpUDcvjt2SSTPfgoI8twMnxEITsQivC1K7xjJBoP4kjEtMiU11R7bIGKPk2lyr92LKvaF0sT3fJG1p5uI0WtaC4wNIgohUbFU8SLg
BehaviorOverride: redirectAs404
ClientInfo: os=Windows; osVer=10; proc=x86; lcid=pt-BR; deviceType=1; country=US; clientName=skype4life; clientVer=1418/8.68.0.96//skype4life; timezone=America/Sao_Paulo
Connection: keep-alive
Content-Length: 759
Content-Type: application/json
Host: azeus1-client-s.gateway.messenger.live.com
Origin: https://web.skype.com
Referer: https://web.skype.com/
RegistrationToken: registrationToken=U2lnbmF0dXJlOjI6Mjg6QVFRQUFBQVkwYThDWDJYUmFCUE9yNUJ6cERQQTtWZXJzaW9uOjY6MToxO0lzc3VlVGltZTo0OjE5OjUyNDkxODQ5MTEyMzk1NjQ4ODk7RXAuSWRUeXBlOjc6MTo4O0VwLklkOjI6MT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agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
X-ECS-Etag: "W08y7ExnU3KljSMB1R8XXkZOu3GBOVpI+vLNr6FS6Xk="
**ENDPOINT**
https://azeus1-client-s.gateway.messenger.live.com/v1/users/ME/conversations/4:+5531993818360/messages?x-ecs-etag="W08y7ExnU3KljSMB1R8XXkZOu3GBOVpI+vLNr6FS6Xk="
**BODY**
clientmessageid: "7155319416505915828"
composetime: "2021-02-25T23:11:49.190Z"
content: "<sms alt="Hello test"><restApiVersion>2</restApiVersion><encoded_body>Hello test</encoded_body><defaults><skype><deliveryReportVersion>chatservice</deliveryReportVersion><uiVersion>1418/8.68.0.96</uiVersion></skype><control><flowId>skype.S4L.client.sms.1way</flowId><deliveryMethod>reliable</deliveryMethod></control><content><body>Hello test</body></content></defaults><bulkItems><bulkItem><requestId>c88a1865-8ab6-4f51-ba37-96b8e2807c70</requestId><recipient><address>+5531993818360</address></recipient></bulkItem></bulkItems></sms>"
contenttype: "text"
imdisplayname: "negociosapple apple"
messagetype: "RichText/Sms"
receiverdisplayname: "+5531993818360"
You've leaked your tokens in there, best logout that session ASAP.
So there's a few things going on here that probably want handling:
- phone contacts are type
4
- SMSes have their own message type
RichText/Sms
along with a specific HTML structure
Does this work? (replacing +441234567890 with an actual contact's number)
chat = sk.chats["4:+441234567890"]
chat.sendRaw(
messagetype="RichText/Sms",
content="""<sms alt="Message text"><encoded_body>Message text</encoded_body></sms>""",
imdisplayname="{0}".format(sk.user.name),
)
If not, does it work with the entire content line you quoted above?
The test created the message just like in my tests here but the sms is not sent for some reason.
Even with the full HTML message content?
Even with the full HTML message content?
Yes, i try with the full HTML message content and not worked
would be great if you can add reading/writing sms to this great project
I don't have the Skype credit or a subscription to test this with, so this won't go anywhere unless someone can reliably reproduce a working Skype for Web request for sending an SMS using SkPy, like the one I proposed above.
It's a request to client-s.gateway.messenger.live.com
and they're fairly standardised, so hopefully it doesn't depend on unusual parameters to work. SkypeChat.sendRaw()
will do a POST request to the right URL (sending an SMS appears to use the same endpoint as a regular Skype message), with kwargs
becoming the message body, so it should just be a case of finding the right combination of parameters.