htmlmobile-websitewhatsapp

Mobile website "WhatsApp" button to send message to a specific number


A mobile website can be customized to allow users to share a pre-filled message in WhatsApp to a manually chosen contact. As given here it is done using Custom URL Scheme. An example:

<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>

To call a particular number we use:

<a href="tel:0123456789">Call</a>

Similarly, can we send a WhatsApp message to a specific number (or at least open the chat) without user choosing the phone number manually rather it will be one of the predefined parameters/attribute values?


Solution

  • Format to send a WhatsApp message to a specific number (updated Nov 2018)

    <a href="https://wa.me/whatsappphonenumber/?text=urlencodedtext"></a>
    

    where

    whatsappphonenumber is a full phone number in international format

    urlencodedtext is the URL-encoded pre-filled message.


    Example:

    1. Create a link with a pre-filled message that will automatically appear in the text field of a chat, to be sent to a specific number

      Send I am interested in your car for sale to +001-(555)1234567

      https://wa.me/15551234567?text=I%20am%20interested%20in%20your%20car%20for%20sale

      Note :

      Use: https://wa.me/15551234567

      Don't use: https://wa.me/+001-(555)1234567

    2. Create a link with just a pre-filled message that will automatically appear in the text field of a chat, number will be chosen by the user

      Send I am enquiring about the apartment listing

      https://wa.me/?text=I%20am%20enquiring%20about%20the%20apartment%20listing

      After clicking on the link, user will be shown a list of contacts they can send the pre-filled message to.

    For more information, see https://www.whatsapp.com/faq/en/general/26000030

    --

    P.S : Older format (before updation) for reference

    <a href="https://api.whatsapp.com/send?phone=whatsappphonenumber&text=urlencodedtext"></a>