Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture phone number in dialogflow session id #74

Open
srijan14 opened this issue Oct 1, 2020 · 2 comments
Open

Capture phone number in dialogflow session id #74

srijan14 opened this issue Oct 1, 2020 · 2 comments

Comments

@srijan14
Copy link

srijan14 commented Oct 1, 2020

Is it possible to set the custom dialogflow session id (so that it captures the phone number of the user ) when starting the dialogflow connection ?

@srijan14 srijan14 changed the title Set dialogflow session id Capture phone number in dialogflow session id Oct 1, 2020
@hazemshokry
Copy link

@srijan14 that is interesting. Were you able to figure out a good solution handling this?

@srijan14 srijan14 reopened this Nov 25, 2020
@RaheelAshraf
Copy link

You can get the caller id by Adding this code in the server.js file

First, change the request format into JSON by adding these two lines

app.use(express.urlencoded({ extended: true }));
app.use(express.json()) // To parse the incoming requests with JSON payloads

Then get the number from your post route like this

app.post("/twiml", (request, response) => {
const phoneNumber = request.body.From;
response.setHeader("Content-Type", "application/xml");
// ngrok sets x-original-host header
const host = request.headers['x-original-host'] || request.hostname;
response.render("twiml", { host, layout: false });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants