Chatwoot/app/javascript/widget/api/campaign.js
Muhsin Keloth fb2f3ff89f
feat: Create campaign conversation only if user interacts with the bubble (#2335)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-06-15 20:09:42 +05:30

22 lines
581 B
JavaScript

import endPoints from 'widget/api/endPoints';
import { API } from 'widget/helpers/axios';
const getCampaigns = async websiteToken => {
const urlData = endPoints.getCampaigns(websiteToken);
const result = await API.get(urlData.url, { params: urlData.params });
return result;
};
const triggerCampaign = async ({ campaignId, websiteToken }) => {
const urlData = endPoints.triggerCampaign({ websiteToken, campaignId });
await API.post(
urlData.url,
{ ...urlData.data },
{
params: urlData.params,
}
);
};
export { getCampaigns, triggerCampaign };