import com.vobiz.api.vobizxml.ResponseElement;
import com.vobiz.api.vobizxml.GatherElement;
ResponseElement response = new ResponseElement();
GatherElement gather = response.addGather()
.attr("action", "https://yourapp.com/menu-choice")
.attr("method", "POST")
.attr("inputType", "dtmf") // camelCase attribute names map straight to VobizXML
.attr("numDigits", 1)
.attr("executionTimeout", 10); // Gather uses executionTimeout, never timeout
gather.addSpeak("Press 1 for sales, 2 for support, or 0 for an operator.");
response.addSpeak("We didn't receive your input. Goodbye.");
response.addHangup();
String xml = response.toString(); // pretty-printed, with the XML declaration
String compact = response.toXml(false); // single line - return this from your webhook