Page 1 of 1
send Whats app or click to chat
Posted: Fri Jan 13, 2023 5:42 am
by rakde
I am new to the world of programming and my knowledge is very basic or none. How can I send a whats app message with the click to chat. or hyperlink. thanks for the support.
Re: send Whats app or click to chat
Posted: Fri Jan 13, 2023 6:39 am
by kev1n
nuBuilder has no inbuilt function to send messages to WhatsApp.
A quick Google search brought up this article:
https://www.callmebot.com/blog/whatsapp-from-php/
Re: send Whats app or click to chat
Posted: Fri Jan 13, 2023 5:29 pm
by rakde
ok, I understand, and generating a hyperlink concatenating the phone to make it work, example
https://wa.me/1XXXXXXXXXX?text=I'm%20in ... for%20sale
I would appreciate it very much
Re: send Whats app or click to chat
Posted: Fri Jan 13, 2023 7:44 pm
by kev1n
To compose the URL, you can use this function:
Code: Select all
function getLinkWhastapp(number, message) {
message = encodeURIComponent(message);
return `https://wa.me/${number}?text=${message}`;
}
Example:
Code: Select all
getLinkWhastapp('+your_number_here', 'hello');
To open the link:
Code: Select all
window.open(getLinkWhastapp('+your_number_here', 'hello'))
Re: send Whats app or click to chat
Posted: Sun Feb 05, 2023 9:59 pm
by rakde
Once again I request your support, I have a client table where there is a mobile phone field. This will be used to send the message by whatsapp when clicking on the button. but I can't make the phone number change in the link.
Here are the screens of how I'm doing it but nothing happens. I thank you once again for your support.
I have tried to concatenate two fields without success. I can't understand how the fields work in nubuilder. My experience is only in microsoft access but it is no longer functional.
Re: send Whats app or click to chat
Posted: Mon Feb 06, 2023 2:54 am
by kev1n
Replace the keyword String with const (lower-case)
Re: send Whats app or click to chat
Posted: Thu Mar 02, 2023 7:21 pm
by rakde
thanks kevin for the support provided.
I already made the word change (String with constand) nothing happens. I add examples
explain.
I have a table called customers. with the phone number field. Generate a button to send a service message. This must send the message for each record, that is, each time a client is consulted, the button must take the telephone number of the client that is consulted and send the message if the user clicks on the button.
Another way that I use is this code but the number of the selected record is not put either
window.open("
https://api.whatsapp.com/send?phone=521 ... lo%20There!");
I really appreciate your help a lot.
Re: send Whats app or click to chat
Posted: Thu Mar 02, 2023 8:19 pm
by kev1n
System.out.println() is Java, not JavaScript.
If the phone number is stored in a text field, you can retrieve it with telefono_movil.value
Write
Code: Select all
const phoneNumber = telefono_movil.value;
Instead of
Code: Select all
const phoneNumber = 'telefono_movil';
Re: send Whats app or click to chat
Posted: Fri Mar 03, 2023 3:20 am
by rakde
first of all thank you. for your support.
I already replaced the code, add the .value and without it since the field is number. sql base screen is attached.
and nothing happens. There will be another way to make it possible using other options, be it sql, html, etc.
Re: send Whats app or click to chat
Posted: Fri Mar 03, 2023 5:56 am
by kev1n
Compare my code
Code: Select all
const phoneNumber = telefono_movil.value;
With your code
Code: Select all
const phoneNumber = 'telefono_movil'.value;