BettikDocsSign in

Reference · the tools · gateway

subscribe_topic

Safe to repeat

Subscribe a session to a topic

What it does

Have the box deliver a topic's messages. push (the default): each message goes into one session as its next message, waking it if it is asleep; what is waiting goes together, and each delivery takes about half a minute. pull: the session reads them itself with read_topic, nothing is pushed -- for a busy topic. spawn: each message starts a NEW session with the brief given, optionally subscribed to a topic of its own named by a field of the message (child_key "call_id" makes topic <topic>/<call_id>), so one conversation's later messages reach the session having it. Every subscriber gets every message. A session subscribing itself passes its own id, from `bettik-session-id`. If the session later carries on as a new one, the subscription moves with it.

What it needs to know

topic
The topic: lowercase letters, digits, hyphens (`ci`, `email`, `cue`).
kind · optional
push (default), pull or spawn. One of push, pull, spawn.
session · optional
For push and pull: the session, by link, id (cse_ or session_) or name.
from · optional
now (default): only what is posted from here on. oldest: also every message the topic still keeps. One of now, oldest.
replace · optional
push: take the topic over -- its other push subscriptions go, and this one starts where the furthest behind of them was.
brief · optional
spawn: what each new session starts with, as complete as a start_session prompt. The message follows it.
title · optional
spawn: what each new session is called; {child}, {id}, {date} ("Fri Nov 6") and {time} ("5:00 PM") are filled in, in the timer's or person's zone. Default "<topic> <child>".
child_key · optional
spawn: the field of a message's data (dotted path) naming its own topic, under this one.
child_kind · optional
spawn: how the new session gets its own topic's messages. pull when speed matters (a call): delivery by push takes about half a minute each. One of push, pull.
model · optional
spawn: the model each new session runs on ("haiku", "sonnet", "opus" or a full id). Omit for the box's default. haiku suits a session that only talks and hands real work to other sessions.
box · optional
Which box: its name and account, "home.frank" or "jordan.northwind", or just "home" when only one of your boxes is called that. Omit it for your current box (switch_box changes it; list_boxes says which it is).
session_box · optional
The box this session runs on, if it runs on one of yours: its name, as the on-box instructions give it ("frankh90.hemlane"). With it, a call that names no box is checked against your current box.

Where it lands

On one of your boxes: the one named in box, or your default box when none is named.