HomeBrowseUpload
โ† Back to registry
โšก
// Skill profile

๐Ÿ”” Webchat Audio Notifications

name: webchat-audio-notifications

by brokemac79 ยท published 2026-03-22

ๅผ€ๅ‘ๅทฅๅ…ทๆ•ฐๆฎๅค„็†
Total installs
0
Stars
โ˜… 0
Last updated
2026-03
// Install command
$ claw add gh:brokemac79/brokemac79-webchat-audio-notifications
View on GitHub
// Full documentation

---

name: webchat-audio-notifications

description: Add browser audio notifications to Moltbot/Clawdbot webchat with 5 intensity levels - from whisper to impossible-to-miss (only when tab is backgrounded).

version: 1.1.0

author: brokemac79

repository: https://github.com/brokemac79/webchat-audio-notifications

homepage: https://github.com/brokemac79/webchat-audio-notifications

tags:

- webchat

- notifications

- audio

- ux

- browser

- howler

metadata:

clawdbot:

emoji: ๐Ÿ””

compatibility:

minVersion: "2026.1.0"

browsers:

- Chrome 92+

- Firefox 90+

- Safari 15+

- Edge 92+

dependencies:

- howler.js (included)

files:

- client/howler.min.js

- client/notification.js

- client/sounds/notification.mp3

- client/sounds/alert.mp3

install:

- kind: manual

label: Install webchat audio notifications

instructions: |

1. Copy files to your webchat directory:

- client/howler.min.js โ†’ /webchat/js/

- client/notification.js โ†’ /webchat/js/

- client/sounds/ โ†’ /webchat/sounds/

2. Add to your webchat HTML before closing </body>:

```html

<script src="/js/howler.min.js"></script>

<script src="/js/notification.js"></script>

<script>

const notifier = new WebchatNotifications({

soundPath: '/sounds/notification'

});

notifier.init();

</script>

```

3. Hook into message events:

```javascript

socket.on('message', () => {

if (notifier) notifier.notify();

});

```

4. Test by switching tabs and triggering a message

See docs/integration.md for full guide.

---

# ๐Ÿ”” Webchat Audio Notifications

Browser audio notifications for Moltbot/Clawdbot webchat. Plays a notification sound when new messages arrive - but only when the tab is in the background.

Features

  • ๐Ÿ”” **Smart notifications** - Only plays when tab is hidden
  • ๐ŸŽš๏ธ **Volume control** - Adjustable 0-100%
  • ๐ŸŽต **5 intensity levels** - Whisper (1) to impossible-to-miss (5)
  • ๐Ÿ“ **Custom sounds** - Upload your own (MP3, WAV, OGG, WebM)
  • ๐Ÿ”• **Easy toggle** - Enable/disable with one click
  • ๐Ÿ’พ **Persistent settings** - Preferences saved in localStorage
  • ๐Ÿ“ฑ **Mobile-friendly** - Graceful degradation on mobile
  • ๐Ÿšซ **Autoplay handling** - Respects browser policies
  • โฑ๏ธ **Cooldown** - Prevents spam (3s between alerts)
  • ๐Ÿž **Debug mode** - Optional logging
  • Quick Start

    Test the POC

    cd examples
    python3 -m http.server 8080
    # Open http://localhost:8080/test.html

    **Test steps:**

    1. Switch to another tab

    2. Click "Trigger Notification"

    3. Hear the sound! ๐Ÿ”Š

    Basic Integration

    // Initialize
    const notifier = new WebchatNotifications({
      soundPath: './sounds',
      soundName: 'level3',  // Medium intensity (default)
      defaultVolume: 0.7
    });
    
    await notifier.init();
    
    // Trigger on new message
    socket.on('message', () => notifier.notify());
    
    // Use different levels for different events
    socket.on('mention', () => {
      notifier.setSound('level5');  // Loudest for mentions
      notifier.notify();
    });

    API

    Constructor Options

    new WebchatNotifications({
      soundPath: './sounds',               // Path to sounds directory
      soundName: 'level3',                 // level1 (whisper) to level5 (very loud)
      defaultVolume: 0.7,                  // 0.0 to 1.0
      cooldownMs: 3000,                    // Min time between alerts
      enableButton: true,                  // Show enable prompt
      debug: false                         // Console logging
    });

    **Intensity Levels:**

  • `level1` - Whisper (9.5KB) - Most subtle
  • `level2` - Soft (12KB) - Gentle
  • `level3` - Medium (13KB) - Default
  • `level4` - Loud (43KB) - Attention-getting
  • `level5` - Very Loud (63KB) - Impossible to miss
  • Methods

  • `init()` - Initialize (call after Howler loads)
  • `notify(eventType?)` - Trigger notification (only if tab hidden)
  • `test()` - Play sound immediately (ignore tab state)
  • `setEnabled(bool)` - Enable/disable notifications
  • `setVolume(0-1)` - Set volume
  • `setSound(level)` - Change intensity ('level1' through 'level5')
  • `getSettings()` - Get current settings
  • Browser Compatibility

    | Browser | Version | Support |

    |---------|---------|---------|

    | Chrome | 92+ | โœ… Full |

    | Firefox | 90+ | โœ… Full |

    | Safari | 15+ | โœ… Full |

    | Mobile | Latest | โš ๏ธ Limited |

    **Overall:** 92% of users (Web Audio API support)

    File Structure

    webchat-audio-notifications/
    โ”œโ”€โ”€ client/
    โ”‚   โ”œโ”€โ”€ notification.js       # Main class (10KB)
    โ”‚   โ”œโ”€โ”€ howler.min.js         # Audio library (36KB)
    โ”‚   โ””โ”€โ”€ sounds/
    โ”‚       โ”œโ”€โ”€ level1.mp3        # Whisper (9.5KB)
    โ”‚       โ”œโ”€โ”€ level2.mp3        # Soft (12KB)
    โ”‚       โ”œโ”€โ”€ level3.mp3        # Medium (13KB, default)
    โ”‚       โ”œโ”€โ”€ level4.mp3        # Loud (43KB)
    โ”‚       โ””โ”€โ”€ level5.mp3        # Very Loud (63KB)
    โ”œโ”€โ”€ examples/
    โ”‚   โ””โ”€โ”€ test.html            # Standalone test with all levels
    โ”œโ”€โ”€ docs/
    โ”‚   โ””โ”€โ”€ integration.md       # Integration guide
    โ””โ”€โ”€ README.md                # Full documentation

    Integration Guide

    See `docs/integration.md` for:

  • Step-by-step setup
  • Moltbot-specific hooks
  • React/Vue examples
  • Common patterns (@mentions, DND, badges)
  • Testing checklist
  • Configuration Examples

    Simple

    const notifier = new WebchatNotifications();
    await notifier.init();
    notifier.notify();

    Advanced

    const notifier = new WebchatNotifications({
      soundPath: '/assets/sounds',
      soundName: 'level2',  // Start with soft
      defaultVolume: 0.8,
      cooldownMs: 5000,
      debug: true
    });
    
    await notifier.init();
    
    // Regular messages = soft
    socket.on('message', () => {
      notifier.setSound('level2');
      notifier.notify();
    });
    
    // Mentions = very loud
    socket.on('mention', () => {
      notifier.setSound('level5');
      notifier.notify();
    });
    
    // DMs = loud
    socket.on('dm', () => {
      notifier.setSound('level4');
      notifier.notify();
    });

    With UI Controls

    <input type="range" min="0" max="100" 
           onchange="notifier.setVolume(this.value / 100)">
    <button onclick="notifier.test()">Test ๐Ÿ”Š</button>

    Troubleshooting

    **No sound?**

  • Click page first (autoplay restriction)
  • Check tab is actually hidden
  • Verify volume > 0
  • Check console for errors
  • **Sound plays when tab active?**

  • Enable debug mode
  • Check for "Tab is visible, skipping" message
  • Report as bug if missing
  • **Mobile not working?**

  • iOS requires user gesture per play
  • Consider visual fallback (flashing favicon)
  • Performance

  • **Bundle:** ~122KB total (minified)
  • **Memory:** ~2MB during playback
  • **CPU:** Negligible (browser-native)
  • **Network:** One-time download, cached
  • Security

  • โœ… No external requests
  • โœ… localStorage only
  • โœ… No tracking
  • โœ… No special permissions
  • License

    MIT License

    Credits

  • **Audio library:** [Howler.js](https://howlerjs.com/) (MIT)
  • **Sounds:** [Mixkit.co](https://mixkit.co/) (Royalty-free)
  • **Author:** @brokemac79
  • **For:** [Moltbot/Clawdbot](https://github.com/moltbot/moltbot) community
  • Contributing

    1. Test with `examples/test.html`

    2. Enable debug mode

    3. Report issues with browser + console output

    Roadmap

  • [ ] WebM format (smaller files)
  • [ ] Per-event sounds (mention, DM, etc.)
  • [ ] Visual fallback (favicon flash)
  • [ ] System notifications API
  • [ ] Settings UI component
  • [ ] Do Not Disturb mode
  • ---

    **Status:** โœ… v1.1.0 Complete - 5 Intensity Levels

    **Tested:** Chrome, Firefox, Safari

    **Ready for:** Production use & ClawdHub publishing

    Links

  • ๐Ÿ“– [README](./README.md) - Full documentation
  • ๐Ÿ”ง [Integration Guide](./docs/integration.md) - Setup instructions
  • ๐Ÿงช [Test Page](./examples/test.html) - Try it yourself
  • ๐Ÿ’ฌ [Discord Thread](https://discord.com/channels/1456350064065904867/1466181146374307881) - Community discussion
  • // Comments
    Sign in with GitHub to leave a comment.
    // Related skills

    More tools from the same signal band