A simple resource to serve twiml files for your twilio needs
-
Download and install maven
-
clone or download this repository git clone https://github.com/anujra/starter-java.git
-
Build cd starter-java mvn clean install
-
Add account information to server/starter-java.yml Edit following fields # twilio configuration twilioConfiguration:
# account sid accountSid: AC............................ # authtoken here authToken: ..............................
-
Run java -jar server/target/server-0.0.1-SNAPSHOT.jar server server/starter-java.yml
-
Send a text message
- Curl your test/send resource to send a text message.
- This will send a text message to 4155556666 form one of your twilio phone number(s)
- $> curl -X POST http://localhost:8060/test/send -d "To=4155556666" -d "Body=Ahoy Twilio"
-
To serve Twiml
- install ngrok (https://ngrok.com/)
- $> ngrok 8060
- ngrok will provide you with a public Url. eg https://3bbc88b5.ngrok.com
- Set this as the callback url for your SMS
- Send an SMS to your twilio number
###Method: POST ###uri: http://localhost:18060/sms
###POST Parameters: SmsSid AccountSid SmsMessageSid To From Body ApiVersion SmsStatus FromZip FromCity FromState FromCountry ToZip ToCity ToState ToCountry
##Return applicaton/xml Twiml
##Resource for SdkTestResource ###Method: POST ###uri: http://localhost:18060/test/send
###POST Parameters: To - number to send a text message Body - Body of message
##Return Response Status of txt message
##SynchronousResource Somthing to build on ###Method: POST ###uri: http://localhost:18060/synchronous