feat: Add Chatwoot Agent Bot prototype and FAQ knowledge base

- Created chatwoot-agent-bot/ with Node.js webhook server
- Bot detects intent (greeting, billing, technical, features, account)
- Auto-responds from FAQ knowledge base or escalates to human
- FAQ-KB.md: Living knowledge base that grows with customer questions
- CHATWOOT-SETUP.md: Complete deployment and configuration guide
- Supports Telegram notifications on escalation
- Bot runs on port 3001, ready for Chatwoot webhook integration
This commit is contained in:
2026-04-01 16:26:05 -04:00
parent 7ba19752de
commit 5319bcd30b
1074 changed files with 456376 additions and 0 deletions

View File

@@ -0,0 +1,294 @@
# Session: 2026-04-01 20:13:01 UTC
- **Session Key**: agent:main:telegram:direct:8269921691
- **Session ID**: d74878d5-76ab-4fd7-b32b-30a408507234
- **Source**: telegram
## Conversation Summary
user: Conversation info (untrusted metadata):
```json
{
"message_id": "3904",
"sender_id": "8269921691",
"sender": "Chris Olson",
"timestamp": "Wed 2026-04-01 07:44 EDT"
}
```
Sender (untrusted metadata):
```json
{
"label": "Chris Olson (8269921691)",
"id": "8269921691",
"name": "Chris Olson"
}
```
The remote should already be set up, youve created branches and pushed to it many times. Its the hoaledgeriq website repo at https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website.git
Create a feature branch and push the deployment files you created but said you left in the workspace.
assistant: Let me check the current git remote configuration and see what branches exist.
assistant: The remote isn't configured yet. Let me set it up and check what deployment files exist in the workspace:
assistant: Good, I can see the deployment files. Let me also check the `deploy.sh` and see what's in the content/marketing directories:
assistant: Now let me create a feature branch, add the deployment files, and push them. I'll create a branch called `feature/deployment-files`:
assistant: Good, the deployment files are staged. Now let me commit and push:
assistant: Done! I've:
1. ✅ Added the remote: `https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website.git`
2. ✅ Created branch: `feature/deployment-files`
3. ✅ Committed 44 files including:
- `deploy.sh` - Zero-downtime deployment script
- `content/` - Generated content (blog outlines, social posts, images)
- `marketing/` - Marketing content and daily summaries
- `marketing-content/` - Archived marketing content with research
- `marketing-content-2026-03-25.md` - Initial marketing archive
4. ✅ Pushed to remote
**Create the PR here:**
https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website/pulls/new/feature/deployment-files
user: Conversation info (untrusted metadata):
```json
{
"message_id": "3905",
"sender_id": "8269921691",
"sender": "Chris Olson",
"timestamp": "Wed 2026-04-01 08:05 EDT"
}
```
Sender (untrusted metadata):
```json
{
"label": "Chris Olson (8269921691)",
"id": "8269921691",
"name": "Chris Olson"
}
```
Did you push the files to the repo?
assistant: Yes! The files are pushed to the repo. Here's what happened:
- **Branch created:** `feature/deployment-files`
- **Files pushed:** 44 files total (deploy.sh, content/, marketing/, marketing-content/)
- **Remote URL:** https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website.git
You can create the pull request here:
https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website/pulls/new/feature/deployment-files
The commit includes all the deployment scripts and marketing content files that were generated over the past week.
user: Conversation info (untrusted metadata):
```json
{
"message_id": "3914",
"sender_id": "8269921691",
"sender": "Chris Olson",
"timestamp": "Wed 2026-04-01 08:10 EDT"
}
```
Sender (untrusted metadata):
```json
{
"label": "Chris Olson (8269921691)",
"id": "8269921691",
"name": "Chris Olson"
}
```
Be sure to note the git repo in your memory so it is not forgotten going forward
assistant: Done! I've added the HOALedgerIQ_Website git repository details to `TOOLS.md` so it's preserved for future sessions. The repo info includes:
- **URL:** https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website.git
- **Remote:** origin
- **Main branch:** main
- **Purpose:** HOA Ledger IQ website deployment and marketing content
user: Conversation info (untrusted metadata):
```json
{
"message_id": "3917",
"sender_id": "8269921691",
"sender": "Chris Olson",
"timestamp": "Wed 2026-04-01 11:01 EDT"
}
```
Sender (untrusted metadata):
```json
{
"label": "Chris Olson (8269921691)",
"id": "8269921691",
"name": "Chris Olson"
}
```
for the deploy.sh script that you created, what do the contents of my .env file need to include?
assistant: Looking at the `deploy.sh` script, it doesn't actually read from a `.env` file directly. Instead, it uses environment variables that can be set via shell exports or passed inline.
Here's what your `.env` file (or deployment environment) should include if you want to customize the deployment:
```bash
# Git Configuration
GIT_REMOTE=origin
GIT_BRANCH=main
GIT_REPO_URL=https://git.sensetostyle.com/JoeBot/HOALedgerIQ_Website.git
# Deployment Configuration
DEPLOY_DIR=/home/ubuntu/www
SERVICE_NAME=hoaledgeriq
# Cache Clearing (optional - customize based on your framework)
# For generic static sites, you might not need this
CACHE_CLEAR_CMD="rm -rf ${DEPLOY_DIR}/cache/* || true"
# For Laravel:
# CACHE_CLEAR_CMD="php artisan cache:clear && php artisan config:clear && php artisan view:clear"
# For Django:
# CACHE_CLEAR_CMD="python manage.py clear_cache"
```
**Required variables:**
- `DEPLOY_DIR` - Where your website files live on the server (currently set to `/home/ubuntu/www`)
- `SERVICE_NAME` - The systemd service name that runs your app (currently `hoaledgeriq`)
**Optional variables** (have defaults in the script):
- `GIT_REMOTE` - Defaults to `origin`
- `GIT_BRANCH` - Defaults to `main`
- `CACHE_CLEAR_CMD` - Defaults to clearing a cache directory
**Important notes from the script:**
1. The script must be run as the `ubuntu` user
2. The target directory must already exist and be a git repo
3. A systemd service with the specified name should exist
Do you want me to modify the script to actually load from a `.env` file, or will you be setting these as environment variables when running the deploy?
user: Conversation info (untrusted metadata):
```json
{
"message_id": "3919",
"sender_id": "8269921691",
"sender": "Chris Olson",
"timestamp": "Wed 2026-04-01 11:09 EDT"
}
```
Sender (untrusted metadata):
```json
{
"label": "Chris Olson (8269921691)",
"id": "8269921691",
"name": "Chris Olson"
}
```
thank you - I'll deal with it as env variables. Now what do I need to do to set the GITEA action?
assistant: To set up a Gitea action (CI/CD pipeline) for your HOALedgerIQ_Website repo, you'll need to create a workflow file. Here's what you need:
## 1. Create the workflow file
Create `.gitea/workflows/deploy.yml` in your repo:
```yaml
name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted # or your runner label
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deploy to server
run: |
chmod +x ./deploy.sh
./deploy.sh
env:
DEPLOY_DIR: ${{ vars.DEPLOY_DIR }}
SERVICE_NAME: ${{ vars.SERVICE_NAME }}
GIT_BRANCH: main
```
## 2. Set up Gitea Actions Runner
You need a **self-hosted runner** on your server since Gitea Actions needs somewhere to execute the workflow:
```bash
# On your deployment server (as ubuntu user)
mkdir -p ~/actions-runner
cd ~/actions-runner
# Download runner (check your Gitea version for correct URL)
wget https://<your-gitea-url>/actions/runners/download?os=linux&arch=amd64
tar -xzf linux_amd64.tar.gz
# Configure runner (you'll get this from Gitea UI)
# Go to: Gitea Admin → Actions → Runners → New Runner
# Copy the token and run:
./config.sh --url https://<your-gitea-url> --token <TOKEN> --name production-deploy
```
## 3. Set repository variables (optional but recommended)
In your Gitea repo settings, set these variables:
- `DEPLOY_DIR` = `/home/ubuntu/www`
- `SERVICE_NAME` = `hoaledgeriq`
## 4. Enable Actions in your repo
Make sure Actions are enabled:
- Go to repo settings → Actions → Enable Actions
## Alternative: Simple SSH-based deployment
If you don't want to run a self-hosted runner, you could use a simpler approach with SSH:
```yaml
name: Deploy via SSH
on:
push:
branches: [main]
jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
cd ${{ secrets.DEPLOY_DIR }}
git pull origin main
systemctl restart hoaledgeriq
```
Then set these **secrets** in your repo:
- `DEPLOY_HOST` = your server IP/hostname
- `DEPLOY_USER` = `ubuntu`
- `DEPLOY_KEY` = SSH private key
- `DEPLOY_DIR` = `/home/ubuntu/www`
Which approach do you want to go with? The self-hosted runner gives you more flexibility, while the SSH approach is simpler to set up initially.