A bidirectional integration tool that synchronizes posts between Apache Answers and Microsoft Teams channels using Power Automate.
This tool enables seamless communication between Apache Answers and Microsoft Teams by:
- Answers → Teams: When someone creates a post in Apache Answers, it automatically posts to a designated Teams channel
- Teams → Answers: When someone adds an emoji reaction to a message in Teams, it creates a corresponding question in Apache Answers
- Bidirectional synchronization between Apache Answers and Microsoft Teams
- Real-time post notifications
- Emoji reaction-based question creation
- Automated content formatting
- Error handling and logging
- Configurable channel and forum mappings
- Apache Answers instance with API access
- Microsoft Teams with Power Automate access
- Azure AD app registration for authentication
- Power Automate premium license (for custom connectors)
- Set up authentication and API access
- Create Power Automate flows for bidirectional sync
- Implement webhook endpoints for real-time updates
- Configure channel and forum mappings
- Test integration with sample posts
- Deploy and monitor the integration
- Node.js (v16 or higher)
- npm or yarn
- Apache Answers instance with API access
- (Optional) API key for authentication
-
Clone the repository:
git clone <repository-url> cd apache-answers-bot
-
Install dependencies:
npm install
-
Configure environment variables:
cp env.example .env
Edit the
.envfile with your configuration:# Apache Answers Configuration ANSWERS_BASE_URL=https://your-answers-instance.com ANSWERS_ACCESS_TOKEN=your_access_token_here ANSWERS_EMAIL=your_email@example.com ANSWERS_PASSWORD=your_password # Monitoring Configuration CHECK_INTERVAL_MS=30000 LOG_LEVEL=info # Teams Configuration TEAMS_DEFAULT_WEBHOOK_URL=your_default_teams_webhook_url TEAMS_CHANNELS=[{"tags":["javascript","typescript"],"webhookUrl":"your_js_teams_webhook","channelName":"JavaScript"},{"tags":["python","django"],"webhookUrl":"your_python_teams_webhook","channelName":"Python"}]
Apache Answers uses access tokens instead of API keys. To get your access token:
-
Set up your credentials in the
.envfile:ANSWERS_BASE_URL=https://your-answers-instance.com ANSWERS_EMAIL=your_email@example.com ANSWERS_PASSWORD=your_password
-
Get your access token:
npm run get-token
-
Copy the token to your
.envfile:ANSWERS_ACCESS_TOKEN=your_access_token_here
Alternative method (manual):
- Go to your Apache Answers instance
- Open the Swagger UI:
https://your-instance.com/swagger/index.html - Use the
/answer/api/v1/user/login/emailendpoint - Provide your email and password
- Copy the
access_tokenfrom the response
Development mode (with auto-reload):
npm run devProduction mode:
npm run build
npm startWatch mode (for development):
npm run watchThe integration will:
- Monitor Apache Answers: Check for new posts every 30 seconds (configurable)
- Route to Teams: Automatically send new posts to appropriate Teams channels based on tags
- Rich Messages: Create beautiful Adaptive Cards in Teams with:
- Post title and description
- Author information
- Creation timestamp
- Tags and metadata
- Direct link to the Apache Answers post
| Environment Variable | Description | Default |
|---|---|---|
ANSWERS_BASE_URL |
Your Apache Answers instance URL | https://meta.answer.dev |
ANSWERS_ACCESS_TOKEN |
Access token for authentication (get with npm run get-token) |
- |
ANSWERS_EMAIL |
Email for authentication (required to get token) | - |
ANSWERS_PASSWORD |
Password for authentication (required to get token) | - |
CHECK_INTERVAL_MS |
How often to check for new posts (milliseconds) | 30000 |
LOG_LEVEL |
Logging level (debug, info, warn, error) | info |
TEAMS_DEFAULT_WEBHOOK_URL |
Default Teams webhook URL (fallback for posts without matching tags) | - |
TEAMS_CHANNELS |
JSON array of channel mappings with tags and webhook URLs | [] |
The integration supports automatic posting to Microsoft Teams channels based on post tags:
Set TEAMS_DEFAULT_WEBHOOK_URL to post all new questions to a default Teams channel.
Use TEAMS_CHANNELS to route posts to specific channels based on their tags:
[
{
"tags": ["javascript", "typescript"],
"webhookUrl": "https://your-js-teams-webhook-url",
"channelName": "JavaScript"
},
{
"tags": ["python", "django"],
"webhookUrl": "https://your-python-teams-webhook-url",
"channelName": "Python"
},
{
"tags": ["general", "help"],
"webhookUrl": "https://your-general-teams-webhook-url",
"channelName": "General"
}
]- New post detected in Apache Answers
- Tags analyzed to find matching channels
- Posts sent to all matching Teams channels
- Fallback to default channel if no matches found
- Rich cards displayed in Teams with post details
The application creates log files in the logs/ directory:
combined.log- All log messageserror.log- Error messages only
Console output includes colored, formatted logs for easy monitoring.
For production deployment on Ubuntu as a systemd service, see the deployment directory.
# On your Ubuntu server
cd /opt/apache-answers-bot/deployment
sudo ./install-systemd.shThis will:
- Create a dedicated
apache-answers-botsystem user - Install the service as
apache-answers-bot - Set up FHS-compliant logging in
/var/log/apache-answers-bot/ - Configure automatic log rotation
- Enable the service to start on boot
For detailed instructions, troubleshooting, and configuration options, see:
- Deployment Guide - Complete installation guide
- Quick Reference - Common commands
- Logging Setup - Log configuration details
This project is in early development. Please check back for contribution guidelines.
License information to be added.