-
Notifications
You must be signed in to change notification settings - Fork 910
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
WhatsApp sharing for a spefic number for android and iOS #488
Comments
Afaik the abid is a whatsapp-specific id, which you can't retrieve with this plugin. If you know it I could add a method to use the abid and send it to whatsapp, but first plz figure out how to get that abid in the first place. |
Yes, sorry about not mentioning that. I know how to get the abid from the cordova contacts plugin [button onclick="navigator.contacts.pickContact(function(contact){alert('Contact details:'+JSON.stringify(contact));},function(err){alert('Error: ' + err);});">Get contacts info</button] |
Ha, interesting! Please see this doc and give the master repo a spin. |
Nice! sorry I had a deadline coming in two days and even the UI wasn't fully ready :) |
No, not on npm, only when using 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin' directly. But I've now published version |
Thanks a lot. Sorry for the late reply, I'm getting "Error - Plugin (or a specific plugin version) not found in external repo: cordova-plugin-x-socialsharing " |
What did you do to get that error exactly? |
That's what pg build gives "Error - Plugin (or a specific plugin version) not found in external repo: cordova-plugin-x-socialsharing - You can fix this here" |
The building went fine, I'll test it on device and get back to you. |
Finally got it to work on android! :) the country key must be there. 00 will not work, it must be + sign followed by the country key then the number i.e +310433885282. 00310433885282 won't work. The message doesn't appear on WhatsApp's text area though. I've used 'text msg', could it be the space(encode needed?)? |
Hello, just checking if you've seen my test results and edits :) the (untested at the moment) in the #whatsapp made me wonder. |
it open chat window of the reciver but the message does not appear in whatsapp text area. |
I have the same issue, it finds the receiver but it doesn't show the message. |
+1 |
Hi, I'm using I'm using this:
By reading the plugin code, it seems that it calls I suppose the only thing that can be wrong then is the abid? Is there are chance Whatsapp removed this support from their app? It seems that it still works on the Android version but not on the iOS version. |
I am getting the following error while using the shareViaWhatsAppToReceiver function.
The method exists in the SocialPlugin.js file, but does not show up in Chrome debugging. I tried the latest plugin version (5.0.12-dev) which installs as default. I also downgraded to 5.0.11 but still the same. Am I doing something wrong? |
@SandroGrzicic it should be window.plugins.socialsharing.shareViaWhatsAppToReceiver(contacts[i].id, 'msg', null, null); |
@ssj7 yes the abid is the contact ID as created or found by the contacts plugin. Are you saying that it works (directly opens the chat with that contact) for you on iOS with the latest Whatsapp version? |
Yes, it has always worked for me. Try it. |
@ssj7 can you do a quick check with the latest version of Whatsapp? I have noticed some change in their API docs, perhaps they removed the feature in the latest version? I just cannot get the correct chat window open. No matter what I do, it always goes opens Whatsapp (on iOS) in Recent Chats. Even when I type directly |
Just tested the latest build I made (on 12/18/2015) on iOS worked fine. Sorry I can't find the source www.zip I used for that build to test it against the latest build of the plugin. The 12/18/2015 build of my app(and the plugin) still works fine with the newest version of WhatsApp though. I'll test it and let you know as soon as I find it. Sorry, it has been a while since I've worked on that one. Worst case scenario I'll just extract the www folder of the ipa or the apk and try to rebuild the xml config. |
Thanks, no problem. I don't think there's really an issue with the plugin, the code is really straightforward, it looks more like an issue with Whatsapp, as I said above I even tried doing a |
Another thing I found is that since on Android you need to create the contact first before sharing to that contact (otherwise you get the nasty Whatsapp "Contact is not on whatsapp" prompt), it seems that sometimes if I open Whatsapp using Combined with the above iOS issue of being unable to directly start a chat with a number, it seems that Whatsapp has huge issues with this (I tested on a number of devices). |
good evening I am experiencing the following problem when using a code. It opens WhatsApp but the message field is not filled. Can someone tell me what to do?
Source: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#phonegap-build |
Im experiencing the same issues as @joaosore + if you put the img url, the app will crash. |
I'm also experiencing the same as @joasore. shareViaWhatsAppToReceiver() on android leaves the message field empty. Does anyone have an idea on how to fix this? |
Observed the same behavior. would be great to be able to automatically fill the message for a specific contact on android devices please :) ! |
We had the same problem with this in ionic. We could not get the intent system to work from within ioninc/cordova. It seems it's possible to send a message to a specific phone number like this:
On iOS it seems to work with the abid parameter. So putting both in the url should do it.
I don't know why this is not documented anywhere but for now it seems to work. You need this in config.xml:
|
First ,how to use this code,below? is there any proper example ? Second,is there any way to send a message to multiple receivers at Whatsapp ? Thank you in Advance We had the same problem with this in ionic. We could not get the intent system to work from within ioninc/cordova. It seems it's possible to send a message to a specific phone number like this:
On iOS it seems to work with the abid parameter. So putting both in the url should do it.
I don't know why this is not documented anywhere but for now it seems to work. You need this in config.xml:
|
Works for Android, however for iOS the abid parameter value needs to be something different apparently.. Doesn't work for me on iOS in any case. Thanks for the great find however! :) |
Hi! If you want this fixed please reopen with a suggested solution. |
Hi @SandroGrzicic! Did you find some fix to issue? I want to open a chat with specif abid contact, but just work on Android. Thanks! |
if u want to chat with specific person in whatsapp then here is the solution. //in my html or template //in my controller |
Thanks for sharing. The latest version of this plugin also supports this feature. See https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#by-phone-number-since-530 |
Hi @krunalsk007 and @EddyVerbruggen. For this works fine, I have to add some preference on config.xml? I'm with 5.3.0 version and the problem persists. Remember that for Android works perfectly, but for ios the whatsapp is opened in recent chats. |
@EddyVerbruggen I'm making the following called: The WhatsApp is called, but in recent chats, never in chat with the contact passed by abid code. Did you can see anything wrong? I'm testing in iOS 9, but on iOS 11 happens too. I'm trying solved this for weeks, help me please. Thanks. |
@eduardolopesUFJF Did you try the new |
@EddyVerbruggen this works to iOS too? |
Yes, but not for images. It's in the readme I linked to.. |
Wonderfull, I will need just for send text. I will test and let you know. Thank you so much. |
Works perfectly well! Really really really THANK'S @EddyVerbruggen! Did you save my life! |
Awesome, thanks for the feedback! |
One question, did this work for ionic 3? if that's how you implemented it, since using the plugin: https://ionicframework.com/docs/v3/native/social-sharing/ I can't access the shareViaWhatsAppToPhone function thanks for your help. |
In ios13.5 we couldn't use it, it says "can't open the link". We have to switch to the tipical href |
Hello,
Can that be achieved using this plugin?
For iOS there's href="whatsapp://send?text=HelloWorld&abid=9663
abid being the Address book ID, or id in the official cordova contacts plugin
I'm hoping for something like
msg via WhatsApp (with errcallback)
or for the number directly like:
cordova.plugins.Whatsapp.send("1112223333");
https://github.com/ranjitpandit/whatsapp-phonegap-plugin
(tried this plugin, but it didn't work out for me)
Thanks a lot! your SocialSharing plugin is really, really useful.
The text was updated successfully, but these errors were encountered: