mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
Set chatwoot custom inbox name
This commit is contained in:
parent
e071f56767
commit
3bf975d90f
@ -65,6 +65,7 @@ export class InstanceController {
|
|||||||
chatwoot_reopen_conversation,
|
chatwoot_reopen_conversation,
|
||||||
chatwoot_conversation_pending,
|
chatwoot_conversation_pending,
|
||||||
chatwoot_import_contacts,
|
chatwoot_import_contacts,
|
||||||
|
chatwoot_name_inbox,
|
||||||
chatwoot_import_messages,
|
chatwoot_import_messages,
|
||||||
chatwoot_days_limit_import_messages,
|
chatwoot_days_limit_import_messages,
|
||||||
reject_call,
|
reject_call,
|
||||||
@ -513,7 +514,7 @@ export class InstanceController {
|
|||||||
token: chatwoot_token,
|
token: chatwoot_token,
|
||||||
url: chatwoot_url,
|
url: chatwoot_url,
|
||||||
sign_msg: chatwoot_sign_msg || false,
|
sign_msg: chatwoot_sign_msg || false,
|
||||||
name_inbox: instance.instanceName.split('-cwId-')[0],
|
name_inbox: chatwoot_name_inbox ?? instance.instanceName.split('-cwId-')[0],
|
||||||
number,
|
number,
|
||||||
reopen_conversation: chatwoot_reopen_conversation || false,
|
reopen_conversation: chatwoot_reopen_conversation || false,
|
||||||
conversation_pending: chatwoot_conversation_pending || false,
|
conversation_pending: chatwoot_conversation_pending || false,
|
||||||
@ -577,7 +578,7 @@ export class InstanceController {
|
|||||||
import_messages: chatwoot_import_messages ?? true,
|
import_messages: chatwoot_import_messages ?? true,
|
||||||
days_limit_import_messages: chatwoot_days_limit_import_messages || 60,
|
days_limit_import_messages: chatwoot_days_limit_import_messages || 60,
|
||||||
number,
|
number,
|
||||||
name_inbox: instance.instanceName,
|
name_inbox: chatwoot_name_inbox ?? instance.instanceName,
|
||||||
webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -30,6 +30,7 @@ export class InstanceDto {
|
|||||||
chatwoot_import_contacts?: boolean;
|
chatwoot_import_contacts?: boolean;
|
||||||
chatwoot_import_messages?: boolean;
|
chatwoot_import_messages?: boolean;
|
||||||
chatwoot_days_limit_import_messages?: number;
|
chatwoot_days_limit_import_messages?: number;
|
||||||
|
chatwoot_name_inbox?: string;
|
||||||
websocket_enabled?: boolean;
|
websocket_enabled?: boolean;
|
||||||
websocket_events?: string[];
|
websocket_events?: string[];
|
||||||
rabbitmq_enabled?: boolean;
|
rabbitmq_enabled?: boolean;
|
||||||
|
@ -55,9 +55,12 @@ export class ChatwootController {
|
|||||||
data.import_messages = false;
|
data.import_messages = false;
|
||||||
data.days_limit_import_messages = 0;
|
data.days_limit_import_messages = 0;
|
||||||
data.auto_create = false;
|
data.auto_create = false;
|
||||||
|
data.name_inbox = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
data.name_inbox = instance.instanceName;
|
if (!data.name_inbox || data.name_inbox === '') {
|
||||||
|
data.name_inbox = instance.instanceName;
|
||||||
|
}
|
||||||
|
|
||||||
const result = await this.chatwootService.create(instance, data);
|
const result = await this.chatwootService.create(instance, data);
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ export class ChatwootService {
|
|||||||
with_credentials: true,
|
with_credentials: true,
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
token: this.provider.token,
|
token: this.provider.token,
|
||||||
|
name_inbox: this.provider.name_inbox,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ export class ChatwootService {
|
|||||||
|
|
||||||
await this.initInstanceChatwoot(
|
await this.initInstanceChatwoot(
|
||||||
instance,
|
instance,
|
||||||
instance.instanceName.split('-cwId-')[0],
|
data.name_inbox ?? instance.instanceName.split('-cwId-')[0],
|
||||||
`${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
`${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
||||||
true,
|
true,
|
||||||
data.number,
|
data.number,
|
||||||
@ -710,7 +711,7 @@ export class ChatwootService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.logger.verbose('find inbox by name');
|
this.logger.verbose('find inbox by name');
|
||||||
const findByName = inbox.payload.find((inbox) => inbox.name === instance.instanceName.split('-cwId-')[0]);
|
const findByName = inbox.payload.find((inbox) => inbox.name === this.getClientCwConfig().name_inbox);
|
||||||
|
|
||||||
if (!findByName) {
|
if (!findByName) {
|
||||||
this.logger.warn('inbox not found');
|
this.logger.warn('inbox not found');
|
||||||
|
@ -30,6 +30,7 @@ export const chatwootSchema: JSONSchema7 = {
|
|||||||
url: { type: 'string' },
|
url: { type: 'string' },
|
||||||
sign_msg: { type: 'boolean', enum: [true, false] },
|
sign_msg: { type: 'boolean', enum: [true, false] },
|
||||||
sign_delimiter: { type: ['string', 'null'] },
|
sign_delimiter: { type: ['string', 'null'] },
|
||||||
|
name_inbox: { type: ['string', 'null'] },
|
||||||
reopen_conversation: { type: 'boolean', enum: [true, false] },
|
reopen_conversation: { type: 'boolean', enum: [true, false] },
|
||||||
conversation_pending: { type: 'boolean', enum: [true, false] },
|
conversation_pending: { type: 'boolean', enum: [true, false] },
|
||||||
auto_create: { type: 'boolean', enum: [true, false] },
|
auto_create: { type: 'boolean', enum: [true, false] },
|
||||||
|
Loading…
Reference in New Issue
Block a user