Repository navigation
CHI-4039: Voice post surveys record each answer, Lex idle TTL to 15 min (4/5) - #4858
Merged
Merged
Conversation
This was referenced Nov 11, 2026
gpaoloni
requested review from
stephenhand
and
a balanced review from Copilot
November 13, 2026 20:49
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
AS development routing prevents creation of the new survey control tasks and blocks answer recording, while non-cumulative payloads can permanently lose earlier answers after failed writes.
2 open issues
What changed in this PR
This fourth PR in CHI-4039 configures voice surveys to save answers incrementally using the preceding Lambda changes, preserving responses when callers leave early.
Changes:
- Replace end-only saves with per-answer recording in USNC and CA voice flows.
- Enable survey control-task creation for selected environments and update deployment guidance.
- Set all 12 Lex post-survey idle timeouts to 15 minutes.
| File | Description |
|---|---|
twilio-iac/helplines/usnm/configs/lex_v2/es/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/usnm/configs/lex_v2/en/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/usnc/templates/studio-flows/post-call-survey.tftpl |
Record each answer and signal survey completion. |
twilio-iac/helplines/usnc/configs/service-configuration/staging.json |
Enable survey control-task creation. |
twilio-iac/helplines/usnc/configs/service-configuration/production.json |
Enable survey control-task creation. |
twilio-iac/helplines/usnc/configs/lex_v2/en_USNC/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/usch/configs/lex_v2/en_USCH/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/usch/configs/lex_v2/ch/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/usch/configs/lex_v2/cf/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/ukmh/configs/lex_v2/en_GB/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/nzba/configs/lex_v2/en_NZBA/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/configs/lex_v2/en/bots/post_survey.json |
Update the shared bot's idle timeout. |
twilio-iac/helplines/clhs/configs/lex_v2/es_CLHS/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/cl/configs/lex_v2/es_CL/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/helplines/ca/templates/studio-flows/khp-english-post-call-survey.tftpl |
Record accepted answers and complete normal or early exits. |
twilio-iac/helplines/ca/configs/service-configuration/staging.json |
Enable survey control-task creation. |
twilio-iac/helplines/as/configs/service-configuration/development.json |
Enable control tasks; disable Lambda conference ending. |
twilio-iac/helplines/as/configs/lex_v2/en_US/bots/post_survey.json |
Set idle timeout to 900 seconds. |
twilio-iac/AGENTS.md |
Document per-answer recording and deployment prerequisites. |
Review effort: Balanced
| "enforceZeroTranscriptRetention": false, | ||
| "postStudioFlows": { | ||
| "WQb4a3a7e8808c61d11d344e5b28fa53ef": { | ||
| "createSurveyControlTask": true, |
| "method": "POST", | ||
| "content_type": "application/json;charset=utf-8", | ||
| "add_twilio_auth": false, | ||
| "body": "{\n \"controlTaskSid\": \"{{trigger.call.controlTaskSid}}\",\n \"answers\": {\n \"beginning_interaction\": \"{{flow.variables.beginning_interaction}}\"\n },\n \"surveyComplete\": false\n}", |
gpaoloni
force-pushed
the
gian_CHI-4039-voice-flows
branch
from
November 17, 2026 15:25
d3eb8b4 to
13ff41f
Compare
gpaoloni
force-pushed
the
gian_CHI-4039-voice-flows
branch
from
November 18, 2026 16:37
13ff41f to
e739df4
Compare
gpaoloni
force-pushed
the
gian_CHI-4039-voice-flows
branch
from
November 18, 2026 19:20
e739df4 to
0601ca0
Compare
gpaoloni
force-pushed
the
gian_CHI-4039-voice-flows
branch
from
November 18, 2026 19:44
0601ca0 to
16723ba
Compare
stephenhand
approved these changes
Nov 19, 2026
Matches the 15 minute lifetime of the post survey control task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the final hrm/savePostSurvey call with a postSurvey/recordAnswers call after each question, so answers survive a hang up mid-survey. The last question also sends surveyComplete. Failures continue to the next question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iven Replace the final hrm/savePostSurvey call with a postSurvey/recordAnswers call after each valid answer, keeping the same question keys. The last question, and the paths that used to save after repeated invalid answers, send surveyComplete. Failures continue the survey; the closing message is the thank-you message, since earlier answers are already recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…recording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
USNC and KHP English post-call survey flows call postSurvey/createControlTask as their first widget and pass its controlTaskSid to every recordAnswers call, instead of relying on the post studio flow listener to create the task behind the createSurveyControlTask service configuration flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontrol task Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gpaoloni
force-pushed
the
gian_CHI-4039-voice-flows
branch
from
November 19, 2026 15:37
16723ba to
0216dbd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Stacked PRs for CHI-4039 (save partial post-survey answers). Review and merge in order:
Configuration for partial post-survey saving on voice IVR surveys, plus the Lex session TTL change. No application code.
f_createControlTask(postSurvey/createControlTask, sending the contact's{{trigger.call.taskLanguage}}so it's stored on the control task) runs right after the trigger, before any prompt, and every later call reads{{widgets.f_createControlTask.parsed.controlTaskSid}}. Bothsuccessandfailedcontinue to the survey: if the task can't be created the caller still hears the survey, but the answers aren't recorded. In USNC this runs before the opt-in question, so a caller who opts out leaves an empty control task that saves nothing and expires after 15 minutes.postSurvey/recordAnswerswidgets (f_recordAnswers_*), instead of onehrm/savePostSurveycall at the end. The last call sendssurveyComplete: true. Bothsuccessandfailedcontinue the survey, so a failure never cuts it short.usnc/templates/studio-flows/post-call-survey.tftpl): one widget after each answer (including the "unrecognized or no input" values it already recorded). Same question keys as before.ca/templates/studio-flows/khp-english-post-call-survey.tftpl): each valid answer is recorded right after its split. Samee_*_Main_v1keys as on master. The "too many invalid answers" paths that used to jump to the save now sendsurveyComplete: trueand play the thank-you message. Only valid answers are recorded now (before, the end save also sent invalid digits).post_surveybots:idle_session_ttl_in_seconds→ 900 in all 12 bot configs, matching the new 15-minute control task, so a helpseeker who pauses isn't asked the questions again.twilio-iac/AGENTS.mdpost-survey checklist updated for the new mechanism.No service configuration change is needed: applying the new flows is what switches the behaviour.
asdevelopment: its post-call survey Studio flow isn't managed in this repo, so it has to be updated in the Twilio console the same way (f_createControlTaskfirst, thenf_recordAnswers_*widgets).Checklist
Other Related Issues
Existing CA flow issues found while editing, not fixed here:
retry_counter_Nchecksflow.variables.retry_counter, which doesn't exist, so the counter is always 1 and the "repeated invalid answers" exits are never reached.less_thancondition comes beforeequal_to 0, so pressing 0 ("hear the options again") is probably taken as an answer.split_2uses*instead of0to repeat.USNC: the
split_end_interaction_responseconditions'argumentsreferencegather_input_voice_beginning_interaction.Digitswhile the split'sinputis the end_interaction digits. Probably cosmetic (Studio evaluatesinput), not changed here.Verification steps
Both edited flows were validated: interpolations stubbed and parsed as JSON, every widget
bodyparses, allnexttargets exist, no unreachable widgets. All edited JSON parses.Per environment, after applying (see order below): make a test call, answer only some questions and hang up, then check the answers in HRM and on the control task, and in Datadog that
f_createControlTaskand thef_recordAnswers_*widgets returned success.AFTER YOU MERGE
Apply order, per environment (USNC staging, USNC production, CA staging, AS development):
PATCH postSurveys/{taskId}deployed.configureapply (the Studio flows). Don't apply it before step 1: the new flows callpostSurvey/createControlTaskandpostSurvey/recordAnswers.lexapply for every helpline with apost_surveybot (as, cl, clhs, nzba, ukmh, usch, usnc, usnm, and helplines using the sharedconfigs/lex_v2/en). Independent of 1–2.🤖 Generated with Claude Code