Skip to content

Commit

Permalink
Add in valid Chatfuel tag
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcL committed Mar 8, 2020
1 parent 8b65346 commit bb97d57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/validateFacebookTags.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags

const validChatfuelTags = [
'UPDATE',
];

const validFacebookTags = [
'CONFIRMED_EVENT_UPDATE',
'POST_PURCHASE_UPDATE',
'ACCOUNT_UPDATE',
'HUMAN_AGENT',
];

const validateFacebookTags = (tag) => validFacebookTags.includes(tag);
const allValidTags = [...validFacebookTags, ...validChatfuelTags];

const validateFacebookTags = (tag) => allValidTags.includes(tag);

export default validateFacebookTags;
3 changes: 2 additions & 1 deletion test/unit/validateFacebookTags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ describe('Validate Facebook tags', () => {
});

it('should be false if valid tag has incorrect case', () => {
expect(validateFacebookTags('business_productivity')).to.be.false;
expect(validateFacebookTags('update')).to.be.false;
});

[
'UPDATE',
'CONFIRMED_EVENT_UPDATE',
'POST_PURCHASE_UPDATE',
'ACCOUNT_UPDATE',
Expand Down

0 comments on commit bb97d57

Please sign in to comment.