Skip to content

chore: bypass post survey handler if enabled in Lambda [CHI-3218] #757

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

Merged
merged 3 commits into from
May 5, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion functions/taskrouterListeners/postSurveyListener.private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const isTriggerPostSurvey = (
* Checks the event type to determine if the listener should handle the event or not.
* If it returns true, the taskrouter will invoke this listener.
*/
export const shouldHandle = (event: EventFields) => eventTypes.includes(event.EventType);
export const shouldHandle = () => false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this not mean this code will never run, whether the flag is enabled or not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, thanks for the catch, just reverted that.

// export const shouldHandle = (event: EventFields) => eventTypes.includes(event.EventType);

export const handleEvent = async (context: Context<EnvVars>, event: EventFields) => {
const {
Expand All @@ -99,6 +100,13 @@ export const handleEvent = async (context: Context<EnvVars>, event: EventFields)
const serviceConfig = await client.flexApi.configuration.get().fetch();
const { feature_flags: featureFlags, helplineLanguage } = serviceConfig.attributes;

if (featureFlags.enable_lambda_post_survey_processing) {
console.debug(
'enable_lambda_post_survey_processing is set, the post survey handler will be process in twilio lambda.',
);
return;
}

if (featureFlags.enable_post_survey) {
const { channelSid, conversationSid, channelType, customChannelType } = taskAttributes;

Expand Down
Loading