mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 18:08:40 -06:00
Merge pull request #293 from gabrielpastori1/chatwoot-format
Chatwoot format
This commit is contained in:
commit
038cd6f149
21
CHANGELOG.md
21
CHANGELOG.md
@ -11,6 +11,7 @@
|
|||||||
* Added the sign_delimiter property to the Chatwoot configuration, allowing you to set a different delimiter for the signature. Default when not defined \n
|
* Added the sign_delimiter property to the Chatwoot configuration, allowing you to set a different delimiter for the signature. Default when not defined \n
|
||||||
* Include instance Id field in the instance configuration
|
* Include instance Id field in the instance configuration
|
||||||
|
|
||||||
|
|
||||||
# 1.6.0 (2023-12-12 17:24)
|
# 1.6.0 (2023-12-12 17:24)
|
||||||
|
|
||||||
### Feature
|
### Feature
|
||||||
@ -43,8 +44,8 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v3.3.1
|
* Chatwoot: v3.3.1
|
||||||
- Typebot: v2.20.0
|
* Typebot: v2.20.0
|
||||||
|
|
||||||
# 1.5.4 (2023-10-09 20:43)
|
# 1.5.4 (2023-10-09 20:43)
|
||||||
|
|
||||||
@ -123,9 +124,9 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0 - v3.0.0
|
* Chatwoot: v2.18.0 - v3.0.0
|
||||||
- Typebot: v2.16.0
|
* Typebot: v2.16.0
|
||||||
- Manager Evolution API
|
* Manager Evolution API
|
||||||
|
|
||||||
# 1.4.8 (2023-07-27 10:27)
|
# 1.4.8 (2023-07-27 10:27)
|
||||||
|
|
||||||
@ -213,7 +214,7 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0 - v3.0.0 (Beta)
|
* Chatwoot: v2.18.0 - v3.0.0 (Beta)
|
||||||
|
|
||||||
# 1.3.2 (2023-07-21 17:19)
|
# 1.3.2 (2023-07-21 17:19)
|
||||||
|
|
||||||
@ -229,7 +230,7 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0
|
* Chatwoot: v2.18.0
|
||||||
|
|
||||||
# 1.3.1 (2023-07-20 07:48)
|
# 1.3.1 (2023-07-20 07:48)
|
||||||
|
|
||||||
@ -239,7 +240,7 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0
|
* Chatwoot: v2.18.0
|
||||||
|
|
||||||
# 1.3.0 (2023-07-19 11:33)
|
# 1.3.0 (2023-07-19 11:33)
|
||||||
|
|
||||||
@ -276,7 +277,7 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0
|
* Chatwoot: v2.18.0
|
||||||
|
|
||||||
# 1.2.2 (2023-07-15 09:36)
|
# 1.2.2 (2023-07-15 09:36)
|
||||||
|
|
||||||
@ -287,7 +288,7 @@
|
|||||||
|
|
||||||
### Integrations
|
### Integrations
|
||||||
|
|
||||||
- Chatwoot: v2.18.0
|
* Chatwoot: v2.18.0
|
||||||
|
|
||||||
# 1.2.1 (2023-07-14 19:04)
|
# 1.2.1 (2023-07-14 19:04)
|
||||||
|
|
||||||
|
@ -1019,10 +1019,12 @@ export class ChatwootService {
|
|||||||
this.logger.verbose('check if is group');
|
this.logger.verbose('check if is group');
|
||||||
const chatId =
|
const chatId =
|
||||||
body.conversation.meta.sender?.phone_number?.replace('+', '') || body.conversation.meta.sender?.identifier;
|
body.conversation.meta.sender?.phone_number?.replace('+', '') || body.conversation.meta.sender?.identifier;
|
||||||
|
// Chatwoot to Whatsapp
|
||||||
const messageReceived = body.content
|
const messageReceived = body.content
|
||||||
.replaceAll(/\*((?!\s)([^\n*]+?)(?<!\s))\*/g, '_$1_') // Substitui * por _
|
.replaceAll(/(?<!\*)\*((?!\s)([^\n*]+?)(?<!\s))\*(?!\*)/g, '_$1_') // Substitui * por _
|
||||||
.replaceAll(/\*{2}((?!\s)([^\n*]+?)(?<!\s))\*{2}/g, '*$1*') // Substitui ** por *
|
.replaceAll(/\*{2}((?!\s)([^\n*]+?)(?<!\s))\*{2}/g, '*$1*') // Substitui ** por *
|
||||||
.replace(/~{2}((?!\s)([^\n*]+?)(?<!\s))~{2}/g, '~$1~'); // Substitui ~~ por ~
|
.replaceAll(/~{2}((?!\s)([^\n*]+?)(?<!\s))~{2}/g, '~$1~') // Substitui ~~ por ~
|
||||||
|
.replaceAll(/(?<!`)`((?!\s)([^`*]+?)(?<!\s))`(?!`)/g, '```$1```'); // Substitui ` por ```
|
||||||
|
|
||||||
const senderName = body?.sender?.name;
|
const senderName = body?.sender?.name;
|
||||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||||
@ -1481,6 +1483,7 @@ export class ChatwootService {
|
|||||||
|
|
||||||
this.logger.verbose('get conversation message');
|
this.logger.verbose('get conversation message');
|
||||||
|
|
||||||
|
// Whatsapp to Chatwoot
|
||||||
const bodyMessage = await this.getConversationMessage(body.message)
|
const bodyMessage = await this.getConversationMessage(body.message)
|
||||||
.replaceAll(/\*((?!\s)([^\n*]+?)(?<!\s))\*/g, '**$1**')
|
.replaceAll(/\*((?!\s)([^\n*]+?)(?<!\s))\*/g, '**$1**')
|
||||||
.replaceAll(/_((?!\s)([^\n_]+?)(?<!\s))_/g, '*$1*')
|
.replaceAll(/_((?!\s)([^\n_]+?)(?<!\s))_/g, '*$1*')
|
||||||
|
Loading…
Reference in New Issue
Block a user