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

Update Support for 'facebook' and 'messenger' #712

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Changes from all 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
6 changes: 6 additions & 0 deletions functions/getProfileFlagsForIdentifier.protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ const channelTransformations: { [k: string]: TransformIdentifierFunction[] } = {
whatsapp: [(s) => s.replace('whatsapp:', ''), phoneNumberStandardization],
modica: [(s) => s.replace('modica:', ''), phoneNumberStandardization],
facebook: [(s) => s.replace('messenger:', '')],
messenger: [(s) => s.replace('messenger:', '')],
Comment on lines 97 to +98
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would we need a migration to align facebook to messenger, or we plan to have both in the DB?

Copy link
Collaborator Author

@mythilytm mythilytm Oct 24, 2024

Choose a reason for hiding this comment

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

Refer slack for rest of conversation

  • We will migrate once programmable chat is deprecated in our codebase. For now, we will have both.

instagram: [],
line: [],
telegram: [],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

telegram was missing

web: [],
};

Expand All @@ -119,6 +121,10 @@ export const getIdentifier = (trigger: Event['trigger'], channelType?: string):
}

if (isConversationTrigger(trigger) && channelType) {
if (!channelTransformations[channelType] || !channelType) {
console.error(`Channel type ${channelType} is not supported`);
throw new Error(`Channel type ${channelType} is not supported`);
}
return channelTransformations[channelType].reduce(
(accum, f) => f(accum),
trigger.conversation.Author,
Expand Down