NAME

Twilio::TwiML::MessagingResponse - The Response element of TwiML

SYNOPSIS

use Twilio::TwiML::MessagingResponse;

my $response = Twilio::TwiML::MessagingResponse->new;
$response->message('The Robots are coming! Head for the hills!');

# With a picture
my $message = $response->message;
$message->body('Here is a picture.');
$message->media('https://demo.twilio.com/owl.png');

print "Content-Type: text/xml\n\n", $response;

DESCRIPTION

The root of the TwiML that tells Twilio how to answer a message. Return it from the webhook of a phone number. See Twilio::Manual for a whole webhook.

See Twilio::TwiML::TwiML for the methods every element has.

METHODS

new

my $element = Twilio::TwiML::MessagingResponse->new();

message

my $child = $element->message($body, \%attributes);

Add Message child. Returns a Twilio::TwiML::Messaging::Message.

redirect

my $child = $element->redirect($url, \%attributes);

Add Redirect child. Returns a Twilio::TwiML::Messaging::Redirect.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.