Connect Your Account
Link your WordPress site to your onWebChat account to enable the live chat widget and AI features.
Account Connected
✓ Connected as: ' . esc_html($userOption);
} else {
$chatIdOption = get_option('onwebchat_plugin_option');
$displayChatId = isset($chatIdOption['text_string']) ? $chatIdOption['text_string'] : '';
echo '✓ Connected with Chat ID: ' . esc_html($displayChatId) . '';
}
?>
'POST',
'timeout' => 45,
'body' => array('email' => $userName, 'pass' => $userPass),
));
if (!is_wp_error($response) && !empty($response['body'])) {
$my_options = get_option('onwebchat_plugin_option');
$my_options['text_string'] = $response['body'];
update_option('onwebchat_plugin_option', $my_options);
update_option('onwebchat_plugin_option_pages_select', 1);
// Also fetch WooCommerce secret with same credentials
// This way user doesn't need to re-enter credentials in WooCommerce tab
onwebchat_fetch_wc_secret_on_login($userName, $userPass, $response['body']);
wp_redirect(admin_url('admin.php?page=onwebchat_settings&tab=general'));
exit;
} else {
onwebchat_login_error(true);
}
}
}
// Handle disconnect
if (isset($_GET["action"]) && $_GET["action"] == "deactivate") {
$my_options = get_option('onwebchat_plugin_option');
$my_options['text_string'] = '';
update_option('onwebchat_plugin_option', $my_options);
update_option('onwebchat_plugin_option_pages_select', 1);
wp_redirect(admin_url('admin.php?page=onwebchat_settings&tab=general'));
exit;
}
}