Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬

822 B
Raw Blame
/* global axios */
import ApiClient from './ApiClient';

class ConversationApi extends ApiClient {
  constructor() {
    super('conversations', { accountScoped: true });
  }

  getLabels(conversationID) {
    return axios.get(`${this.url}/${conversationID}/labels`);
  }

  getCampaignHistory(conversationId, { before, signal } = {}) {
    return axios.get(`${this.url}/${conversationId}/campaign_history`, {
      params: { before },
      signal,
    });
  }

  updateLabels(conversationID, labels) {
    return axios.post(`${this.url}/${conversationID}/labels`, { labels });
  }

  getSuggestions(conversationID, type) {
    return axios.get(`${this.url}/${conversationID}/suggestions/${type}`);
  }

  getUnreadCounts() {
    return axios.get(`${this.url}/unread_counts`);
  }
}

export default new ConversationApi();