mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
feat: Add campaigns in web widget (#2227)
* add campaign store(getter, actions and mutations) * add campaign store module * add get campaigns api * add fetch campaign action widget load * add specs * code cleanup * trigger campaig api fixes * integrate campaign trigger action * code cleanup * revert changes * trigger api fixes * review fixes * code beautification * chore: Fix multiple campaigns being send because of race condition * chore: rubocop * chore: Fix specs * disable campaigns Co-authored-by: Nithin David Thomas <webofnithin@gmail.com> Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -64,6 +64,24 @@ const getAvailableAgents = token => ({
|
||||
website_token: token,
|
||||
},
|
||||
});
|
||||
const getCampaigns = token => ({
|
||||
url: '/api/v1/widget/campaigns',
|
||||
params: {
|
||||
website_token: token,
|
||||
},
|
||||
});
|
||||
const triggerCampaign = (token, campaignId) => ({
|
||||
url: '/api/v1/widget/events',
|
||||
data: {
|
||||
name: 'campaign.triggered',
|
||||
event_info: {
|
||||
campaign_id: campaignId,
|
||||
},
|
||||
},
|
||||
params: {
|
||||
website_token: token,
|
||||
},
|
||||
});
|
||||
|
||||
export default {
|
||||
createConversation,
|
||||
@@ -72,4 +90,6 @@ export default {
|
||||
getConversation,
|
||||
updateMessage,
|
||||
getAvailableAgents,
|
||||
getCampaigns,
|
||||
triggerCampaign,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user