[PR #350] [MERGED] Add camera image embeds to Discord notifications #1006

Closed
opened 2026-05-06 12:34:27 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/350
Author: @sbcrumb
Created: 2/12/2026
Status: Merged
Merged: 2/13/2026
Merged by: @maziggy

Base: 0.2.0bHead: feature/discord-image-embeds


📝 Commits (2)

  • a942fb5 Add camera image embeds to Discord notifications
  • 7fd1218 Merge branch '0.2.0b' into feature/discord-image-embeds

📊 Changes

1 file changed (+20 additions, -11 deletions)

View changed files

📝 backend/app/services/notification_service.py (+20 -11)

📄 Description

Add camera image embeds to Discord webhook notifications. When a camera snapshot is available, it is attached to the Discord webhook via multipart form-data and referenced in the embed's image field. This applies to print start, print complete/failed/stopped, progress milestones (25%, 50%, 75%), and printer error notifications. When no image is available, notifications continue to send as text-only.

Related Issue
Fixes #306

Type of Change
Bug fix (non-breaking change that fixes an issue)
New feature (non-breaking change that adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
Documentation update
Code refactoring
Performance improvement
Test addition or update

Changes Made
Added image_data parameter to _send_discord() in notification_service.py
When image data is present, send as multipart form-data with payload_json for the embed and files[0] for the JPEG attachment, using Discord's attachment://photo.jpg URL reference in the embed image field
Pass image_data through to Discord in _send_to_provider(), matching existing Pushover behavior
When no image is available, behavior is unchanged (text-only embed via JSON POST)
Screenshots
image

Testing
I have tested this on my local machine
I have tested with my printer model: H2S

Checklist
My code follows the project's coding style
I have commented my code where necessary
I have updated the documentation (if needed)

My changes generate no new warnings
I have tested my changes thoroughly

Additional Notes
This builds on the existing camera snapshot infrastructure already in the codebase. The image capture logic (external camera, buffered stream frame, or fresh capture via chamber image/RTSP) is shared across all providers that support attachments. Discord uses the attachment:// URI scheme to reference uploaded files within embeds, which is the recommended approach from Discord's API documentation


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/350 **Author:** [@sbcrumb](https://github.com/sbcrumb) **Created:** 2/12/2026 **Status:** ✅ Merged **Merged:** 2/13/2026 **Merged by:** [@maziggy](https://github.com/maziggy) **Base:** `0.2.0b` ← **Head:** `feature/discord-image-embeds` --- ### 📝 Commits (2) - [`a942fb5`](https://github.com/maziggy/bambuddy/commit/a942fb5474b6e6a3fe1e614eaa057229a62e712a) Add camera image embeds to Discord notifications - [`7fd1218`](https://github.com/maziggy/bambuddy/commit/7fd1218205a8cb51227ee6a9394f8d992309a71d) Merge branch '0.2.0b' into feature/discord-image-embeds ### 📊 Changes **1 file changed** (+20 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `backend/app/services/notification_service.py` (+20 -11) </details> ### 📄 Description Add camera image embeds to Discord webhook notifications. When a camera snapshot is available, it is attached to the Discord webhook via multipart form-data and referenced in the embed's image field. This applies to print start, print complete/failed/stopped, progress milestones (25%, 50%, 75%), and printer error notifications. When no image is available, notifications continue to send as text-only. Related Issue Fixes #306 Type of Change Bug fix (non-breaking change that fixes an issue) New feature (non-breaking change that adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Code refactoring Performance improvement Test addition or update Changes Made Added image_data parameter to _send_discord() in notification_service.py When image data is present, send as multipart form-data with payload_json for the embed and files[0] for the JPEG attachment, using Discord's attachment://photo.jpg URL reference in the embed image field Pass image_data through to Discord in _send_to_provider(), matching existing Pushover behavior When no image is available, behavior is unchanged (text-only embed via JSON POST) Screenshots <img width="581" height="772" alt="image" src="https://github.com/user-attachments/assets/c4abb1d2-0202-4a76-bdab-543550d74917" /> Testing I have tested this on my local machine I have tested with my printer model: H2S Checklist My code follows the project's coding style I have commented my code where necessary I have updated the documentation (if needed) My changes generate no new warnings I have tested my changes thoroughly Additional Notes This builds on the existing camera snapshot infrastructure already in the codebase. The image capture logic (external camera, buffered stream frame, or fresh capture via chamber image/RTSP) is shared across all providers that support attachments. Discord uses the attachment:// URI scheme to reference uploaded files within embeds, which is the recommended approach from Discord's API documentation --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:34:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#1006
No description provided.