mirror of
https://github.com/vitalityAI/therapist.git
synced 2025-04-13 08:10:17 -04:00
feat: fixed callback routes
This commit is contained in:
parent
98dbe10a8d
commit
3cf99f0fd4
19
src/call.js
19
src/call.js
|
@ -14,21 +14,7 @@ const VoiceResponse = twilio.twiml.VoiceResponse;
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
|
|
||||||
app.post("/voice", (request, response) => {
|
app.post("/receive", (req, res) => {
|
||||||
const city = request.body.FromCity;
|
|
||||||
console.log(`They're from ${city}!`);
|
|
||||||
|
|
||||||
// Use the Twilio Node.js SDK to build an XML response
|
|
||||||
const twiml = new VoiceResponse();
|
|
||||||
twiml.say({ voice: "alice" }, `Never gonna give you up ${city}.`);
|
|
||||||
twiml.play({}, "https://demo.twilio.com/docs/classic.mp3");
|
|
||||||
|
|
||||||
// Render the response as XML in reply to the webhook request
|
|
||||||
response.type("text/xml");
|
|
||||||
response.send(twiml.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post("/call", (req, res) => {
|
|
||||||
// Use the Twilio Node.js SDK to build an XML response
|
// Use the Twilio Node.js SDK to build an XML response
|
||||||
const twiml = new VoiceResponse();
|
const twiml = new VoiceResponse();
|
||||||
|
|
||||||
|
@ -50,10 +36,11 @@ app.post("/call", (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/respond", async (req, res) => {
|
app.post("/respond", async (req, res) => {
|
||||||
|
const twiml = new VoiceResponse();
|
||||||
|
|
||||||
let transcription = req.body.SpeechResult;
|
let transcription = req.body.SpeechResult;
|
||||||
console.log(transcription);
|
console.log(transcription);
|
||||||
|
|
||||||
const twiml = new VoiceResponse();
|
|
||||||
twiml.say(`You said, ${transcription}`);
|
twiml.say(`You said, ${transcription}`);
|
||||||
twiml.say(`Don't kill yourself.`);
|
twiml.say(`Don't kill yourself.`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user