Thank you for your interest in contributing! 🎉
-
Clone the repository
git clone https://github.com/tintinweb/pi-messenger-bridge.git cd pi-messenger-bridge -
Install dependencies
npm install
-
Build the project
npm run build
-
Test locally
# Set up your test bot token export PI_TELEGRAM_TOKEN="your-test-bot-token" # Option A: Install in pi pi install /path/to/pi-messenger-bridge pi /msg-bridge connect # Option B: Load directly from source (faster for development) pi -e ./src/index.ts /msg-bridge connect
src/
├── index.ts # Main entry point (event handlers, commands)
├── types.ts # TypeScript interfaces
├── auth/
│ └── challenge-auth.ts # Authentication system
├── transports/
│ ├── interface.ts # ITransportProvider interface
│ ├── manager.ts # Message routing
│ └── telegram.ts # Telegram implementation
└── ui/
└── status-widget.ts # Status display
To add support for a new messenger (e.g., WhatsApp, Slack, Discord):
-
Create a provider in
src/transports/<name>.tsimport type { ITransportProvider } from "./interface.js"; import type { ChallengeAuth } from "../auth/challenge-auth.js"; export class WhatsAppProvider implements ITransportProvider { readonly type = "whatsapp"; // Implement all ITransportProvider methods }
-
Register in index.ts
if (config.whatsapp?.token) { const whatsappProvider = new WhatsAppProvider(config.whatsapp.token, auth); transportManager.addTransport(whatsappProvider); }
-
Update types if needed in
src/types.ts -
Update docs in README.md and GETTING_STARTED.md
- Use TypeScript strict mode
- Follow existing naming conventions
- Add JSDoc comments for public APIs
- Keep functions focused and testable
Currently, testing is manual. Automated tests welcome!
Manual testing checklist:
- Bot connects successfully
- Challenge codes appear in terminal
- Authentication works (correct code)
- Authentication fails properly (wrong code, too many attempts)
- Messages are sent and received correctly
- Group chat mention detection works
- Admin commands work
- Widget displays correct status
- Fork the repository
- Create a branch for your feature (
git checkout -b feature/amazing-feature) - Make your changes and commit (
git commit -m 'Add amazing feature') - Push to your fork (
git push origin feature/amazing-feature) - Open a Pull Request with:
- Clear description of changes
- Why the change is needed
- Any breaking changes
- Testing performed
Follow conventional commits:
feat:New featurefix:Bug fixdocs:Documentation changesrefactor:Code refactoringtest:Adding testschore:Maintenance tasks
Examples:
feat: add WhatsApp transport support
fix: handle undefined username in Telegram messages
docs: update GETTING_STARTED with group chat setup
When reporting bugs, include:
- pi version
- Extension version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Error messages (if any)
Open an issue with:
- Clear use case
- Why it's valuable
- Proposed implementation (if you have ideas)
Open a discussion or issue. We're here to help!
By contributing, you agree that your contributions will be licensed under the MIT License.