arizuko › concepts › addressing
jid
A JID is the one address shape that every adapter uses for its chats and senders. The prefixes are telegram, discord, whatsapp, slack, email, github, gdrive, web for browser chats and hook for webhooks. Every address has the shape <platform>:<rest>. So one routing rule such as chat_jid=telegram:group/* matches every Telegram group and nothing else, and routes and grants can ignore the details of each platform.
The platform comes before the colon
Each platform names things in its own way. Telegram chat IDs are signed integers, and a negative number means a group. teled writes the kind into the JID and drops the minus sign. WhatsApp adds a server name, @g.us for groups and @s.whatsapp.net for DMs.
arizuko writes one shape over all of them. The platform goes before the colon. Everything after the colon belongs to the platform:
telegram:111/user/123 # telegram DM with user 123 through bot 111
telegram:group/1001234567 # telegram group, supergroup, or channel
discord:dm/456 # discord DM channel
whatsapp:789@g.us # whatsapp group
web:<folder>[/<suffix>] # browser chat at folder; URL token resolves to this JID
hook:<folder>/<source>[/...] # webhook ingest: folder is the destination, source is the agent-chosen label
A Telegram DM includes the numeric bot id from getMe. Each bot has a separate chat with the same user. The sender and pairing identity stay telegram:user/<user_id> across bot accounts.
Routes match a JID with globs
Routes match with the Go function path.Match. * matches any run of characters but stops at /, so each segment between slashes stays separate. ? matches one character, and [0-9] matches one digit. The same syntax works on every field:
match='chat_jid=telegram:group/*' # all telegram groups
match='chat_jid=discord:dm/*' # all discord DMs
match='chat_jid=whatsapp:*@g.us' # all whatsapp groups
match='sender=telegram:user/[0-9]*' # any numeric telegram user
The platform has its own segment, so platform=telegram means every Telegram chat of any kind.
A JID is a plain string in Go
In the code, a JID is a string. Two helpers in core/types.go split it. core.JidPlatform(jid) returns the part before the first colon, and core.JidRoom(jid) returns the part after it. Matching is path.Match against the glob of the route, the same call that router.RouteMatches makes. No parse step exists, and chats and senders have no separate types.
Each adapter owns the shapes of its platform
routd treats everything after platform: as an opaque string and only matches it with globs. Each adapter, such as teled/, discd/ and whapd/, parses and builds its own paths. A new platform, or a new kind inside an existing platform, is a change in one adapter. routd and the routes table do not change.
A colon after the first one stays in the rest
core.JidPlatform splits on the first colon and returns the part before it. The rest stays unchanged, so an ID that contains a colon does not break the split.
The reference lists every platform shape
reference/jid has the exact shape for every platform, the match keys and the glob rules. routing shows how routes match these addresses to folders.