href whatsapp link to number - html

I'm having an issue trying to send Whatsapp messagges through browser using this code:
click
Using this code, Whatsapp opens correctly but the number is not recognized (i'm trying with my number, which is registered in Whatsapp) saying something like "You're trying to reach a non-Whatsapp number. Invite him or send SMS".
My international code (Italy) is +39.
I've tried 003912345, +3912345, 3912345, 12345, but with no success.
Anyone experienced this? Thanks for the help!

You get the message"You're trying to reach a non-Whatsapp number. Invite him or send SMS" because the number you want to use for sending the message to must be present into your phone contact list.
Anyway the attached code you use for the link won't work on iOS.
Try to use: href="whatsapp://send/?text=<>" data-action="share/whatsapp/share" . The link will open WhatsApp but you will have to manually select the consignee of the message from your contact list, otherwise you could use the ABID code to send the message directly to your contact.
Here you'll find more info about this technique: https://www.macstories.net/tutorials/use-whatsapps-url-scheme-with-drafts-launch-center-pro-or-a-bookmarklet/

Related

Link to chat whatsapp desktop

Is it possible to create link to chat for whatsapp on desktop and specify number
which doesn't exist in contact list?
whatsapp
This implementation works fine for mobile(doesn't matter number exists in your contact list or not), but for desktop in doesn't work if there are no such contact in your contact list and as a result I got a pop-up window with message 'Phone number shared via url is invalid'
yes, this is possible, but you need to :
Specify the text or/and link
For opening contact list, on zap, just set the content as text .
whatsapp://send?text=http://www.yoursite.com
Specify the zapzap telenumber for sending directly to contact .
whatsapp://send?phone=5531920095096&text=http://www.yoursite.com
You can also use the zapzap oficial page. This takes 2 steps :
https://api.whatsapp.com/send?phone=5531920095096&text=Hello
Remember that, all content on text variable must be a encoded string, and also that phone number have no spaces, or characters, also country code have not +
This is a nice feature, works very well. You can use (3) option and create a "goo.gl" url, and for options (1) and (2) you can trigger on a website, or app .
Actually, i'm trying to find some way to make whatsapp:// open in whatsapp desktop instead of asking for choose app from microsoft appstore, because now, its not opening it anymore, i dont know why, this used to work .
By the way, if you are a spammer .. don't even try anything, or we will catch you and all your fake numbers or profiles .
This is not for spamming. You have to use broadcast lists .
You can send the phone number so i can check if its correct, or, if you like, i can show you how this can be used, in our classifieds, included one buton for contact each seller, so users have an omnichannel experience .
Contacting advertisers from our site very fast, instead of saving, refreshing and contacting, can click and open zapzap chat .
If you have a website a customer service phone line, and a zapzap number, you are already a multi-channel business, so this is for seamless cross channel, so users can change from site to zapzap .
Remember that, best soluction for this issue is to use the API Page (3), and that you need to specify text variable all times, because IF you are going to send, you need to send something, and also, there is a "=" character after the phone number variable (at your example) that must be removed .
Please vote this up, because it took a long time to do .
Comment if you have anything to add .
Remember also that this is 2017-2018, and the zap implementation had started some months ago. Please whatsapp, let us opening whatsapp:// protocol from chrome to whatsapp desktop, it was working so nice .. please, it save us so much time, to start a conversation with a number not on contact list, and its working on mobile, just on desktop, that was nice, but since December update, its not running,.. whatsapp pleeeeeeeeeaseeeeee .
UPDATE: As i changed my phone number, i updated the post, because many people arround world contact me saying "thank you" or asking help on something .
Try this:
<body class="" onload="myWhatsappFunction()">
<a id="whatsapp-btn" class="" target="_blank"> Whatsapp</a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.4.3/mobile-detect.min.js"></script>
<script>
var whatsapp_number = YOUR_PHONE_NUMBER_HERE;
function myWhatsappFunction() {
var md = new MobileDetect(window.navigator.userAgent);
if (md.mobile()) {
// mobile link
document.getElementById("whatsapp-btn").href = "https://wa.me/" + whatsapp_number;
} else {
// desktop link
document.getElementById("whatsapp-btn").href = "https://web.whatsapp.com/send?phone=" + whatsapp_number;
}
};
</script>
References:
https://faq.whatsapp.com/en/android/26000030
http://hgoebl.github.io/mobile-detect.js
https://cdnjs.com/libraries/mobile-detect
To create your own link to your whatsapp number with a pre-filled message that will automatically appear in the text field of a Whatsapp WEB-chat, you can use: (Dont work on Firefox web browser)
<a href="https://api.whatsapp.com/send?phone=yourwhatsappnumberwithcountrycode&text=hello"</a>
this API promises work on all browsers check it out:
https://www.forblink.com/
Try to use such link - https://wa.me/"number" where the "number" is a phone number in international format without + or - or dots.
So it must look like that: https://wa.me/89273546633
A possible cause of this error 'Phone number shared via URL is invalid' is that the phone number that you are trying to invoke is not on Whatsapp list, i.e. the number does not receive WhatsApp messages since it might not be registered on WhatsApp. I tried that using several of my phone numbers and the ones not on WhatsApp were throwing this error but those on WhatsApp worked. Guess will save someone from debugging.
I had the same problem in the past week, only links like wa.me/number were working fine on desktop for the past few years.
It seems that WhatsApp’s policy changed. I read advice about updating or accepting the privacy policy "which I don't" but all not correct. I tried different account on new installation and it didn't work.
It does not require the phone to be in your contact list, if you chatted with the number it will work. If there is no previous chat it stopped working a week ago.
A very simple solution. I added my country's area code (+44) in-front of the mobile number.
It works for both mobile and desktop.
Alternate solution
If you have specific numbers to send
You cane upload the numbers on Google contact
Same email I'd needs to be in mobile

Objective C - Launch app after tapping link on email

im trying to launch my app when user taps on link on email .. i've seen many posts like this but i can't seem to get it to work .. there's a problem i've been encountering, if the link i send is https://www.google.com (or any other valid websites), when i tap on the link, it works. It launches safari then goes to the site.. but if i replace it with my urlScheme, the body in the email appears to be not read as a link .. by the way.. im creating the email message in the client side .. here is sample code..
Nsstring *htmlBodyWebsite = #“<a href=\”https://www.google.com\”>Click here</a>" < working
Nsstring *htmlBodyUrlScheme = #“<a href=\”myApp://\”>Click here</a>" <not working
// when i enter in safari browser - myApp:// << working
so it seems that i've setup urlscheme correctly since when i entered myApp:// in safari, it prompted me to launch my app.
so the process here is, i create the email message in the client side... then our server receives it and sends it via email to target recipient..
now when the recipient receives the email, here are some observations i've made..
when i send htmlBodyWebsite, it works fine. Using google chrome browser and in the email message itself, when i right click, then inspect, i would be able to find the referenced link with proper tagging
but with htmlBodyUrlScheme it doesn't have proper html tagging
thanks
it seems to work if i tap on the link using the ios built-in Mail app.. neither using safari to open gmail.com nor gmail app doesnt make it resolve this issue..

Web link to specific whatsapp contact

I'd like to place a link on a webpage which opens a whatsapp chat with a certain whatsapp contact. In other words: I want a "contact me by whatsapp" link to go next to the page's "Contact us my facebook/twitter/google+/etc" links. Something like:
href="whatsapp:contact=015555555555#s.whatsapp.com&message="I'd like to chat with you"
********* UPDATE ADDED AT THE END *********
I've tried many approaches and I have a winner (see Test 3), here is the result of each one:
(I think the Test 3 will also work for you because if the person visiting your site doesn't have you on their contact list, it's the only option that will allow it.)
In all tests, the number had to be complete, with country and location code without any initial zeros. Example:
+55(011) 99999-9999 (NOT)
+5511999999999 (YES)
On tests 1 and 2, it only worked with a plus sign on the country code: +5511999999999
Test 1:
Send Message
This way you must have the phonenumber on your contact list. It doesn't work for me because I wanted to be able to send a message to a number which I may not have on my contact list.
If you don't have the number on your contact list, it opens the Whatsapp listing all your registered contacts, so you can choose one.
It's a good option for sharing stuff.
Test 2:
Send Message
This approach only works on Android AND if you have the number on your contact list. If you don't have it, Android opens your SMS app, so you can invite the contact to use Whatsapp.
Test 3 (The Winner):
Send Message
This was the only way that worked fully for me.
It works on Android, iOS and Web app on the desktop,
You can start a conversation with a number that you don't have on your contact list
You can create a link with one pre-built message adding &text=[message-url-encoded] like:
https://api.whatsapp.com/send?phone=15551234567&text=Send20%a20%quote
And if you wish to have a bookmarklet for additional ease of use, you may use this one:
javascript: (function() { var val= prompt("Enter phone number",""); if (val) location="https://api.whatsapp.com/send?phone="+escape('972' + val)+""; })()
Youll need to change the country code(or remove it) to you.r target country and paste it in the address field in a chrome/firefox link
Worth notice:
I had to update my WhatsApp to the latest version
The number's country code must not have a leading plus
More details here: https://www.whatsapp.com/faq/en/general/26000030
***************** UPDATE (START) *****************
Whatsapp made available other option, now you can create one link to a conversation like this:
https://wa.me/[phonenumber]
The phone number should be in international format:
Like this:
https://wa.me/552196312XXXX
NOT like this:
https://wa.me/+55(021)96312-XXXX
And if you want to add one pre-built message to your link, you can add ?text= at the end with the text URL Encoded:
https://wa.me/552196312XXXX?text=[message-url-encoded]
Exemple:
https://wa.me/552196312XXXX?text=Send20%a20%quote
More info here:
https://faq.whatsapp.com/general/chats/how-to-use-click-to-chat
***************** UPDATE (END) *****************
The following link seems to work fine -
Ping me on WhatsApp
It opens the contact in WhatsApp app, along with the message 'Hello World!' prepopulated in the input text box.
(Tested this with google chrome on an android phone.)
Official WhatsApp doc Says-:
https://api.whatsapp.com/send?phone=countrycode+phonenumber
Use: https://api.whatsapp.com/send?phone=15551234567
Don't use: https://api.whatsapp.com/send?phone=+001-(555)1234567
https://faq.whatsapp.com/en/general/26000030
You can use the following URL as per the WhatsApp FAQ:
https://wa.me/PHONENUMBERHERE
Add the country code in front of the number and don't add any plus (+) sign or any dashes (-) or any other characters in the number. Only integrers/numeric values.
You can also predefine a text message to start with:
https://wa.me/PHONENUMBERHERE/?text=urlencodedtext
I've tried this:
whatsapp
changing 'phonenumber' into a specific phonenumber. This doesn't work completely, but when they click on the link it does open whatsapp and if they click on a contact the message is filled in.
If you want to open a specific person in chat you can, but without text filled in.
test
You'll probably have to make a choice between the two.
some links to help you
Sharing link on WhatsApp from mobile website (not application) for Android
https://www.whatsapp.com/faq/nl/android/28000012
Hope this helps
(I tested this with google chrome on an android phone)
You can now use a very simple API https://wa.me/ to perform this task where you can provide a valid whatsapp contact number like 15555555555 ( add country code, remove all '+', '-', brackets, spaces or leading zeros). You can also provide a urlencoded text as a predefined msg which user can send directly or change before sending.
Chat with me link : Contact me by whatsapp
Chat with me link with predefined text : Contact me on whatsapp
Beauty of this wa.me url is you don't need to check user agent as it works on both mobile and desktop (opens web.whatsapp.com)
Source : https://faq.whatsapp.com/en/general/26000030
More details in my answer on a similar question https://stackoverflow.com/a/51854282/2485420
For what its worth, as of this writing (Nov. 29, 2018), the updated API that seems to work on my end is using this link:
https://wa.me/<phone number here>
Note:
Just replace the placeholder <phone number here> with the intended phone number that you want to use INCLUDING the country code, this means I had to add +60 then the rest of the remaining number.
It doesn't work on my end without one (using Android and iOS at least). It doesn't work means an error message that says along the lines of "you don't have this number".
Reference:
https://faq.whatsapp.com/en/general/26000030
I have been struggling with how to do that as well. I managed to find this helpful method
from php variable:
href="https://wa.me/<?php echo esc_attr( $phone ); ?>?text=Hi%27,%20like%20to%20chat%20with%20you"
<?php echo esc_attr( $phone ); ?> for number in the format:
href="https://wa.me/263777300093?text=Hi%27,%20like%20to%20chat%20with%20you"
This approach only works on Android AND if you have the number on your contact list. If you don't have it, Android opens your SMS app, so you can invite the contact to use Whatsapp.
<i class="fa fa-whatsapp"></i>
Google Chrome am targeting a blank window
From the Official Whatsapp FAQ: https://faq.whatsapp.com/en/android/26000030/
WhatsApp's Click to Chat feature allows you to begin a chat with someone without having their phone number saved in your phone's address book. As long as you know this person’s phone number, you can create a link that will allow you to start a chat with them. By clicking the link, a chat with the person automatically opens. Click to Chat works on both your phone and WhatsApp Web.
To create your own link, use https://wa.me/ where the is a full phone number in international format. Omit any zeroes, brackets or dashes when adding the phone number in international format. For a detailed explanation on international numbers, read this article. Please keep in mind that this phone number must have an active account on WhatsApp.
Use: https://wa.me/15551234567
Don't use: https://wa.me/+001-(555)1234567
This answer is useful to them who want click to chat whatsapp in website to redirect web.whatsapp.com with default content or message and in mobile device to open in whatsapp in mobile app with default content to text bar in app.
also add jquery link.
<a target="_blank" title="Contact Us On WhatsApp" href="https://web.whatsapp.com/send?phone=+919581880892&text=Hi, I would like to get more information.." class="whatsapplink hidemobile" style="background-color:#2DC100">
<i class="fa fa-fw fa-whatsapp" style="color:#fff"></i>
<span style="color:#fff">
Contact Us On WhatsApp </span>
</a>
<a target="_blank" title="Contact Us On WhatsApp" href="https://api.whatsapp.com/send?phone=+919581880892&text=Hi,%20I%20would%20like%20to%20get%20more%20information.." class="whatsapplink hideweb" style="background-color:#2DC100">
<i class="fa fa-fw fa-whatsapp" style="color:#fff"></i>
<span style="color:#fff">
Contact Us On WhatsApp </span>
</a>
<script type="text/javascript">
var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
$('.hidemobile').css('display', 'none'); // OR you can use $('.hidemobile').hide();
}
else
{
$('.hideweb').css('display', 'none'); // OR you can use $('.hideweb').hide();
}
</script>
I tried all combination for swiss numbers on my webpage. Below my results:
Doesn't work for Android and iOS
https://wa.me/0790000000/?text=myText
Works for iOS but doesn't work for Android
https://wa.me/0041790000000/?text=myText
https://wa.me/+41790000000/?text=myText
Works for Android and iOS:
https://wa.me/41790000000/?text=myText
https://wa.me/041790000000/?text=myText
Hope this information helps somebody!
The solution that worked for me is here in PHP:
$android = stripos($_SERVER['HTTP_USER_AGENT'], "android");
$iphone = stripos($_SERVER['HTTP_USER_AGENT'], "iphone");
$ipad = stripos($_SERVER['HTTP_USER_AGENT'], "ipad");
$whatsappNumber = '1234597891';
$whatsappLink = '';
if($android !== false || $ipad !== false || $iphone !== false) {//For mobile
$whatsappLink = ''.$whatsappNumber.'';
} else {//For desktop
$whatsappLink = ''.$whatsappNumber.'';
}
Phone Number will be a country code followed by WhatsApp mobile number without any symbol. Please refer below code.
WhatsApp Now

getting URL of pages with ajax

This is a webpage with a number of "subpages" embedded in ajax for all the user reviews.
http://www.goodreads.com/book/show/13636400-the-bone-season#
I am trying to get the specific URL for particular pages (say ?page=4), so I can point people to particular reviews directly instead of going to the page and clicking on page4. below is a snippet from the source code for that page:
<a href="#" onclick="new Ajax.Request('/book/reviews/13636400-the-bone-season?page=4', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('XsOgyhAC4p0tAm8wGIqTQGY+PxGpDieI45AYry0NlE4=')}); return false;">
when i type http://www.goodreads.com/book/reviews/13636400-the-bone-season?page=4, i get a blank page.
What do I need to do get the page to show? Thank you!
You can get the url for the specific reviews, but I was unable to find anyway to do so for the "page". If you want to direct someone to a specific review, then you can get that url from the "see review" link or the date link on that particular review.
New answer: you need to submit a GET request (using cURL for example) with the parameter mentioned ('authenticity_token=' + encodeURIComponent('XsOgyhAC4p0tAm8wGIqTQGY+PxGpDieI45AYry0NlE4='), and parse what is sent back. Then you'll get your review. Linking to it is not possible unless you find a URL where your review is always displayed.

FB Share without App ID

Is it possible to use FB share plugin without APP ID?
If I use HTML5 code then the console logs an error FB.getLoginStatus() called before calling FB.init().
To use HTML 5 FB like is it necessary to have an APP ID?
Thank you
Here i am sharing what i did to share post on fb wall, In this way you do not need to use appId. Just put this code in your HTML page where you want link to share...
<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php?u={$url}&media={$imgPath}&description={$desc}" class="joinFB">Share Your Advertise</a>
URL parameters are as explained below,
u : url or link you want to user to go when he clicks on your wall post,
media : full image path,make sure that image is available on given path,it will accept one image only
description : a short description that you want to show on wall
It will also ask you to write some data which will be displayed above your post. Description passed in url will be displayed in right side of your image.
Please note that i had passed $url,$desc,$imgPath variables as per my need. The above code is in smarty-php, so change it as per your requirement.
Hope this becomes helpful to you.
Yes you need an app id. You can try to inject your own code into the DOM of the user when using facebook and call functions in their javascript... But I doubt many users will actiually use an "app" that works this way.