CHANGE_ notification template : GWM

This commit is contained in:
bitbucket 2024-07-02 11:51:16 +05:30
parent 7be64a1db8
commit b463bb22d8
4 changed files with 23 additions and 32 deletions

6
.env
View File

@ -72,12 +72,12 @@ database.default.port = 3306
WAAI_INSTANCE = '666FEE6738696'
WAAI_TOKEN = '666fd862df687'
WAAI_INSTANCE = '66712908EB75A'
WAAI_TOKEN = '667128c844c48'
API_KEY = 'HgvlULWCIrs'; // Your API key
DLT_Template_ID = '1105171896608602869'; // DLT Template ID
DLT_Template_ID = '1107171922342349877'; // DLT Template ID
SENDER_ID = 'LDRCHN'; // Sender ID
SERVICE_NAME = 'TEMPLATE_BASED'; // Service name

View File

@ -846,7 +846,7 @@ class MasterController extends BaseController
$documentUrl = base_url();
helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=>md5($doc_id)], 100) . '">Preview and Approve Document</a>';
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=> md5($doc_id)], 36000) . '">Preview and Approve Document</a>';
// $url = '<a href="' . $documentUrl . '">Preview and Approve Document</a>';
$businessData = $this->BranchModel->select('branches.* , business.business_name ')
@ -863,17 +863,14 @@ class MasterController extends BaseController
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
// print_r($clientData);die;
if($clientData->whatsapp == 1){
$whatsApp_message = "Dear " . $clientData->name . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ;
$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
// return $this->respond(['success' => true, 'otp' => $otp]);
}
if($clientData->sms == 1){
$notificationHelper->sendSms($number, $clientData->name . "," . $businessData->business_name, '', $url, 'change_doc_status','');
}
$statusData['client_docs_id'] = $doc_id;
@ -937,9 +934,7 @@ class MasterController extends BaseController
$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
}
if($clientData->sms == 1){
$notificationHelper->sendSms($number, $clientData->name . "," . $businessData->business_name, '', $url, 'rememeber_message', '');
}
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
} catch (\Exception $exception) {
@ -969,7 +964,7 @@ class MasterController extends BaseController
->join('client', 'client.client_id = client_branch.client_id', 'left')
->where('client_docs.id', $id)
->first();
print_r($clint_full_data);die;
$update = $this->ClientDocsModel->update($id, $data);

View File

@ -51,9 +51,11 @@ class TestController extends Controller
{
$apiKey = 'HgvlULWCIrs'; // Your API key
$mobileNumbers = '919894638731'; // Recipient mobile numbers
$DLTTemplateID = '1105171896608602869'; // DLT Template ID
$senderId = 'LDRAJ'; // Sender ID
$message = 'Dear Gowtham, 986532 is OTP to approve Service group for service name purposes.';
$DLTTemplateID = '1107171922342349877'; // DLT Template ID
$senderId = 'LDRCHN'; // Sender ID
$message = 'Dear {#var#},
{#var#} is OTP to approve {#var#} {#var#} for {#var#} purposes. -L D RAJ AND CO';
$serviceName = 'TEMPLATE_BASED'; // Service name
// URL encode the message

View File

@ -81,23 +81,17 @@ class NotificationHelper
return true;
}
public function sendSms($number, $name= '', $otp='', $url ='', $message_type_name, $clint_full_data='')
public function sendSms($number, $name= '', $otp='', $url ='', $message_type_name, $client_full_data='')
{
$apiKey = getenv('API_KEY'); // Your API key
// $mobileNumbers = '919894638731'; // Recipient mobile numbers
$mobileNumbers = $number; // Recipient mobile numbers
$DLTTemplateID = getenv('DLT_Template_ID'); // DLT Template ID
$senderId = getenv('SENDER_ID'); // Sender ID
if($message_type_name == 'login_otp'){
$message = 'Login OTP is: ' . $otp;
}else if($message_type_name == 'change_doc_status'){
$message = "Dear " . $name . " has requested your approval for a document. Please click the link below to preview and approve." ;
}else if($message_type_name == 'rememeber_message'){
$message = "Dear " . $name . " has requested your approval for a document. Please click the link below to preview and approve. \n\nClick here - " . $url; ;
}else if($message_type_name == 'doc_verify'){
$message = 'Dear'. $name .',' . $otp . 'is OTP to approve '. $clint_full_data['group_name'] .' for '. $clint_full_data['service_name'] .' purposes.';
$apiKey = getenv('API_KEY');
$mobileNumbers = $number;
$DLTTemplateID = getenv('DLT_Template_ID');
$senderId = getenv('SENDER_ID');
if($message_type_name == 'doc_verify')
{
$message = 'Dear '. $name .',
'. $otp .' is OTP to approve '. $client_full_data['group_name'] .' for '. $client_full_data['service_name'] .' purposes. -L D RAJ AND CO';
}
$serviceName = getenv('SERVICE_NAME'); // Service name
// URL encode the message