Adds an integration mode setting to the Slack integration. In the new alerts_only mode, conversations continue to sync to the connected Slack channel, but messages sent in Slack threads are never delivered to the customer, so teams can use the channel for alerts and internal discussion. Existing hooks are backfilled to two_way, keeping current behavior unchanged. Also fixes channel selection replacing hook settings wholesale, which would have wiped the stored integration mode.
51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
/* global axios */
|
|
|
|
import ApiClient from './ApiClient';
|
|
|
|
class IntegrationsAPI extends ApiClient {
|
|
constructor() {
|
|
super('integrations/apps', { accountScoped: true });
|
|
}
|
|
|
|
connectSlack(code) {
|
|
return axios.post(`${this.baseUrl()}/integrations/slack`, { code });
|
|
}
|
|
|
|
updateSlack({ referenceId }) {
|
|
return axios.patch(`${this.baseUrl()}/integrations/slack`, {
|
|
reference_id: referenceId,
|
|
});
|
|
}
|
|
|
|
listAllSlackChannels() {
|
|
return axios.get(`${this.baseUrl()}/integrations/slack/list_all_channels`);
|
|
}
|
|
|
|
delete(integrationId) {
|
|
return axios.delete(`${this.baseUrl()}/integrations/${integrationId}`);
|
|
}
|
|
|
|
createHook(hookData) {
|
|
return axios.post(`${this.baseUrl()}/integrations/hooks`, hookData);
|
|
}
|
|
|
|
updateHook(hookId, hookData) {
|
|
return axios.patch(
|
|
`${this.baseUrl()}/integrations/hooks/${hookId}`,
|
|
hookData
|
|
);
|
|
}
|
|
|
|
deleteHook(hookId) {
|
|
return axios.delete(`${this.baseUrl()}/integrations/hooks/${hookId}`);
|
|
}
|
|
|
|
connectShopify({ shopDomain }) {
|
|
return axios.post(`${this.baseUrl()}/integrations/shopify/auth`, {
|
|
shop_domain: shopDomain,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default new IntegrationsAPI();
|