code committed

This commit is contained in:
VE10-Sanjeev 2024-01-25 18:59:41 +05:30
parent a8f2e8eca7
commit f05a7e4e28

View File

@ -93,7 +93,7 @@ class Notifications extends BaseController
$params->type = $records['type'] == "" ? "text" : $records['type'];
$params->instance_id = $_ENV['WAAI_INSTANCE'];
$params->access_token = $_ENV['WAAI_TOKEN'];
$params->message = $records['description'];
$params->message = strip_tags(ltrim($records['description']));
$this->logger->info("Whatsapp : sending message request = " . json_encode($params));
$this->logger->info("Whatsapp : sending message request type b4 = " . gettype($params));
helper('notification');
@ -564,7 +564,7 @@ class Notifications extends BaseController
// print_r($whatsappTemplateName);die;
if ((count($whatsappTemplateName) > 0) && !empty($whatsappTemplateName)) {
$campaign_id = 2; // hardcoded because static Template.
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
$history_parents_data = ['campaign_id' => 2,'status' => 0];
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
if (empty($userMobileNumber)) {
$history_msg = 'There is no subscriber mobile number';
@ -580,7 +580,7 @@ class Notifications extends BaseController
continue;
}
# Insertion on History Whatsapp Means Campaign ID 2 Hardcoded
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
$history_parents_data = ['campaign_id' => 2,'status' => 0];
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
# Step 7: Prepare whatsapp content based on the template
@ -594,7 +594,7 @@ class Notifications extends BaseController
'customer_id' => $customerId,
'receiving_entity' => $userMobileNumber,
'receiving_status' => 0,
'message' => $whatsappContent];
'message' => strip_tags(ltrim($whatsappContent))];
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
@ -603,7 +603,7 @@ class Notifications extends BaseController
$url = SEND_WAAI_URL;
$params->number = (int)'91' . $userMobileNumber;
$params->type = "text";
$params->message = $whatsappContent;
$params->message = strip_tags(ltrim($whatsappContent));
$params->instance_id = $_ENV['WAAI_INSTANCE'];
$params->access_token = $_ENV['WAAI_TOKEN'];
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request = " . json_encode($params));
@ -727,7 +727,7 @@ class Notifications extends BaseController
$params->type = "text";
$params->instance_id = $_ENV['WAAI_INSTANCE'];
$params->access_token = $_ENV['WAAI_TOKEN'];
$params->message = $notificationContent;
$params->message = strip_tags(ltrim($notificationContent));
$params->number = (int)'91' . $customer['mobile_no'];
$whatsapp_reponse = $notification->sendWhatsAppMessage($url, "POST", $params);
$whatsapp_reponse_msg = strtolower(gettype($whatsapp_reponse)) == "string" ? $whatsapp_reponse : json_encode($whatsapp_reponse['reponse']);