use FacebookAds\Api;
use FacebookAds\Object\Business;
use Brick\PhoneNumber\PhoneNumber;
use Brick\PhoneNumber\PhoneNumberParseException;
add_action('wp_ajax_nopriv_hubspot_channel_notification', 'hubspot_channel_notification');
function hubspot_channel_notification(){
wp_die();
}
add_action('wp_ajax_nopriv_get_whatsapp_template_from_hubspot', 'get_whatsapp_template_from_hubspot');
function get_whatsapp_template_from_hubspot(){
global $log;
$input = json_decode(file_get_contents('php://input'));
// $log->add(__FUNCTION__, "=========================");
// $log->add(__FUNCTION__, 'input - ' . print_r( $input, true ));
$inputFieldName = $input->inputFieldName;
$inputFields = $input->inputFields;
$result = new stdClass();
$result->options = new stdClass();
$options = false;
$use_transient = false;
if( isset( $inputFields->whatsapp_origin_number->value ) && isset( $inputFields->whatsapp_template->value ) ){
$transient_name = 'whatsapp_template_from_hubspot_' . $inputFieldName . $inputFields->whatsapp_origin_number->value . '_' . $inputFields->whatsapp_template->value;
$use_transient = true;
} else {
$transient_name = 'whatsapp_template_from_hubspot_' . $inputFieldName;
}
if( $use_transient ){
$options = get_transient( $transient_name );
}
// if( !$options){
$options = [];
if( $inputFieldName == 'whatsapp_origin_number' ){
Api::init(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ));
$business = new Business(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_business_id' ));
$owned_wabas = $business->getOwnedWhatsAppBusinessAccounts();
foreach( $owned_wabas as $waba) {
$waba_account = New Whatsapp_Business_Account(
$waba->id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$numbers = $waba_account->get_numbers();
foreach( $numbers->data as $number ){
$response = new stdClass();
$response->label = $number->verified_name;
$response->description = $number->display_phone_number;
$response->value = $waba->id. '|' .$number->id;
$options[] = $response;
// $options[ $number->verified_name.' ( '.$number->display_phone_number.' )' ] = $waba->id. '|' .$number->id;
}
}
}
if( $inputFieldName == 'whatsapp_template' ){
if( isset( $inputFields->whatsapp_origin_number->value ) ) {
Api::init(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ));
$business = new Business(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_business_id' ));
$owned_wabas = $business->getOwnedWhatsAppBusinessAccounts();
// $options['Sin plantilla'] = 'no_template';
$selected = explode('|', $inputFields->whatsapp_origin_number->value);
$waba_id = $selected[0];
$number_id = $selected[1];
$waba_account = New Whatsapp_Business_Account(
$waba_id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$templates = $waba_account->get_templates();
$templates_found = false;
foreach( $templates->data as $template ){
if( strpos( $template->name, 'hubspot' ) !== false || strpos( $template->name, 'difusion' ) !== false ){
$response = new stdClass();
$response->label = $template->name;
$response->description = $template->category.'/'.$template->status.' - '. $template->language;
$response->value = $template->name.'|'.$waba_id.'|'.$number_id.'|'.$template->language;
$options[] = $response;
$templates_found = true;
}
}
if( !$templates_found ){
$response = new stdClass();
$response->label = 'No se encontraron plantillas';
$response->value = 'no_template';
$options[] = $response;
}
}
}
if( $inputFieldName == 'whatsapp_header_params_count' ){
if( isset( $inputFields->whatsapp_template->value ) ) {
Api::init(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ));
$business = new Business(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_business_id' ));
$selected = explode('|', $inputFields->whatsapp_template->value);
$template_name = $selected[0];
$waba_id = $selected[1];
$number_id = $selected[2];
$language = $selected[3];
$waba_account = New Whatsapp_Business_Account(
$waba_id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$template = $waba_account->get_template( $template_name );
// $log->add(__FUNCTION__, "=========================");
// $log->add(__FUNCTION__, 'template - ' . print_r( $template, true ));
$params_found = false;
$supported_headers = [
'IMAGE' => [ 'text' => 'URL de imágen', 'params' => 1 ],
'VIDEO' => [ 'text' => 'URL del video', 'params' => 1 ],
'DOCUMENT' => [ 'text' => 'URL del documento', 'params' => 1 ],
'TEXT' => [ 'text' => 'Texto', 'params' => 1 ],
];
foreach( $template->components as $component ){
if( $component->type == 'HEADER' ){
if( in_array( $component->format, array_keys( $supported_headers ) ) ){
$params_found = true;
$response = new stdClass();
$response->label = $supported_headers[$component->format]['params'] . ' parámetros ('. $component->format .')';
if( $component->format == 'TEXT' ){
foreach( $component->example as $header_text ){
$params_desc = implode('|', $header_text );
$response->description = $params_desc;
}
} else {
$response->description = $supported_headers[$component->format]['text'];
}
$response->value = $component->format;
$options[] = $response;
}
}
}
if( !$params_found ){
$response = new stdClass();
$response->label = '0 parámetros';
$response->value = 'none';
$options[] = $response;
}
}
}
if( $inputFieldName == 'whatsapp_body_params_count' ){
if( isset( $inputFields->whatsapp_template->value ) ) {
Api::init(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ));
$business = new Business(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_business_id' ));
$selected = explode('|', $inputFields->whatsapp_template->value);
$template_name = $selected[0];
$waba_id = $selected[1];
$number_id = $selected[2];
$language = $selected[3];
$waba_account = New Whatsapp_Business_Account(
$waba_id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$template = $waba_account->get_template( $template_name );
$params_found = false;
foreach( $template->components as $component ){
if( $component->type == 'BODY' && isset( $component->example->body_text ) && count( $component->example->body_text ) > 0 ){
foreach( $component->example->body_text as $body_text ){
$params_desc = implode('|', $body_text );
$params_found = true;
$response = new stdClass();
$response->label = count( $body_text ) . ' parámetros';
$response->description = $params_desc;
// $response->description = $component->text;
$response->value = $component->type;
$options[] = $response;
}
}
}
if( !$params_found ){
$response = new stdClass();
$response->label = '0 parámetros';
$response->value = 'none';
$options[] = $response;
}
}
}
if( $inputFieldName == 'whatsapp_footer_params_count' ){
if( isset( $inputFields->whatsapp_template->value ) ) {
Api::init(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ), get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ));
$business = new Business(get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_business_id' ));
$selected = explode('|', $inputFields->whatsapp_template->value);
$template_name = $selected[0];
$waba_id = $selected[1];
$number_id = $selected[2];
$language = $selected[3];
$waba_account = New Whatsapp_Business_Account(
$waba_id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$template = $waba_account->get_template( $template_name );
$params_found = false;
$params_count = 0;
$params_desc = [];
foreach( $template->components as $component ){
if( $component->type == 'BUTTONS' ){
foreach( $component->buttons as $button ){
if( isset( $button->example ) ){
// $params_desc .= implode('|', $button->example );
$params_desc[] = $button->text . ' ('.$button->type.')';
$params_found = true;
$params_count ++;
}
}
if( $params_found ){
$response = new stdClass();
$response->label = $params_count . ' parámetros';
// $response->description = $params_desc;
$response->description = implode('|', $params_desc );
$response->value = $component->type;
$options[] = $response;
}
}
}
if( !$params_found ){
$response = new stdClass();
$response->label = '0 parámetros';
$response->value = 'none';
$options[] = $response;
}
}
}
if( $use_transient ){
set_transient( $transient_name, $options, HOUR_IN_SECONDS );
}
// }
$result->options = new stdClass();
$result->options = $options;
// $log->add(__FUNCTION__, "=========================");
// $log->add(__FUNCTION__, $inputFieldName . ' result - ' . print_r( $result, true ));
// $log->add(__FUNCTION__, $inputFieldName . ' result - ' . json_encode( $result ));
wp_send_json( $result, 200 );
}
add_action('wp_ajax_nopriv_send_whatsapp_message_from_hubspot', 'send_whatsapp_message_from_hubspot');
function send_whatsapp_message_from_hubspot(){
global $log;
$input = json_decode(file_get_contents('php://input'));
// $log->add(__FUNCTION__, "=========================");
// $log->add(__FUNCTION__, 'input - ' . print_r( $input, true ));
$fields = $input->fields;
$whatsapp_template = $fields->whatsapp_template;
$whatsapp_destination_number = $fields->whatsapp_destination_number;
$whatsapp_header_params_count = $fields->whatsapp_header_params_count;
$whatsapp_header_params_content = isset($fields->whatsapp_header_params_content) ? $fields->whatsapp_header_params_content : '';
$whatsapp_body_params_count = $fields->whatsapp_body_params_count;
$whatsapp_body_params_content = isset($fields->whatsapp_body_params_content) ? $fields->whatsapp_body_params_content : '';
$whatsapp_footer_params_count = $fields->whatsapp_footer_params_count;
$whatsapp_footer_params_content = isset($fields->whatsapp_footer_params_content) ? $fields->whatsapp_footer_params_content : '';
$output = new stdClass();
$output->outputFields = new stdClass();
try {
$number_info = bot_getPhoneNumberInfo( $whatsapp_destination_number );
if( !$number_info ){
// $log->add('error_' . __FUNCTION__, "=========================");
// $log->add('error_' . __FUNCTION__, 'input - ' . print_r( $input, true ));
$output->outputFields->errorCode = 'NUMBER_NOT_VALID';
$output->outputFields->whatsapp_destination_number = $fields->whatsapp_destination_number;
$output->outputFields->hs_execution_state = "FAIL_CONTINUE";
// $log->add('error_' . __FUNCTION__, 'output ' . print_r( $output, true) );
wp_send_json( $output, 400 );
return;
}
$whatsapp_template = explode('|', $whatsapp_template);
$template_name = $whatsapp_template[0];
$waba_id = $whatsapp_template[1];
$number_id = $whatsapp_template[2];
$template_language = $whatsapp_template[3];
// // $log->add(__FUNCTION__, 'template_name - ' . print_r( $template_name, true ));
// // $log->add(__FUNCTION__, 'waba_id - ' . print_r( $waba_id, true ));
// // $log->add(__FUNCTION__, 'number_id - ' . print_r( $number_id, true ));
// // $log->add(__FUNCTION__, 'template_language - ' . print_r( $template_language, true ));
$waba_account = New Whatsapp_Business_Account(
$waba_id,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' ),
);
$template = $waba_account->get_template( $template_name );
// $log->add(__FUNCTION__, 'template - ' . print_r( $template, true ));
$session = New Whatsapp_Session_Handler( str_replace("+", "", $number_info ) , $number_id, 'whatsapp_api' );
if ( ! $session->get_session() ) {
/**Si no hay una sesion creada no salta el contacto actual */
$session->create_session();
}
Whatsapp_Webhook_Payload::init($number_id, (string) $number_info);
$wa_webhook = Whatsapp_Webhook_Payload::instance();
$wa_message_api = New Whatsapp_Message_Api(
$wa_webhook,
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_id' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_secret' ),
get_option( WHATSAPP_BOT_PLUGIN_PREFIX . 'facebook_app_token' )
);
$template_params = [];
if( !empty( $whatsapp_header_params_content ) && !empty( $whatsapp_header_params_count ) && $whatsapp_header_params_count != 'none' ){
$template_params['header'][$whatsapp_header_params_count] = $whatsapp_header_params_content;
}
if( !empty( $whatsapp_body_params_content ) ){
$params = explode('|', $whatsapp_body_params_content);
$params = array_map('trim', $params);
$template_params['body'] = $params;
}
if( !empty( $whatsapp_footer_params_content ) ){
$params = explode('|', $whatsapp_footer_params_content);
$params = array_map('trim', $params);
$template_params['buttons'] = $params;
}
// $log->add(__FUNCTION__, 'template_params - ' . print_r( $template_params, true ));
$components = $waba_account->prepare_components_v2($template_name , $template_params );
// $log->add(__FUNCTION__, 'components - ' . print_r( $components, true ));
$result = $wa_message_api->send_template( $template_name, $template_language, $components['components'] );
// $log->add(__FUNCTION__, 'result - ' . print_r( $result, true ));
try {
$message_send = $waba_account->get_template_body( $template_name, $template_params );
$output->outputFields->message_send = $message_send;
} catch (Exception $e) {
$output->outputFields->message_send = 'Error: ' . $e->getMessage();
}
if( isset($session) ){
$session->set_variable( 'outgoing_message_created', date( 'Y-m-d' ) );
$session->set_variable( 'outgoing_message_type', 'workflow' );
}
$output->outputFields->message_id = $result;
$output->outputFields->whatsapp_destination_number = $whatsapp_destination_number;
$output->outputFields->hs_execution_state = "SUCCESS";
$output->outputFields->whatsapp_template_send = $template_name;
$output->outputFields->whatsapp_template_params = $template_params;
} catch (Exception $e) {
$log->add('error_' . __FUNCTION__, "=========================");
$log->add('error_' . __FUNCTION__, 'input - ' . print_r( $input, true ));
$log->add('error_' . __FUNCTION__, 'whatsapp_template - ' . print_r( $whatsapp_template, true ));
$log->add('error_' . __FUNCTION__, 'whatsapp_body_params_count - ' . print_r( $whatsapp_body_params_count, true ));
$log->add('error_' . __FUNCTION__, 'whatsapp_destination_number - ' . print_r( $whatsapp_destination_number, true ));
$log->add('error_' . __FUNCTION__, 'number_info - ' . print_r( $number_info, true ));
$log->add('error_' . __FUNCTION__, 'template_params - ' . print_r( $template_params, true ));
$log->add('error_' . __FUNCTION__, 'Exception - ' . print_r( $e->getMessage(), true ));
$output->outputFields->errorCode = 'API_ERROR';
$output->outputFields->exceptionMessage = $e->getMessage();
$output->outputFields->hs_execution_state = "FAIL_CONTINUE";
wp_send_json( $output, 400 );
return;
}
wp_send_json( $output, 200 );
return;
}
Glow With Love + Dead Sea Mud Mask Kit - Infinitek Paris
This is a demo store for testing purposes — no orders shall be fulfilled. Dismiss
Skip to content
“Retinol Moisturizer Cream” has been added to your basket.
View cart
Glow With Love + Dead Sea Mud Mask Kit
$ 119.80 USD $ 140.99 USD Saves $ 21.19 USD
Hydrate, firm, and exfoliate your skin.
The perfect kit to make you fall in love with smooth, impurity-free skin. Give love and care to your skin with these 4 essential products for your skincare routine.
Vitamin C + Organic Silicium Serum. Strengthens the skin, while fighting the effects of free radicals, pollution, and sun damage (The main causes of premature aging.) It acts as a radiance enhancer, improving and brightening the skin tone, revealing a renewed, radiant, and youthful appearance.
Contains: Vitamin C stabilized with Organic Silicium, Hyaluronic Acid, Vitamin E, Ferulic Acid, Ginkgo Biloba, Ginseng, Pomegranate, and Green Tea.
Multi-Active 360 Eye Contour. Firms, brightens, and hydrates, while preventing and diminishing the appearance of dark circles, puffiness, and wrinkles.
Contains: Caffeine, Retinol, Hyaluronic Acid, Elderflower, Collagen, Caviar, Elastin, and Avocado Oil.
Hyaluronic Acid + Organic Silicium Serum. Provides an intense and long-lasting hydration. Diminishes and prevents the appearance of wrinkles and fine lines. Visibly improves skin firmness, thickness, and texture, making it more resilient and flexible.
Contains: Hyaluronic Acid and organic Silicium, allowing greater permeability of Hyaluronic Acid.
Dead Sea Mud Mask. Designed to prevent and diminish the appearance of acne, pimples, eczema, and enlarged pores. Its antioxidant and remineralizing formula cleanses, purifies, and restores the skin’s natural balance. Absorbs excess oil and deeply detoxifies pores, eliminating impurities and dead cells.
Contains: Extracts of Centella Asiatica, Yarrow, Tusilago, Calendula, Shea Butter, and Almond Oil. Its formula is rich in vitamins A, and E and natural minerals such as Magnesium, Sodium, Calcium,
and Potassium.
For more information, contact one of our advisors at +1 (786) 233 6429.
How To Use Step 1: Vitamin C + Organic Silicium Serum. After cleansing, apply 4 to 6 drops in the palm of your hand, then apply to the face, neck, and décolleté using gentle touches.
Step 2: Multi-Active 360 Eye Contour. Apply a small amount to the eye contour area, dabbing gently with the ring finger.
Step 3: Hyaluronic Acid + Organic Silicium Serum. Place 4 to 6 drops in the palm of your hand, then apply to the face, neck, and décolleté using gentle touches. Start from the center of the face and move outward, ensuring even distribution until completely absorbed.
Step 4: Dead Sea Mud Mask. Apply once or twice a week to clean, dry skin on the face, neck, décolleté and back, avoiding the eyes and mouth area. Leave on for at least 15 minutes until the mask dries and then remove with lukewarm water.
For more information, contact one of our advisors at +1 (786) 233 6429.
Glow With Love + Dead Sea Mud Mask Kit
$ 119.80 USD $ 140.99 USD Saves $ 21.19 USD
Switching language?
You've switched the language and there are items in the cart. If you keep the USA - English language, the cart will be emptied and you will have to add the items again to the cart.
Keep USA - English
Switch back to Colombia
Reviews
There are no reviews yet.