Hi everyone,
I’m working on a Gmail add-on that automatically forwards Gmail messages to Slack, aimed at helping small business teams receive important messages and inquiries directly within their Slack channels.
I develop it using Apps Script as a gmail add-on.
The add-on allows users to set up custom forwarding rules based on keywords, senders, or timeframes, making it ideal for ensuring timely responses and staying organized.
**Challenge: Keeping Original Email Formatting**
The main issue I’m encountering is preserving the original email formatting—especially for HTML emails—when forwarding from Gmail to Slack. Currently, I’m able to forward messages as text, but any HTML formatting is stripped in the process. This can result in messages looking disorganized or missing key elements like links, images, and text styling, which could be crucial for clarity.
### What I've Tried
1. **Text-based forwarding**: Works fine for basic messages but strips out HTML styling.
2. **Extracting HTML body**: While Gmail APIs allow access to the HTML body, it’s challenging to send this to Slack without format loss.
### Questions
1. Has anyone tackled this issue of retaining HTML formatting when sending Gmail messages to Slack?
2. Are there any best practices or Slack-compatible formats for rendering HTML emails correctly?
3. Is there an alternative approach that supports Slack’s formatting options, such as attachments or Slack’s Block Kit, to better preserve the structure?
Any guidance or tips would be greatly appreciated.
Thanks for your insights!