1 year ago
#315261
Daniel Akinola
Integrating Twilio verfiy API with Dialogflow intent to ask for mobile number for OTP
I have made a working OTP Flow with Node.js and used the Verify API from Twilio for the SMS OTP. I tested it on Postman by adding and testing request everything from getting the OTP and verifying the OTP looks good.
Now I want to integrate this functionality in Dialogflow. I'm having problems doing it, and I cant seem to find any videos or documentation to help me. For just this phone number verification with a OTP for an intent that asks for the user's number. Then verifies that number after making the necessary API calls. I would like to ask for some help because i want to use this Twilio SMS verification functionality to verify phone numbers given through a chatbot. If you can refer me to some documentation or anything at all really that would help that will be fine. Thank you
This is just some part of the Node.js code I used to do this.
const client = require("twilio")(config.accountSID, config.authToken)
app.get('/login', (req, res) => {
client
.verify
.services(config.serviceID)
.verifications
.create({
to: `+${req.query.phonenumber}`,
channel: req.query.channel,
})
.then((data) => {
res.status(200).send(data)
})
})
app.get('/verify', (req,res) => {
client
.verify
.services(config.serviceID)
.verificationChecks
.create({
to: `+${req.query.phonenumber}`,
code: req.query.code,
})
.then((data) => {
res.status(200).send(data)
})
})
node.js
twilio
dialogflow-es
0 Answers
Your Answer