Add different phone numbers from database to constant WhatsApp url.

Hi there! Can anyone assist me with this, I don’t have any experience in coding so this is quite a challenge. :sweat_smile: Anyway, I wanted my website ‘visitors’ to be able to contact the ‘members’ in my website through a WhatsApp button.

So my idea is to have a button on a repeater that is showing all my members. I’m expecting more than 300 members so adding the link manually will be troublesome.

My idea is to put constant URL (https://wa.me) followed by their ‘phoneNumber’ my dataset. I tried this but I kept on getting error from WhatsApp website/apps. Here:

export function button2_click(event) {

let phone = ‘${$dataset1.phoneNo}’

let link = ‘https://wa.me/+ phone’ ;

wixLocation.to (link);
}

Your help is much appreciated. Thank you in advance!! :grin:

This has already been talked about in previous posts like here.
https://www.wix.com/corvid/forum/community-discussion/whatsapp-banner
https://www.wix.com/corvid/forum/community-discussion/how-to-code-and-insert-a-whatsapp-call-and-message-button

Hi, thanks for the response. I have read them both previously but it was insufficient. If I only wanted to insert my number then it will be sufficient.

But, as I’ve said I am having around 300 members in my website. So it will be inefficient to manually link 300+ numbers as how the guide has shown. I wanted the site visitors to be able to contact my 300 members phone numbers, not mine.

The 300 members profile info will be shown to the public visitors through a ‘REPEATER’. So there is a ‘WhatsApp Me’ button IN EACH OF THEIR PROFILE that enable visitors to WhatsApp any of the 300+ numbers .

What I wanted to is to extract all ‘their’ numbers from my database and link them a constant url. And, the other thing I read since I’m using a repeater I must use ‘itemReady’ code. Quite lost here since I’m new to all this.

Can you maybe please show me a line of code that can extract their phone numbers from the database and put it behind the constant ‘https://wa.me/(theirphoneno)’ url

Thanks again!

Getting details from a dataset on a repeater has also been talked about in this forum many times before as well, search and you will find…
https://www.wix.com/corvid/forum/community-discussion/retrieve-the-items-data-that-is-clicked-in-a-repeater-1
https://www.wix.com/corvid/forum/community-discussion/retrieve-the-items-data-that-is-clicked-in-a-repeater
https://www.wix.com/corvid/forum/community-discussion/how-to-link-a-call-button-in-a-repeater-to-a-value-field
https://www.wix.com/corvid/forum/community-discussion/members-email-linked-to-repeater
https://www.wix.com/corvid/forum/community-discussion/making-a-button-or-a-link-go-to-a-dynamic-content-email-address

Simple code something like this can work as well…

$w.onReady(() => { 
$w("#yourDataset").onReady(() => {   $w("#yourRepeater").onItemReady(($item, itemData, index) => {    $item('#yourButton').onClick(() => {
//rest of code//

Here is my code, please tell me what i did wrong…didnt work. Sorry I dont have any previous experience in this area…

import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;

$w.onReady( function () {

});

export function searchBar_keyPress(event, $w) {
let SearchValue = $w( “#searchBar” ).value;
$w( ‘#dataset1’ ).setFilter(wixData.filter().contains( ‘daerah’ , SearchValue));

} 

$w.onReady( function () {

});

$w( “#dataset1” ).onReady(() => {
$w( “#repeater1” ).onItemReady(($item, itemData, index) => {

export function image2_click(event, $w) {

let phone = $w( “#text548” ).text;
let link = “https://wa.me/” + phone;

wixLocation.to ( ‘link’ )

}

Bumped up old post from 2018 closed.
https://www.wix.com/corvid/forum/community-discussion/members-email-linked-to-repeater

As for your code, for starters do what Avi suggested in the old post from 2018 and you only need the one onReady page function underneath your imports.