Skip to content

Commit

Permalink
feat: handle empty contact attributes (#32)
Browse files Browse the repository at this point in the history
* feat: handle empty contact attributes

* fix: condition

* feat: add nullish check for conversationCustomAttributes
  • Loading branch information
scmmishra committed May 9, 2024
1 parent c90ccb4 commit c4aec66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/canned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ export const getMessageVariables = ({
'agent.email': assignee?.email ?? '',
};
const conversationCustomAttributeVariables = Object.entries(
conversationCustomAttributes as CustomAttributes
conversationCustomAttributes ?? {}
).reduce((acc: CustomAttributes, [key, value]) => {
acc[`conversation.custom_attribute.${key}`] = value;
return acc;
}, {});

const contactCustomAttributeVariables = Object.entries(
contactCustomAttributes as CustomAttributes
contactCustomAttributes ?? {}
).reduce((acc: CustomAttributes, [key, value]) => {
acc[`contact.custom_attribute.${key}`] = value;
return acc;
Expand Down

0 comments on commit c4aec66

Please sign in to comment.