Skip to content

Commit

Permalink
Merge pull request #712 from techmatters/CHI-3002-identifier-bug
Browse files Browse the repository at this point in the history
Update Support for 'facebook' and 'messenger'
  • Loading branch information
mythilytm authored Oct 25, 2024
2 parents 5af29d7 + 7ccc8a2 commit 7771cb2
Showing 1 changed file with 6 additions and 0 deletions.
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:', '')],
instagram: [],
line: [],
telegram: [],
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

0 comments on commit 7771cb2

Please sign in to comment.