mounika I am integrated this on Foodomaa dynamically admin can change the API key or enable disable WhatsApp notification option from settings
that's why my WhatsApp notification send function also like this-
public function whatsapptoadmin($order_id,$price,$restaurent,$user_ph){
$msgMessage = "*New Order Arrived!*
*Restaurant Name* -". $restaurent."
*Customer No* - ". $user_ph."
*Order ID* - #". $order_id."
*Order Price* -". config('appSettings.currencyFormat') .$price;
if(config('appSettings.whatsapp_notify') == 'true'){
$message= urlencode($msgMessage);
$phone= config('appSettings.whatsapp_phone');
$apikey= config('appSettings.whatsapp_apikey');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callmebot.com/whatsapp.php?phone='.$phone.'&text='.$message.'&apikey='.$apikey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
//var_export($response);
curl_close ($ch);
}
}
I hope you all like this. if we need it for all store WhatsApp notifications. we can easily do this using these functions
Final Output when user order
admin got WhatsApp notification like this-