Felix
Felix

Reputation: 5619

Whatsapp URL Schema send message to phonenumber

is it possible to send a whatsapp message to a specific whatsapp account (phonenumer) which is not stored in contact book?

wanna set a whatsapp url scheme on my website to provide a direct contact via whatsapp.

Upvotes: 3

Views: 3340

Answers (4)

HoldOffHunger
HoldOffHunger

Reputation: 20881

Take a look at what happens when you use WhatsApp, but don't indicate a phone number: http://wa.me/?text=mytest. I get the result:

We couldn't find the page you were looking for

Hopefully this is not what you intended to share! I highly recommend using one of the following formats, without the wa.me domain, but with the api.whatsapp.com domain:

https://api.whatsapp.com/send?text=YourShareTextHere

https://api.whatsapp.com/send?text=YourShareTextHere&phone=123

If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#whatsapp

Social Share URLs

Upvotes: 0

Anupriya Annamalai
Anupriya Annamalai

Reputation: 111

Its's possible! tried with swift 3 and xcode 8.3.2.

    let date = Date()
    let msg = "Hi my dear friends\(date)"
    let urlWhats = "whatsapp://send?phone=phoneNumber&abid=phoneNumber&text=hi"
    if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
        if let whatsappURL = NSURL(string: urlString) {
            if UIApplication.shared.canOpenURL(whatsappURL as URL) {
                UIApplication.shared.openURL(whatsappURL as URL)
            } else {
                print("please install watsapp")
            }
        }
    }

Upvotes: 6

Ricardo A.
Ricardo A.

Reputation: 686

It's possible using WhatsApp Click to Chat: https://faq.whatsapp.com/en/android/26000030/

Basically you need to make an url like this: https://wa.me/PHONE_NUMBER?text=TEXT_TO_SEND

Working example: https://wa.me/514293537789?text=Hello%20this%20is%20an%20automatic%20message

You need to confirm then the message in a button that whatsapp will disponibilize after entering the link, this is done to avoid spam.

Upvotes: 1

Jesse W.
Jesse W.

Reputation: 44

No, it's not possible to send someone a message using WhatsApp without storing the number in Contact Book. And the reason for that is exactly what you're trying to do: WhatsApp won't allow you to send random numbers 'spam'. You'll have to collect numbers and add them to your contacts and then send them a message manually.

Upvotes: 1

Related Questions