# Yapay zekâ asistanınıza yapıştırın / Paste into your AI assistant

Bu sayfadaki istemi ChatGPT, Claude veya kullandığınız başka bir yapay zekâ
asistanına yapıştırın. Köşeli parantezli yerleri kendi sisteminizle doldurun.
Asistan, Blinkerbot paketinin istediği 4 fonksiyonu sizin tablolarınıza göre
yazar. Kod, panelde otomatik test yeşil olmadan canlıya çıkamaz; yine de
yazılan kodu okuyup kendi test ortamınızda deneyin.

**İmza sırrınızı (whsec_…) ve veritabanı şifrenizi istemin içine asla
yazmayın.**

Copy the prompt below into ChatGPT, Claude or another assistant and fill in
the bracketed parts. **Never paste your signing secret (whsec_…) or database
password into the prompt.**

---

## Türkçe istem

```text
Sen deneyimli bir [PHP / Node.js / Python] geliştiricisisin. Randevu sistemimi
Blinkerbot'a bağlıyorum. Blinkerbot'un hazır paketi imza doğrulama, tekrar
koruması, test modu ve saat değişikliğini kendisi yapıyor; benden yalnız şu
fonksiyonları istiyor:

- listServices(): hizmet listesi -> [{id, name, duration_minutes, price?, staff?: [{id, name}]}]
- findSlots(q): q = {service_id, staff_id?, from, to, timezone, limit} -> o aralıktaki BOŞ saatler [{start, end, staff_id?}],
  en erkenden başlayarak en çok limit tane (paket ayrıca sıralayıp keser)
- createBooking(pdo/tx, b): b = {service_id, staff_id?, start, end, timezone, customer: {name, phone, email?}, channel, note?}
  -> {booking_id, status: "confirmed" | "pending", start?, end?, staff_id?}
- cancelBooking(pdo/tx, id): -> {booking_id, status: "cancelled"}; zaten iptal edilmişse de başarı dönsün
- getBooking(id) (isteğe bağlı): -> {booking_id, status: "confirmed" | "pending" | "cancelled", start, end, staff_id?} ya da null

Kurallar:
- Saatler ISO 8601 ve saat farkıyla olmalı (ör. 2026-11-20T14:00:00+03:00). Saat dilimim: [Europe/Istanbul].
- İş hatalarında yalnız şu kodlardan birini fırlat: slot_unavailable, invalid_service, invalid_staff,
  outside_hours, invalid_customer, booking_not_found, cancellation_not_allowed.
  (PHP: throw new BlinkerbotBookingError('slot_unavailable'); Node: throw new BookingError("..."); Python: raise BookingError("...")).
- createBooking ve cancelBooking bana verilen bağlantı/işlem (pdo/tx) üzerinde çalışsın;
  beginTransaction/commit/rollback ÇAĞIRMA, işlemi paket yönetiyor.
- Aynı saat aynı personel için doluysa slot_unavailable dön; çakışma kontrolünü aynı işlem içinde yap
  (MySQL'de SELECT ... FOR UPDATE ya da benzersiz kısıt).
- staff_id verilmezse uygun personeli sen seç; verilirse yalnız o personele bak, yoksa invalid_staff.
- Çalışma saati dışındaysa outside_hours; müşteri adı/telefonu eksik ya da geçersizse invalid_customer.
- SQL'de mutlaka hazırlanmış sorgu (prepared statement) kullan. Müşteri notunu kısalt (en çok 500 karakter).
- Ekrana hiçbir şey yazdırma (echo/print/console.log ile kişisel veri yok).

Veritabanım: [MySQL 8 / MariaDB / PostgreSQL / SQLite]
Tablolarım:
[CREATE TABLE ... ifadelerinizi buraya yapıştırın: hizmetler, personel, hangi personel hangi hizmeti verir,
 çalışma saatleri / izinler, randevular. Kişisel veri içeren gerçek satırları YAPIŞTIRMAYIN.]

Kurallarım: [ör. randevular 15 dakikalık aralıklarla başlar, pazar kapalıyız, aynı anda en çok 2 koltuk...]

Bana yalnız bu fonksiyonları içeren tek bir dosya ver ve her fonksiyonun hangi tabloyu okuduğunu/yazdığını
kısaca açıkla. Sonra bana kendi ortamımda deneyebileceğim 3 örnek senaryo yaz.
```

---

## English prompt

```text
You are an experienced [PHP / Node.js / Python] developer. I am connecting my
booking system to Blinkerbot. Blinkerbot's ready-made package already does the
signature check, idempotency, test mode and time changes; it only needs these
functions from me:

- listServices(): services -> [{id, name, duration_minutes, price?, staff?: [{id, name}]}]
- findSlots(q): q = {service_id, staff_id?, from, to, timezone, limit} -> FREE slots in that range [{start, end, staff_id?}],
  earliest first, at most limit of them (the package also sorts and cuts the list)
- createBooking(pdo/tx, b): b = {service_id, staff_id?, start, end, timezone, customer: {name, phone, email?}, channel, note?}
  -> {booking_id, status: "confirmed" | "pending", start?, end?, staff_id?}
- cancelBooking(pdo/tx, id): -> {booking_id, status: "cancelled"}; must also succeed when it is already cancelled
- getBooking(id) (optional): -> {booking_id, status: "confirmed" | "pending" | "cancelled", start, end, staff_id?} or null

Rules:
- Times are ISO 8601 with UTC offset (e.g. 2026-11-20T14:00:00+03:00). My time zone: [Europe/Istanbul].
- For business errors throw only one of: slot_unavailable, invalid_service, invalid_staff, outside_hours,
  invalid_customer, booking_not_found, cancellation_not_allowed
  (PHP: throw new BlinkerbotBookingError('slot_unavailable'); Node: throw new BookingError("..."); Python: raise BookingError("...")).
- createBooking and cancelBooking must use the connection/transaction they receive (pdo/tx);
  do NOT call beginTransaction/commit/rollback - the package manages the transaction.
- If the time is taken for that staff member, answer slot_unavailable; check for overlaps inside the same
  transaction (SELECT ... FOR UPDATE on MySQL, or a unique constraint).
- Without staff_id pick a free staff member yourself; with staff_id use only that person, unknown -> invalid_staff.
- Outside opening hours -> outside_hours; missing or invalid customer name/phone -> invalid_customer.
- Always use prepared statements. Truncate the customer note (max 500 characters).
- Print nothing (no echo/print/console.log with personal data).

My database: [MySQL 8 / MariaDB / PostgreSQL / SQLite]
My tables:
[paste your CREATE TABLE statements: services, staff, which staff gives which service, opening hours /
 days off, bookings. Do NOT paste real rows with personal data.]

My rules: [e.g. bookings start every 15 minutes, closed on Sundays, at most 2 chairs at the same time...]

Give me one file with only these functions and briefly explain which table each function reads/writes.
Then write 3 example scenarios I can try in my own environment.
```

---

Ardından / Then: run the connection test in the Blinkerbot panel, or locally
`node scripts/booking-connector/fake-blinkerbot.mjs test --url <your endpoint> --secret <whsec_…>`.
Full contract: `llms.txt` and `openapi.yaml`.
