Open leohenrique opened 5 years ago
I tried that but it didn't work. Whatsapp opens with a list of numbers loaded from the contacts for the user to choose.
@fneto Usually it happens when the phone number is not found. Did you inform the country code (without "+") correctly?
Share a snippet of your code, if you don't mind.
Hi, thanks for the response. I was trying it with the "+" sign. Its working now.
-- Felício Moysés Neto
Em ter, 2 de jul de 2019 às 10:24, Leonardo Henrique Centenaro < notifications@github.com> escreveu:
@fneto https://github.com/fneto Usually it happens when the phone number is not found. Did you inform the country code (without "+") correctly?
Share a snippet of your code, if you don't mind.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/1036?email_source=notifications&email_token=AADB72P7BSHYW7SO7IXT2MTP5NJHFA5CNFSM4H3652D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZBID2Q#issuecomment-507675114, or mute the thread https://github.com/notifications/unsubscribe-auth/AADB72JGLFBXJBULPC3J43TP5NJHFANCNFSM4H3652DQ .
I was trrying to use the methods mentioned above to no vail. However I've managed to make it work by simply passing the phone number (without "+" sign), instead of the parameter "0&phone=".
With the method you mentioned, it was opening WhatsApp but on the contacts list and an alert message saying that couldnt find the phone number because it was too short.
Anyway, hope this helps if there is anyone still facing this issue and expect an explanation towards why shareViaWhatsAppToPhone was removed.
@leohenrique
it solved my problem.
On IOS, shareViaWhatsAppToReceiver
was opening the contact list instead of opening a conversation with the number.
Thanks
Hello guys,
I want to share a workaround for those who want to share something via whatsapp using the phone number and not the AddressBook ID (ABID).
First of all, I was looking in the source code and there is a function "shareViaWhatsAppToPhone" in the SocialSharing.js file which has a parameter "phone" to be sent and which is used in the native function "shareViaWhatsApp:(CDVInvokedUrlCommand*)command" in SocialSharing.m. But for some reason this function is not available in the ionic lib. Maybe Eddy can answer it.
Anyway, the workaround I've found is definitely easy! You can jus use the function shareViaWhatsAppToReceiver passing in the first parameter (abid) a random value and concat with a string creating another parameter (phone) to the URL like in the example bellow:
this.socialSharing.shareViaWhatsAppToReceiver('0&phone=554999990000, 'My Message');
Regards, Leonardo Centenaro