Giter VIP home page Giter VIP logo

Comments (4)

yaroslavche avatar yaroslavche commented on July 16, 2024

You don't need encode twice. query method expecs encoded json, where @type and method arguments is top level keys in same array. So try to just prepare array with payload, then encode and then pass as argument. Unfortunately, I can't check code below, but I think it should work.

$query = [
    '@type' => 'addContact',
    'contact' => [
        'phone_number' => '+584145782661',
        'first_name' => 'fernando',
        'last_name' => 'moutinho',
        'vcard' => '',
        'user_id' => 0,
    ],
    'share_phone_number' => true,
];
$addContact = $client->query(json_encode($query), 10);

from phptdlib.

sheko016 avatar sheko016 commented on July 16, 2024

hello @yaroslavche thank you very much for your prompt response.

Personally, it didn't work for me. like that.

add the contact by doing the following

$addContact = $client->query(json_encode(['@type' => 'importContacts', 'contacts' => [
    		[	
    			'phone_number' => '+584145782661',
    		],
    	]]), 10);

I have another question anyway.
How to send a message to a newly added contact?
but I'm going to open another thread for that question.
Thanks a lot
Greetings.

from phptdlib.

yaroslavche avatar yaroslavche commented on July 16, 2024

This questions aren't related to phptdlib (and how to send message you can find in docs for this repo). Also addContact !== importContact (what you asked about). And I don't know what's wrong on your side without any output. Read the docs, please, what need to send and what you should wait in response https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1import_contacts.html

from phptdlib.

sheko016 avatar sheko016 commented on July 16, 2024

Hi @yaroslavche

ok yes Mr. and if I am reading the documentation to perform all the possible tests.

Thanks a lot

Regards.

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.