php - Add Localisation to Twilio SMS verification using Laravel
Get the solution ↓↓↓I'm Trying to add a language based in the locale language in laravel and retrieve the status code for example with the based laravel language in Twilio SMS verification, I searched a lot in Twilio Docs and Can't find anything useful at the moment, anyone knows what is the rightmethod
orclass
to achieve this?
Here is my code:
class Twilio implements SMSVerificationService
{
protected $twilio, $token, $sid, $verifySID;
public function __construct()
{
$this->token = config('sms.twilio.auth_token');
$this->sid = config('sms.twilio.account_sid');
$this->verifySID = config('sms.twilio.verify_sid');
$this->twilio = new Client($this->sid, $this->token, $this->verifySID);
}
public function send($phoneNumber, $type = "sms")
{
$this->twilio->verify->v2
->services($this->verifySID)
->verifications
->create($phoneNumber, $type);
}
public function verify($phoneNumber, $verificationCode, $errorMessage = null)
{
$verification = $this->twilio->verify->v2
->services($this->verifySID)
->verificationChecks
->create(
$verificationCode,
[
'to' => $phoneNumber,
]
);
return $verification;
}
}
Thanks in advance.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: the payload is invalid.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.