Modify whatsapp messages for Quick Action Bar

Hi,

I have added quick action bar to the bottom of my mobile pages. I tried to customised the whatsapp link through the code below. However, whatsapp just fire off without any of the customised message.

Is it possible to modify the quick action bar such that a message can be added? My furthur plans is to have customised messages based on the URL.

import wixLocation from ‘wix-location’ ;

$w.onReady( function () {
//TODO: write your page related code here…
$w( “#quickActionBar1” ).onItemClicked((event) => {
let itemType = event.item.itemType; // “search”
let itemLabel = event.item.label; // “Search”
let itemLink = event.item.link; // “wix - Google Search
console.log(itemLink)
wixLocation.to(itemLink + “%26text%3Dcustomised%20message” );
});
});

Hey Shu.
The code you attached only get the information of the item that was clicked
To be able to send a custom message on WhatsApp, you need to use the Whatsapp API as described here:
https://faq.whatsapp.com/en/android/26000030/

You don’t need to use code to modify the Quick Action Bar for this.
https://support.wix.com/en/article/adding-and-setting-up-the-quick-action-bar-on-your-mobile-site

To add a custom message in your own WhatsApp link in, then simply follow the Wix Support pages for it.
https://support.wix.com/en/article/adding-a-link-to-whatsapp-on-your-site

Searching the forum before posting as stated in the forum guidelines would have found previous posts about this.
https://www.wix.com/corvid/forum/community-discussion/how-to-code-and-insert-a-whatsapp-call-and-message-button
https://www.wix.com/corvid/forum/community-discussion/whatsapp-banner
https://www.wix.com/corvid/forum/feature-requests/whatsapp-share-button
https://www.vorbly.com/Vorbly-Code/WIX-CODE-WHATSAPP-CLICK-TO-CHAT

As for using the QuickActionBar…
https://www.wix.com/corvid/forum/tips-tutorials-examples/new-api-mobile-quick-action-bar
https://www.wix.com/corvid/reference/$w.QuickActionBar.html

You can only get or set the values that are allowed in the API itself.

If you use onItemClicked,
https://www.wix.com/corvid/reference/$w.QuickActionBar.html#onItemClicked

Then as Bin has already stated, you are simply getting the details of that click event itself and you are not able to change it.

Get the information of the item that was clicked

$w("#myQuickActionBar").onItemClicked( (event) => {
  let itemType = event.item.itemType; // "search"
  let itemLabel = event.item.label;   // "Search"
  let itemLink = event.item.link;     // "https://www.google.com/search?q=wix"

  let imageSrc = event.itemIndex;     // 3
} );

Hi Bin and GOS,

Thank you for your replies. I have practically search the entire internet (inside and outside of Wix) and had gone through all the pages you have referred.

Probably I haven’t make myself clear in the question. What I am asking is that can I change the message for the whatsapp button in the Quick Action Bar programatically based on the page the user is at?

Example:
When he is at /product/item1, the message to appear is
“Hi, I am interested in item1”

When he is at /product/item2, the message to appear is
“Hi, I am interested in item2”

Do bear in mind, that the above are dynamic pages. In addition, I will also prefer not to duplicate/insert another whatsapp button to the page since I have already activated the whatsapp button at the quick action bar

Last but not least, you mentioned the below.
" Then as Bin has already stated, you are simply getting the details of that click event itself and you are not able to change it."

Do you mean it is not possible to programatically change the link for the Quick Action Bar at the moment?

hello can you find how to add?

Hi @sikshuwei

Sometimes building a custom button can be difficult for users like you. Here we recommend using WhatsApp: Start Chat Button. The app brings 10+ design options, highly flexible settings and customizable effects when clicking the WhatsApp. The best part is no coding or complex setup required. Try it out!