Twilio API Calls

An example of translating definition from Twilio API Explorer to an actual call in the code:

Click here to see source document

  • API Explorer
    • Programmable SMS
        • Messages
          • POSTĀ  /Accounts/[AccountSid]/MessagesĀ  Create a Message

Calling this API in PHP:

use Twilio\Rest\Client;

$sid    = some sid;
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$message = $twilio->messages
                  ->create("+some phone number", // to
                           [
                               "body" => "some message text here",
                               "from" => "+some phone number"
                           ]
                  );