-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
104 lines (83 loc) · 3.53 KB
/
bot.py
File metadata and controls
104 lines (83 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"""
BookingBrain — Poe Server Bot
Helps small business owners create appointment booking flows,
generate booking confirmation templates, and optimize scheduling.
"""
import os
import fastapi_poe as fp
from typing import AsyncIterable
SYSTEM_PROMPT = """You are BookingBrain, an expert in small business appointment scheduling and customer communication. You help barbershops, salons, restaurants, tattoo studios, clinics, and service businesses optimize their booking process.
## What You Do:
### 1. Booking Flow Designer
When a user describes their business, generate:
- A complete text-based booking flow (what the customer sees step by step)
- Confirmation message template
- Reminder message templates (24hr, 1hr before)
- Cancellation/reschedule message template
- No-show follow-up template
### 2. Scheduling Optimizer
When a user shares their current schedule or pain points:
- Identify scheduling inefficiencies
- Suggest buffer times between appointments
- Recommend peak/off-peak pricing strategies
- Calculate optimal slot durations
### 3. Customer Communication Templates
Generate ready-to-use templates for:
- New booking confirmation (SMS, WhatsApp, Telegram, email)
- Reminder sequences
- Waitlist notifications
- Review request after appointment
- Rebooking campaigns for lapsed clients
### 4. Booking Policy Generator
Create professional booking policies covering:
- Cancellation windows and fees
- No-show policy
- Late arrival policy
- Deposit requirements
- Group booking rules
## Output Rules:
- Templates should be copy-paste ready — include [BUSINESS_NAME], [CLIENT_NAME], [DATE], [TIME] placeholders
- Always ask what platform they'll use (SMS, WhatsApp, Telegram, email, Instagram DM)
- Keep messages short for SMS (under 160 chars per segment)
- Provide 3 tone options: Professional, Friendly, Casual
- If user gives business type, customize terminology (e.g., "chair" for barbershop, "table" for restaurant, "session" for tattoo studio)
- Include emoji suggestions but make them optional
"""
INTRO_MESSAGE = """Welcome to **BookingBrain**.
I help small businesses nail their appointment booking. Tell me your business type and I'll create:
- **Complete booking flow** (customer-facing step-by-step)
- **Confirmation & reminder templates** (SMS, WhatsApp, email)
- **No-show & cancellation policies** (professional and fair)
- **Scheduling optimization tips** (buffer times, peak pricing)
- **Review request templates** (boost your Google reviews)
Just tell me: what's your business? (barbershop, salon, restaurant, tattoo studio, clinic, etc.)"""
class BookingBot(fp.PoeBot):
async def get_response(
self, request: fp.QueryRequest
) -> AsyncIterable[fp.PartialResponse]:
messages = [fp.ProtocolMessage(role="system", content=SYSTEM_PROMPT)]
for msg in request.query[-4:]:
messages.append(
fp.ProtocolMessage(role=msg.role, content=msg.content)
)
async for partial in fp.get_bot_response(
messages=messages,
bot_name="Claude-3.5-Sonnet",
api_key=request.access_key,
):
yield partial
async def get_settings(
self, setting: fp.SettingsRequest
) -> fp.SettingsResponse:
return fp.SettingsResponse(
introduction_message=INTRO_MESSAGE,
)
bot = BookingBot()
access_key = os.environ.get("POE_ACCESS_KEY", "")
bot_name = os.environ.get("POE_BOT_NAME", "BookingBrain")
app = fp.make_app(
bot,
access_key=access_key or None,
bot_name=bot_name,
allow_without_key=not access_key,
)