Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

send Whats app or click to chat

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
rakde
Posts: 6
Joined: Thu Dec 22, 2022 3:24 am
Has thanked: 2 times

send Whats app or click to chat

Unread post 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.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: send Whats app or click to chat

Unread post 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/
rakde
Posts: 6
Joined: Thu Dec 22, 2022 3:24 am
Has thanked: 2 times

Re: send Whats app or click to chat

Unread post 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
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: send Whats app or click to chat

Unread post 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'))
rakde
Posts: 6
Joined: Thu Dec 22, 2022 3:24 am
Has thanked: 2 times

Re: send Whats app or click to chat

Unread post 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.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: send Whats app or click to chat

Unread post by kev1n »

Replace the keyword String with const (lower-case)
rakde
Posts: 6
Joined: Thu Dec 22, 2022 3:24 am
Has thanked: 2 times

Re: send Whats app or click to chat

Unread post 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.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: send Whats app or click to chat

Unread post 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';
rakde
Posts: 6
Joined: Thu Dec 22, 2022 3:24 am
Has thanked: 2 times

Re: send Whats app or click to chat

Unread post 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.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: send Whats app or click to chat

Unread post by kev1n »

Compare my code

Code: Select all

const phoneNumber = telefono_movil.value;
With your code

Code: Select all

const phoneNumber = 'telefono_movil'.value;
Post Reply