Giter Site home page Giter Site logo

Comments (7)

yaroslavche avatar yaroslavche commented on June 4, 2024

I think firstly you should try to createPrivateChat (https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1create_private_chat.html) which would return chat object, in which you should try to send message

from phptdlib.

sheko016 avatar sheko016 commented on June 4, 2024

hello @yaroslavche
Thank you very much for your prompt reply.
Okay, I'm going to try it and then I comment on how it went for me.
again thank you very much for the information.
and sorry for the inconvenience caused.
Regards.

from phptdlib.

yaroslavche avatar yaroslavche commented on June 4, 2024

methods (which need query or execute, for example createPrivateChat)
objects (which you can receive in response, f.e. chat)

from phptdlib.

sheko016 avatar sheko016 commented on June 4, 2024

hello @yaroslavche
This is to comment that the test was 100% satisfactory
I want to thank you again for the help.
I comment here on my flow to see what you think and if you could give me some other tips

Mr the flow is as follows:

I have the phone number +584241214241
I import the contact with importContacts
if it returns 0 that person does not have a telegram.
If it returns an integer then that person does have a telegram and it returns the user_id of the contact.
I call all contacts with getContacts
Then I add the contact with its user_id with addContact
I call all the contacts again with getContacts -> I do not understand exactly why this step should be performed (It is something like to update the DB) -> but performing that step the complete flow works for me.
I create a private chat with the user_id with createPrivateChat
When I create a private chat it returns the chat_id
and finally I send the message with the chat_id with sendMessage

Thank you very much again for your support.

Regards.

from phptdlib.

yaroslavche avatar yaroslavche commented on June 4, 2024

Looks correct to me, but this is not means, that it actually is. I don't really know all nuances, since I'm not using tdlib. Maybe i would just change one thing (if this is possible): remove importContacts query. Firstly check if contact by phone number exists, and if not, then addContact.

from phptdlib.

sheko016 avatar sheko016 commented on June 4, 2024

Hi @yaroslavche

ok ok thanks.
Sorry if you are not using tdLib to use the telegram API that another library is using.?

and personally I did not find a way to verify if a contact exists within telegram.

Greetings.

from phptdlib.

PapaEmeritusX avatar PapaEmeritusX commented on June 4, 2024

hello @yaroslavche This is to comment that the test was 100% satisfactory I want to thank you again for the help. I comment here on my flow to see what you think and if you could give me some other tips

Mr the flow is as follows:

I have the phone number +584241214241 I import the contact with importContacts if it returns 0 that person does not have a telegram. If it returns an integer then that person does have a telegram and it returns the user_id of the contact. I call all contacts with getContacts Then I add the contact with its user_id with addContact I call all the contacts again with getContacts -> I do not understand exactly why this step should be performed (It is something like to update the DB) -> but performing that step the complete flow works for me. I create a private chat with the user_id with createPrivateChat When I create a private chat it returns the chat_id and finally I send the message with the chat_id with sendMessage

Thank you very much again for your support.

Regards.

Hi, could you share a piece of code for this procedure with TdApi?

from phptdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.