Mobile website “WhatsApp” button to send message to a specific number

后端 未结 9 1678
小鲜肉
小鲜肉 2020-12-01 02:16

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. A

相关标签:
9条回答
  • 2020-12-01 02:56

    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>
    
    0 讨论(0)
  • 2020-12-01 02:56

    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=+91xxxxxxxxx&amp;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=+91xxxxxxxxx&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>
    
    0 讨论(0)
  • 2020-12-01 02:59

    To send a Whatsapp message from a website, use the below URL.

    URL: https://api.whatsapp.com/send?phone=XXXXX&text=dummy

    Here the phone and text are parameters were one of them is required.

    • phone: To whom we need to send the message
    • text: The text needs to share.

    This URL is also can be used. It displays a blank screen if there is no application found!

    URL: whatsapp://send?text=The text to share!

    Note: All the above will work in web, only if WhatsApp desktop app is installed

    0 讨论(0)
提交回复
热议问题