Ir al contenido

Slack

import { Aside } from ‘@astrojs/starlight/components’;

Mandá un artifact a Slack — un mensaje, un snapshot renderizado, o un PDF — a demanda, de forma programada, o ante un evento.

Slack es una conexión a nivel workspace: conectá una app de OAuth de Slack una vez por workspace (un bot token, guardado encriptado), y cualquier artifact de ese workspace puede entregar a Slack. Un workspace puede tener varias conexiones con nombre (por ejemplo team, alerts).

1. GET /v1/workspaces/{id}/connections/slack/install?connection=team&returnUrl=…
2. Open the returned URL and authorize the Slack app.
3. Slack redirects to /v1/oauth/slack/callback; the bot token is stored.
4. List channels: GET /v1/workspaces/{id}/connections/team/slack/channels

Los scopes del bot incluyen chat:write, files:write, y im:write (DMs). Si la entrega de DM falla con missing_scope en una conexión más vieja, reconectá Slack.

Desde Home, abrí una pestaña de página y usá la sección Deliver del Inspector — elegí email, Slack o Telegram, seleccioná un canal de Slack desde el picker buscable y enviá al instante (POST /v1/artifacts/{id}/deliver). Si Slack no está conectado, Connect inicia OAuth desde el mismo panel.

Por API:

POST /v1/artifacts/{id}/share/slack:

{ "connection": "team", "targetType": "channel", "channelId": "C0123456789", "mode": "snapshot", "message": "Latest numbers" }

Para mandar un DM a un usuario:

{ "connection": "team", "targetType": "dm", "slackUserId": "U0123456789", "mode": "pdf" }
  • mode: message (texto + botón de link), snapshot (PNG), pdf, o both.
  • Los posts en canales necesitan owner/editor; cualquier viewer puede mandarse un DM a sí mismo.

Usá un job con action: "slack":

{
"artifact_id": "art_abc123",
"action": "slack",
"schedule": "0 9 * * 1",
"config": { "connection": "team", "channelId": "C0123456789", "mode": "snapshot" }
}