| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Reviewer's GuideThis PR generalizes the media handling logic by introducing a documentExtensions array (['.gif', '.svg', '.tiff']) and updating the condition to send matching images as documents, thereby enabling SVG and TIFF support in the Chatwoot integration. Sequence Diagram for Handling Special Image Attachments from ChatwootsequenceDiagram
participant C as Chatwoot
participant API as "ChatwootService (API)"
participant WA as WhatsApp
C->>+API: Send message with image (e.g., .svg, .tiff, .gif)
API->>API: Received type: 'image', attachment_extension: ext
alt ext is in documentExtensions ['.gif', '.svg', '.tiff']
API->>API: Modify type: 'image' -> 'document'
API->>+WA: Send message (type='document', media)
else Other image types (e.g., .jpg, .png)
API->>+WA: Send message (type='image', media)
end
WA-->>-API: Delivery Status
API-->>-C: Message Status
File-Level Changes
Tips and commands Interacting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sorry, something went wrong.
There was a problem hiding this comment.
Hey @KokeroO - I've reviewed your changes - here's some feedback:
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Descrição
Este PR adiciona a possiblidade de envio de arquivos do tipo SVG e TIFF da mesma forma que faz com do tipo GIF vindas do Chatwoot.
Atualmente o WhatsApp WEB somente aceita imagens do tipo JPG, PNG e WEBP de forma nativa, GIF e SVG o core processa as imagens em JPEG e PNG respectivamente.
Como o Chatwoot não entende que isso é um problema no canal de API deles, visto que o envio do arquivo é feito puro. Então sim, se entende ser um problema da API. Devemos tratar esses attachs na API Evolution.
Proposta
Enviar os tipos SVG e TIFF da mesma forma que atualmente é feito com as imagens do tipo GIF.
Solução
Adicionei uma constante com um array de extensões de mimetype: image e que deverão ser enviadas como tipo document. O array permite a fácil inclusão de outros tipos de imagens que poderão ser identificadas futuramente.
const documentExtensions = ['.gif', '.svg', '.tiff']; if (type === 'image' && parsedMedia && documentExtensions.includes(parsedMedia?.ext)) { type = 'document'; }Futuro
Futuramente poderíamos implementar um processador de imagens. Convertendo nos formatos aceitáveis pelo WhatsApp.