mirror of
https://github.com/lingble/chatwoot.git
synced 2025-12-15 18:27:14 +00:00
feat: Add voice channel support for Chatwoot
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user