client = new ClientV3([ "deviceId" => $this->device_id, "refreshToken" => $this->refresh_token, "idToken" => $this->id_token ]); } function upload($url) { //create tmp file $fname = tempnam("/tmp", "rpt") . "-rpt.pdf"; file_put_contents($fname, file_get_contents($url)); $resp = $this->client->upload($fname); unlink($fname); return $resp; } function send_qrcode($phone, $url, $name, $date) { $urlImg = $this->upload($url); $message = [$name, $date]; $resp = $this->client->sendMessageTemplateImage($phone, $this->template, "id", $message, $urlImg); return json_decode($resp, true); } function send_otp($phone, $otp) { $resp = $this->client->sendMessageTemplateAuthentication($phone, "pramitamobileotp", "id", $otp); return json_decode($resp, true); } function send_rujukan_external_process($phone, $phone_cabang) { $message = [$phone_cabang]; $resp = $this->client->sendMessageTemplateText($phone, "rujukan01", "id", $message); return json_decode($resp, true); } function send_eform($phone, $kode_cabang, $nolab, $type = "") { $message = [$kode_cabang, $nolab]; $resp = $this->client->sendMessageTemplateText($phone, "eform_fisik", "id", $message); return json_decode($resp, true); } function send_msg_button($phone, $url) { $body = ["hello", "world", "there"]; $resp = $this->client->sendMessageTemplateButton($phone, "sample-message-button", "id", $body, $url); return json_decode($resp, true); } }