1 parent 660993a commit 4c673caCopy full SHA for 4c673ca
1 file changed
src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts
@@ -1742,10 +1742,13 @@ export class ChatwootService {
1742
);
1743
1744
try {
1745
- // Usa o mesmo método do manager (fecha WebSocket + end)
1746
- if (waInstance?.client) {
1747
- waInstance.client.ws?.close();
1748
- waInstance.client.end(new Error('restart'));
+ // Usa o mesmo método do endpoint /instance/restart
+ if (typeof waInstance.restart === 'function') {
+ await waInstance.restart();
+ } else {
1749
+ // Fallback para Baileys
1750
+ waInstance.client?.ws?.close();
1751
+ waInstance.client?.end(new Error('restart'));
1752
}
1753
1754
await new Promise(resolve => setTimeout(resolve, 2000)); // Aguarda 2s
0 commit comments