From d2bf2f8f5aaaa656576d99161096ba1e3a243d4c Mon Sep 17 00:00:00 2001 From: Dineshkumar Date: Thu, 7 Jul 2022 16:41:50 +0530 Subject: [PATCH] Added Msg91 Adaptor Using Flow --- src/Appwrite/Auth/Phone/Msg91Flow.php | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/Appwrite/Auth/Phone/Msg91Flow.php diff --git a/src/Appwrite/Auth/Phone/Msg91Flow.php b/src/Appwrite/Auth/Phone/Msg91Flow.php new file mode 100644 index 0000000000..2ada52c406 --- /dev/null +++ b/src/Appwrite/Auth/Phone/Msg91Flow.php @@ -0,0 +1,46 @@ + utilized from for flow id + * @param string $to + * @param string $message + * @return void + */ + public function send(string $from, string $to, string $message): void + { + $to = ltrim($to, '+'); + $this->request( + method: 'POST', + url: $this->endpoint . '/messages', + payload: \http_build_query([ + 'sender' => $this->user, + 'otp' => $message, + 'flow_id' => $from, + 'mobiles' => $to + ]), + headers: [ + "content-type: application/JSON", + "authkey: {$this->secret}", + ] + ); + } +}