Comments (4)
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.
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.
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.
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)
- /usr/include/phpcpp/throwable.h:29:1: error: expected class-name before ‘{’ token HOT 3
- Valid api_id must be provided. Can be obtained at https://my.telegram.org HOT 4
- SendMessage Issue HOT 4
- What is the problem?The server system is centos7
- Setup on WIndows 10 HOT 1
- How do I upgrade tdlib from version 1.8.10 to the latest 1.8.25? HOT 6
- more example HOT 1
- TDApi and TDLib not visible on PHP HOT 13
- TdConfig.cmake version: unknown HOT 13
- Please add example callback definition on new message event HOT 1
- Error while cmake HOT 1
- How to send a message to a newly added contact.? HOT 7
- how to integrate phptdlib in laravel HOT 1
- importContacts causes an error HOT 4
- how to accept terms of service in authorizationStateWaitRegistration? HOT 4
- Migrate from Travis CI to Github Actions
- setAuthenticationPhoneNumber Verify phone number timed out HOT 8
- Compile error on MessagesManager.cpp.o HOT 2
- Fatal error when git cloning this repo (submodules): "The unauthenticated git protocol on port 9418 is no longer supported."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phptdlib.