-
Notifications
You must be signed in to change notification settings - Fork 3.9k
chore: possibilita o envio de medias do tipo [svg, tiff] vindas do Chatwoot #1483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR generalizes the media handling logic by introducing a 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 commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @KokeroO - I've reviewed your changes - here's some feedback:
- Consider hoisting the
documentExtensions
array out of the function (or module) scope to avoid recreating it on every call and centralize configuration. - You might also want to include the common
.tif
extension alongside.tiff
to cover both naming variants.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@sourcery-ai resolve |
Descrição
Este PR adiciona a possiblidade de envio de arquivos do tipo
SVG
eTIFF
da mesma forma que faz com do tipoGIF
vindas do Chatwoot.Atualmente o WhatsApp WEB somente aceita imagens do tipo
JPG, PNG e WEBP
de forma nativa,GIF
eSVG
o core processa as imagens emJPEG
ePNG
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
eTIFF
da mesma forma que atualmente é feito com as imagens do tipoGIF
.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.
Futuro
Futuramente poderíamos implementar um processador de imagens. Convertendo nos formatos aceitáveis pelo WhatsApp.