In this first example, when a call is directed to this example XML document, the caller will hear “Go Green, Go Plivo” spoken once.
Response
<Response><Speak>Go Green, Go Plivo.</Speak></Response>
Example Request
1
2
3
4
5
fromplivoimportplivoxmlresponse=(plivoxml.ResponseElement().add(plivoxml.SpeakElement('Go Green, Go Plivo.')))print(response.to_string())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require'rubygems'require'plivo'includePlivo::XMLincludePlivo::Exceptionsbeginresponse=Response.newspeak_body='Go Green, Go Plivo.'response.addSpeak(speak_body)xml=PlivoXML.new(response)putsxml.to_xmlrescuePlivoXMLError=>eputs'Exception: '+e.messageend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
varplivo=require('plivo');varresponse=plivo.Response();varspeak_body="Go Green, Go Plivo.";response.addSpeak(speak_body);console.log(response.toXML());/*
Sample Output
<Response>
<Speak>Go Green, Go Plivo.</Speak>
</Response>
*/
<?phprequire'../vendor/autoload.php';usePlivo\XML\Response;$response=newResponse();$speak_body="Go Green, Go Plivo.";$response->addSpeak($speak_body);Header('Content-type: text/xml');echo($response->toXML());/*
Sample Output
<Response>
<Speak>Go Green, Go Plivo.</Speak>
</Response>
*/?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example for speak - play a messagepackagecom.plivo.api.xml.samples.speak;importcom.plivo.api.exceptions.PlivoXmlException;importcom.plivo.api.xml.Response;importcom.plivo.api.xml.Speak;classPlayAMessage{publicstaticvoidmain(String[]args)throwsPlivoXmlException{Responseresponse=newResponse().children(newSpeak("Go Green, Go Plivo."));System.out.println(response.toXmlString());}}
usingSystem;usingSystem.Collections.Generic;usingPlivo.XML;namespacePlivo{classMainClass{publicstaticvoidMain(string[]args){Plivo.XML.Responseresp=newPlivo.XML.Response();resp.AddSpeak("Go green, go plivo.",newDictionary<string,string>(){});varoutput=resp.ToString();Console.WriteLine(output);}}}//<Response>// <Speak>Go green, go plivo.</Speak>//</Response>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Example for speak - play messagepackagemainimport"github.com/plivo/plivo-go/v7/xml"funcmain(){response:=xml.ResponseElement{Contents:[]interface{}{new(xml.SpeakElement).AddSpeak("Go Green, Go Plivo."),},}print(response.String())}
usingSystem;usingSystem.Collections.Generic;usingPlivo.XML;namespacePlivo{classMainClass{publicstaticvoidMain(string[]args){Plivo.XML.Responseresp=newPlivo.XML.Response();resp.AddSpeak("Go green, go plivo.",newDictionary<string,string>(){});varoutput=resp.ToString();Console.WriteLine(output);}}}//<Response>// <Speak>Go green, go plivo.</Speak>//</Response>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Example for speak - play messagepackagemainimport"github.com/plivo/plivo-go/v7/xml"funcmain(){response:=xml.ResponseElement{Contents:[]interface{}{new(xml.SpeakElement).AddSpeak("Go Green, Go Plivo."),},}print(response.String())}
Rate this page
🥳 Thank you! It means a lot to us!
×
Help Us Improve
Thank you so much for rating the page, we would like to get your input
for further improvements!