Send an SMS during a phone call. Powered by Twilio and PHP/Slim
Learn how to send an SMS to someone who's called your Twilio phone number while they're on the call.
This small sample application will say a short message to an inbound caller and, at the same time, send them an SMS.
First clone this repository and
$ git clone https://github.com/TwilioDevEd/send-sms-during-inbound-calls-php.git $ cd send-sms-during-inbound-calls-php
Install the dependencies.
$ composer install
Create an environment file (
.env) and define your Twilio Account SID and Auth Token. Both of these can be found in your Twilio console.
export ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX export AUTH_TOKEN=your_auth_token
Load the created file into your environment.
Start the server.
$ php -S localhost:8080
Expose the application to the wider Internet using ngrok.
$ ngrok http 8080 -host-header="localhost:8080"
Configure Twilio to call your webhooks
You will need to configure Twilio to call your application when calls are received in your Twilio Number. The voice url should look something like this:
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.