Elementor form Capture the data and send it directly to whatsapp

sharlesstm

Member
Oct 6, 2019
106
14
18
I found this plugin that does this, except that I would like to change its code so that when the form is filled in the data by cell phone it sends by api.whatsapp ... and when it is filled by the computer it captures the data and sends it over the web. whatsapp.com .. Can anyone help?

View Plugin
 

sharlesstm

Member
Oct 6, 2019
106
14
18
This is the current code that captures the data:

public function run( $record, $ajax_handler ) {
$whatsapp_to = $record->get_form_settings( 'whatsapp_to' );
$whatsapp_message = $record->get_form_settings( 'whatsapp_message' );

$whatsapp_to = 'https://wa.me/'.$whatsapp_to.'?text='.$whatsapp_message.'';
$whatsapp_to = $record->replace_setting_shortcodes( $whatsapp_to, true );

if ( ! empty( $whatsapp_to ) ) {
$ajax_handler->add_response_data( 'redirect_url', $whatsapp_to );
}
 

jancok

Active member
Oct 6, 2019
154
99
43
Graveyard
www.presidenri.go.id
This is the current code that captures the data:

public function run( $record, $ajax_handler ) {
$whatsapp_to = $record->get_form_settings( 'whatsapp_to' );
$whatsapp_message = $record->get_form_settings( 'whatsapp_message' );

$whatsapp_to = 'https://wa.me/'.$whatsapp_to.'?text='.$whatsapp_message.'';
$whatsapp_to = $record->replace_setting_shortcodes( $whatsapp_to, true );

if ( ! empty( $whatsapp_to ) ) {
$ajax_handler->add_response_data( 'redirect_url', $whatsapp_to );
}

what's exactly wrong with your code above?
you have to make sure the phone number format using country code without + (plus) sign.
 

sharlesstm

Member
Oct 6, 2019
106
14
18
what's exactly wrong with your code above?
you have to make sure the phone number format using country code without + (plus) sign.


There is no mistake

I just need it to adjust to call a url (wa.me/55 ...) for mobile and (web.whatsapp.com ..) for desktop automatically.
 

jancok

Active member
Oct 6, 2019
154
99
43
Graveyard
www.presidenri.go.id
There is no mistake

I just need it to adjust to call a url (wa.me/55 ...) for mobile and (web.whatsapp.com ..) for desktop automatically.
the url wa.me/{phone_number} works for both mobile app and web version, you don't need to change anything. Just try to open a wa.me/{phone_number} on your desktop and phone.
 

hanson21

Member
Nov 14, 2019
95
19
8
just tried the plugin , it doesnt work at all.
after the submit button clicked its only refreshed the page
help please thanks
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu