Search in sources :

Example 1 with Media

use of com.twilio.twiml.messaging.Media in project api-snippets by TwilioDevEd.

the class MmsHelloMonkey method service.

// service() responds to both GET and POST requests.
// You can also use doGet() or doPost()
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
    try {
        Message sms = new Message.Builder().body(new Body("Hello, Mobile Monkey")).media(new Media("https://demo.twilio.com/owl.png")).build();
        MessagingResponse twiml = new MessagingResponse.Builder().message(sms).build();
    } catch (TwiMLException e) {
        e.printStackTrace();
    }
    response.setContentType("application/xml");
    response.getWriter().print(twiml.toXml());
}
Also used : Message(com.twilio.twiml.messaging.Message) Media(com.twilio.twiml.messaging.Media) Body(com.twilio.twiml.messaging.Body) MessagingResponse(com.twilio.twiml.MessagingResponse) TwiMLException(com.twilio.twiml.TwiMLException)

Aggregations

MessagingResponse (com.twilio.twiml.MessagingResponse)1 TwiMLException (com.twilio.twiml.TwiMLException)1 Body (com.twilio.twiml.messaging.Body)1 Media (com.twilio.twiml.messaging.Media)1 Message (com.twilio.twiml.messaging.Message)1