Is it possible to gather multiple values with Twilio IVR?
I have a view function that needs to gather multiple pieces of information in one call (it's a quick outbound call - the user answers and is to be immediately prompted for these data points), based on data pulled from a DB. What I'd like the view function to do is something like the following:
group_id = <get group id>
params = data_element_select_params.DataElementSelectParams(group_id=group_id)
data_elements = worker.select(params) # function I wrote which returns a list of objects, in this case objects called DataElements
vr = VoiceResponse()
say_msg = 'Enter {element}, then press star.'
for element in data_elements:
say_message = say_msg.format(element=element.name)
<Gather input with say_message and save it>
Can this be achieved without routing to the same URL over and over? I have not seen any other solution, and I'd rather not continually redirect to the same URL as we'll have to pull the list of elements from the DB again for each element.
Apologies if anything is unclear - please point it out and I'll clarify as quickly as I can.
python-3.x twilio twilio-api python-3.7 ivr
add a comment |
I have a view function that needs to gather multiple pieces of information in one call (it's a quick outbound call - the user answers and is to be immediately prompted for these data points), based on data pulled from a DB. What I'd like the view function to do is something like the following:
group_id = <get group id>
params = data_element_select_params.DataElementSelectParams(group_id=group_id)
data_elements = worker.select(params) # function I wrote which returns a list of objects, in this case objects called DataElements
vr = VoiceResponse()
say_msg = 'Enter {element}, then press star.'
for element in data_elements:
say_message = say_msg.format(element=element.name)
<Gather input with say_message and save it>
Can this be achieved without routing to the same URL over and over? I have not seen any other solution, and I'd rather not continually redirect to the same URL as we'll have to pull the list of elements from the DB again for each element.
Apologies if anything is unclear - please point it out and I'll clarify as quickly as I can.
python-3.x twilio twilio-api python-3.7 ivr
add a comment |
I have a view function that needs to gather multiple pieces of information in one call (it's a quick outbound call - the user answers and is to be immediately prompted for these data points), based on data pulled from a DB. What I'd like the view function to do is something like the following:
group_id = <get group id>
params = data_element_select_params.DataElementSelectParams(group_id=group_id)
data_elements = worker.select(params) # function I wrote which returns a list of objects, in this case objects called DataElements
vr = VoiceResponse()
say_msg = 'Enter {element}, then press star.'
for element in data_elements:
say_message = say_msg.format(element=element.name)
<Gather input with say_message and save it>
Can this be achieved without routing to the same URL over and over? I have not seen any other solution, and I'd rather not continually redirect to the same URL as we'll have to pull the list of elements from the DB again for each element.
Apologies if anything is unclear - please point it out and I'll clarify as quickly as I can.
python-3.x twilio twilio-api python-3.7 ivr
I have a view function that needs to gather multiple pieces of information in one call (it's a quick outbound call - the user answers and is to be immediately prompted for these data points), based on data pulled from a DB. What I'd like the view function to do is something like the following:
group_id = <get group id>
params = data_element_select_params.DataElementSelectParams(group_id=group_id)
data_elements = worker.select(params) # function I wrote which returns a list of objects, in this case objects called DataElements
vr = VoiceResponse()
say_msg = 'Enter {element}, then press star.'
for element in data_elements:
say_message = say_msg.format(element=element.name)
<Gather input with say_message and save it>
Can this be achieved without routing to the same URL over and over? I have not seen any other solution, and I'd rather not continually redirect to the same URL as we'll have to pull the list of elements from the DB again for each element.
Apologies if anything is unclear - please point it out and I'll clarify as quickly as I can.
python-3.x twilio twilio-api python-3.7 ivr
python-3.x twilio twilio-api python-3.7 ivr
edited Nov 1 '18 at 5:31
zbbz
asked Nov 1 '18 at 5:20
zbbzzbbz
4517
4517
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Twilio developer evangelist here.
You can only use one <Gather>
per TwiML document, so no, you can't ask multiple questions and take multiple inputs within the one webhook.
You will need to route to a URL that receives the input from each <Gather>
and then asks the next question.
To avoid pulling all the elements from the DB every time, you could investigate saving the elements to the HTTP session and pulling them back out of there. Twilio is a well behaved HTTP client, so you can use things like cookies to store information about the current call/conversation.
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53095562%2fis-it-possible-to-gather-multiple-values-with-twilio-ivr%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Twilio developer evangelist here.
You can only use one <Gather>
per TwiML document, so no, you can't ask multiple questions and take multiple inputs within the one webhook.
You will need to route to a URL that receives the input from each <Gather>
and then asks the next question.
To avoid pulling all the elements from the DB every time, you could investigate saving the elements to the HTTP session and pulling them back out of there. Twilio is a well behaved HTTP client, so you can use things like cookies to store information about the current call/conversation.
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
add a comment |
Twilio developer evangelist here.
You can only use one <Gather>
per TwiML document, so no, you can't ask multiple questions and take multiple inputs within the one webhook.
You will need to route to a URL that receives the input from each <Gather>
and then asks the next question.
To avoid pulling all the elements from the DB every time, you could investigate saving the elements to the HTTP session and pulling them back out of there. Twilio is a well behaved HTTP client, so you can use things like cookies to store information about the current call/conversation.
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
add a comment |
Twilio developer evangelist here.
You can only use one <Gather>
per TwiML document, so no, you can't ask multiple questions and take multiple inputs within the one webhook.
You will need to route to a URL that receives the input from each <Gather>
and then asks the next question.
To avoid pulling all the elements from the DB every time, you could investigate saving the elements to the HTTP session and pulling them back out of there. Twilio is a well behaved HTTP client, so you can use things like cookies to store information about the current call/conversation.
Twilio developer evangelist here.
You can only use one <Gather>
per TwiML document, so no, you can't ask multiple questions and take multiple inputs within the one webhook.
You will need to route to a URL that receives the input from each <Gather>
and then asks the next question.
To avoid pulling all the elements from the DB every time, you could investigate saving the elements to the HTTP session and pulling them back out of there. Twilio is a well behaved HTTP client, so you can use things like cookies to store information about the current call/conversation.
answered Nov 13 '18 at 6:48
philnashphilnash
37.4k93454
37.4k93454
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
add a comment |
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks Phil! I will take a look at saving the elements to the HTTP session and retrieving them from there.
– zbbz
Nov 17 '18 at 5:08
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
Thanks, Phil. Can you provide some clarity on the session management on Twilio's side? Do you consider an individual call a single session? Want to make sure that we will not get session contamination if we have multiple inbound calls from the same phone number.
– Brian P
Nov 19 '18 at 4:01
1
1
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
@BrianP I believe that each individual call is a session so there should not be session contamination. If you needed to ensure that yourself on your server, you can use the Call Sid as a key, as that is unique per call.
– philnash
Nov 19 '18 at 4:09
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53095562%2fis-it-possible-to-gather-multiple-values-with-twilio-ivr%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown