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());
}
Aggregations