Search code examples
phptwiliotwilio-php

Twilio get number of sender in twiml or webhook laravel


I have a webhook that saves the sender number once the webhook is triggered. How can I get the number of the sender that triggered the webhook?


Solution

  • I've already found the answer to my question.

    public function receivedSms(Request $request){
    
       $response = new Twiml();
    
    
          echo $request['From'],
          echo $request['Body']
    
       return response($response)
          ->header('Content-Type', 'text/xml');
    }
    

    https://www.twilio.com/blog/2016/08/receive-sms-php-twilio.html