Capabilities
Not every platform can do everything. Rather than reduce the message model to the lowest common denominator, Wingman exposes the full feature set and makes support checkable.
The catalogue
Capability is an enum, so a misspelled feature is a compile error rather than
a check that quietly answers false forever. Its members, with the readable
conversation property that asks about each:
Capability member |
Readable check |
|---|---|
Capability.RichText |
conversation.canUseRichText |
Capability.Buttons |
conversation.canSendButtons |
Capability.Selects |
conversation.canSendSelects |
Capability.Threads |
conversation.canUseThreads |
Capability.Reactions |
conversation.canSendReactions |
Capability.Ephemeral |
conversation.canSendEphemeral |
Capability.Typing |
conversation.canShowTyping |
Capability.EditMessage |
conversation.canEditMessages |
Capability.DeleteMessage |
conversation.canDeleteMessages |
Capability.FileUpload |
conversation.canUploadFiles |
Capability.FileDownload |
conversation.canDownloadFiles |
Capability.Images |
conversation.canSendImages |
Capability.History |
conversation.canReadHistory |
Capability.UserProfile |
conversation.canReadProfiles |
Capability.UserLookup |
conversation.canLookUpUsers |
Capability.SlashCommands |
conversation.canReceiveSlashCommands |
Capability.DirectMessages |
conversation.canSendDirectMessages |
Capability.Mentions |
conversation.canMentionUsers |
Capability.Subject |
conversation.canSetSubject |
Capability.IncludePeople |
conversation.canIncludePeople |
The enum's values are the readable strings ("buttons"), so logs and error
messages stay legible.
Checking before using
if (conversation.canSendEphemeral) {
await conversation.replyEphemeral("Only you see this.");
} else {
await conversation.replyInThread("(privately) …");
}
For this particular case the SDK already has the fallback: replyPrivately(msg)
tries an ephemeral message, then a direct message, then the conversation itself,
and returns { via, private } so a bot can see whether it actually stayed
private. Write the canSendEphemeral version only when the two branches should
say different things.
conversation.can(Capability.Ephemeral) is the same check in the general form.
Reach for it only when the feature being checked is itself a variable — a loop
over a list of capabilities, a diagnostic dump — and prefer the readable
property everywhere else.
What happens if you do not check
An unsupported operation throws UnsupportedCapabilityError. That is
deliberate: a silently dropped button is worse than a loud failure, because the
user is left staring at a message that promised a choice it never offered.
Capability.Mentions is an exception, and it is exempt on purpose. An
undeclared mentions does not throw — a mention degrades to @name text, which
reads correctly and simply notifies nobody. Check it when the notification is
the point — before a bot claims somebody was notified. See Mentions and direct messages.
Capability.Subject is exempt the same way: a message's subject is dropped
where the platform has no subject line, and only email
has one.
The check also runs on the message itself — reply() with a button on a
platform without buttons throws before anything is sent, rather than
delivering half a message.
What each platform declares
| Capability | Slack | Google Chat | Teams | |
|---|---|---|---|---|
richText, threads |
✅ | ✅ | ✅ | ✅ |
buttons, selects |
✅ | ✅ | ✅ | ❌ links only |
editMessage, deleteMessage |
✅ | ✅ (own) | ✅ (own) | ❌ sent is sent |
images, directMessages |
✅ | ✅ | ✅ | ✅ |
userProfile |
✅ | ✅ | ✅ | ❌ |
mentions |
✅ | ✅ | ✅ | ❌ @name |
subject |
❌ dropped | ❌ dropped | ❌ dropped | ✅ only here |
includePeople |
✅ group direct message | ❌ user auth only | ❌ needs Graph | ✅ Cc |
typing |
❌ no API | ❌ no API | ✅ only here | ❌ |
ephemeral |
✅ | ✅ (private messages) | ❌ none exist | ❌ |
reactions |
✅ | ❌ user auth only | ❌ read-only | ❌ |
fileUpload |
✅ | ❌ user auth only | ❌ needs a consent card | ✅ attachments |
fileDownload |
✅ with files:read |
✅ app scope | ✅ chats and images | ✅ for seven days |
history |
✅ | ⚠️ opt-in, admin approval | ❌ needs Graph | ❌ |
slashCommands |
✅ | ✅ | ❌ none exist | ❌ |
userLookup |
✅ | ❌ needs the Admin SDK | ❌ needs Graph | ❌ |
No two platforms have the same set, and the catalogue is not simply Slack's
feature list — typing exists only on Teams, userLookup only on Slack, and
subject only on email.
The two file capabilities are separate, and two platforms are why. Google Chat,
with its own app credentials, can read a file somebody uploaded to a space
and cannot post one; Teams is the same shape for a different reason — it can
read a file attached in a chat, and sending one needs a file-consent card the
user has to accept. (What Teams still cannot read is a file posted in a
channel: that lives in the team's SharePoint site and needs Microsoft Graph, so
download() refuses it by name rather than by silence.) A single "files" flag
would have made both of them claim something untrue whichever way it was set.
fileDownload is conversation.download(attachment) — the bytes behind a file
a user attached, as a Response:
for (const attachment of event.message.attachments ?? []) {
if (!conversation.canDownloadFiles) break;
const file = await conversation.download(attachment);
const bytes = await file.arrayBuffer();
}
Never fetch attachment.url yourself. It is not a public address on any
platform that has inbound files, and the failure is silent rather than loud:
Slack serves a private file only to the bot token, and answers a request without
it with its sign-in page under HTTP 200 — so the file the bot thinks it read is
a login form. Anything that is not the file throws AttachmentDownloadError
with a refusal on it: not-downloadable, unauthorized, too-large (8 MiB
by default, because the next line is usually arrayBuffer()) or unavailable.
Most bots want the bytes or the text rather than a Response, and want them for
the model. conversation.files() is that layer: each attachment with a name, its
bytes(), its text() and its real type() — read from the file itself, so a
file merely called photo.png is not treated as a picture — for one download
between them. A message with a file and no words is still a message:
const files = conversation.files();
if (!event.message.text.trim() && files.length === 0) return;
await responder.answer({ question: event.message.text, files }, conversation);
The model sees pictures as pictures and text files as text; PDFs and Office
documents are read where the deployment has the Workers AI binding, and named as
unreadable where it does not. To send a file back on every platform, use
conversation.replyWithFiles(message): it attaches the file where the platform
can (fileUpload), lists it in the message where it cannot, and tells the bot
which happened.
userLookup is conversation.userByEmail(address): finding the person who holds
an email address in the chat system the bot is answering in, which is what lets a
deployment be configured with addresses rather than with platform user ids. Slack
answers it with users.lookupByEmail and the users:read.email scope. Google
Chat and Microsoft Teams do not declare it, because reaching a directory at all
would mean the Google Workspace Admin SDK or Microsoft Graph, each behind an
administrator's consent the bot cannot assume it has. null there means nobody
holds that address — a routine answer, not an error. Where typing is unavailable, post a
"Working on it…" message and edit it later instead:
const pending = await conversation.reply("Looking that up…");
const answer = await responder.answer({ question }, conversation);
await conversation.update(pending.ref, answer.text);
The differences are why the check exists. A bot written like this runs on both:
if (conversation.canSendReactions) await conversation.react("eyes");
const history = conversation.canReadHistory ? await conversation.transcript(8) : [];
Capabilities are per deployment, not per platform: Google Chat's history
depends on whether a Workspace administrator has approved the extra scope, so the
adapter declares it only when GOOGLE_CHAT_HISTORY=enabled.
Related: Sending messages, Connecting Slack, Connecting Google Chat, Connecting Microsoft Teams.