chore: Add custom attributes in campaign.triggered event (#4463)

This commit is contained in:
Muhsin Keloth
2022-04-20 10:49:52 +05:30
committed by GitHub
parent 5b9c4bf7f1
commit 4f3a271355
8 changed files with 34 additions and 16 deletions

View File

@@ -7,9 +7,16 @@ const getCampaigns = async websiteToken => {
return result;
};
const triggerCampaign = async ({ campaignId, websiteToken }) => {
const urlData = endPoints.triggerCampaign({ websiteToken, campaignId });
const triggerCampaign = async ({
campaignId,
websiteToken,
customAttributes,
}) => {
const urlData = endPoints.triggerCampaign({
websiteToken,
campaignId,
customAttributes,
});
await API.post(
urlData.url,
{ ...urlData.data },
@@ -18,5 +25,4 @@ const triggerCampaign = async ({ campaignId, websiteToken }) => {
}
);
};
export { getCampaigns, triggerCampaign };

View File

@@ -78,12 +78,13 @@ const getCampaigns = token => ({
website_token: token,
},
});
const triggerCampaign = ({ websiteToken, campaignId }) => ({
const triggerCampaign = ({ websiteToken, campaignId, customAttributes }) => ({
url: '/api/v1/widget/events',
data: {
name: 'campaign.triggered',
event_info: {
campaign_id: campaignId,
custom_attributes: customAttributes,
...generateEventParams(),
},
},