feat: Add voice channel support for Chatwoot

This commit is contained in:
Sojan
2025-04-27 00:48:05 -07:00
parent ef6949e32d
commit 8d660df4c4
24 changed files with 559 additions and 18 deletions

View File

@@ -207,6 +207,33 @@ export const actions = {
throw error;
}
},
createVoiceChannel: async ({ commit }, params) => {
try {
commit(types.default.SET_INBOXES_UI_FLAG, { isCreating: true });
// Create a formatted payload for the voice channel
const inboxParams = {
name: params.voice.name || `Voice (${params.voice.phone_number})`,
channel: {
type: 'Channel::Voice',
phone_number: params.voice.phone_number,
provider: params.voice.provider,
provider_config: params.voice.provider_config,
},
};
// Use InboxesAPI to create the channel which handles authentication properly
const response = await InboxesAPI.create(inboxParams);
commit(types.default.ADD_INBOXES, response.data);
commit(types.default.SET_INBOXES_UI_FLAG, { isCreating: false });
sendAnalyticsEvent('voice');
return response.data;
} catch (error) {
commit(types.default.SET_INBOXES_UI_FLAG, { isCreating: false });
throw error;
}
},
createFBChannel: async ({ commit }, params) => {
try {
commit(types.default.SET_INBOXES_UI_FLAG, { isCreating: true });