File: /var/www/html/sarvodayahospital/public/kiosk.sarvodayahospital.com/app/SendWhatsAppConfirmation.php
<?php
namespace App;
use Illuminate\Support\Facades\Http;
class SendWhatsAppConfirmation {
public function sendWhatsApp($mobile, $amount, $url) {
$post = collect([
"from" => (int)config('sarvodaya.whatsapp.from'),
"to" => $mobile,
"type" => "template",
"message" => [
"templateid" => (int)config('sarvodaya.whatsapp.templateid'),
"placeholders" => [(string)$amount, $url]
]
])->toArray();
$headers = ['apikey' => config('sarvodaya.whatsapp.apikey')];
$response = Http::withHeaders($headers)->post(config('sarvodaya.whatsapp.whatsapp_url'), $post);
info('WhatsApp Invoice Response');
info($response);
return $response;
}
}