Home / Reference

Portal: integrations and automations

Updated for 1.0

The dash described here is now the console (an Angular app); incidents were renamed from tickets, and the portal API gained tokens, runs and CI/CD. See Migrating to 1.0. The concepts on this page still apply.

New: sign in to the portal and choose between the Orquestrador and the Dashboard. See Orchestrator.

The portal screens are currently in Brazilian Portuguese. Tab and button names are shown as they appear, with the English meaning in parentheses the first time. Message variables such as {{erro}} also keep their Portuguese names.

What exists today

The portal stores the integrations (Telegram, Teams, Slack, e-mail), registers destinations and has a visual automation editor (n8n style) that reacts to your logs, traces and metrics. Acknowledgement, escalation and more trigger and action types come in later phases (see the roadmap).

(Fake test credentials: that is why the integrations show "FALHOU" (failed), which is the provider's real answer.)

Enabling it

In a project that uses dash-obskitpy (--local dash-obskitpy or both):

obskitpy portal enable

The command generates the secrets, adds PostgreSQL and the portal API to the stack, updates the dash and shows the address and the administrator user. The first time it downloads the images and installs the portal (a few minutes).

Result Where
Integrations screen http://localhost:<DASH_PORT>/#integrations (the dash's Integrações tab)
API and interactive docs http://localhost:<PORTAL_PORT>/api/docs (default 8700)
Administrator credentials observability/.portal.env (outside git)

obskitpy portal password generates a new password for the administrator. The integrations data lives in the stack's pgdata volume; obskitpy down -v deletes everything, including the database.

Connect with Slack in one click

In the Integrações (Integrations) tab, the Conectar com Slack (Connect with Slack) button opens Slack, you authorize, and it returns to the dash. Then just choose the channel, the bot name (and icon) and use Salvar e enviar teste (Save and send a test).

The first time (and only then) the wizard asks for a 1-minute setup, because Slack requires each installation to have its own app:

  1. Click Criar o app no Slack (Create the app in Slack). The link opens Slack with the name, permissions and return URL already filled in; just confirm with Create.
  2. Copy the Client ID and the Client Secret (Basic Information → App Credentials) and paste them into the screen. The secret is stored encrypted.

After that, Conectar com Slack is a single click. Reconnecting the same workspace swaps the token and keeps the bot name.

What you configure How it works
Channel The list comes from Slack (public channels and private ones the bot is in). The bot can write to public channels without being invited (chat:write.public); in private channels, invite it with /invite.
Bot name and icon Every message goes out with the name and emoji you chose (chat:write.customize).

Why does the way back from Slack go through a GitHub Pages page?

Slack only accepts HTTPS return URLs (http://localhost is not accepted). Since obskitpy runs on your machine, the return goes through https://pedrowill-dev.github.io/obskitpy/oauth/slack-callback.html, a static page that only sends the browser back to the localhost you started from and stores nothing. It only forwards to localhost/127.0.0.1; the state is signed and expires in 10 minutes on your portal.

If your portal has an HTTPS address of its own, set OBSKITPY_PUBLIC_ORIGIN=https://obs.company.com in observability/.portal.env: the return from Slack goes straight to https://obs.company.com/api/v1/oauth/slack/callback and the GitHub Pages page is no longer used. (For another static return address, use OBSKITPY_OAUTH_RELAY.)

Slack through a webhook still exists

If you only want to post to a fixed channel, + Nova integração → Slack (+ New integration → Slack) with an Incoming Webhook is still valid and needs neither an app nor OAuth.

How to connect the other providers

Provider What you need Destination
Telegram A bot created with @BotFather (token) The chat ID (a number, or @channel). The bot can only write to people who have already talked to it.
Microsoft Teams A Teams Workflow ("Post to a channel when a webhook request is received"); paste the generated URL The channel is the workflow's
Slack (webhook) An Incoming Webhook from your Slack app The channel is the one chosen when creating the webhook. To connect with one click, see above
E-mail (SMTP) Server, port, user, password and sender. On Gmail: smtp.gmail.com:587 with an app password The recipient's e-mail

The Testar (Test) button validates the credentials (on Telegram, it confirms the token and the bot name) and, if you pick a destination, sends a test message. The result (OK or the reason for the failure) is recorded on the integration.

Connection, destination and contact are different things

This separation lets a rule stay valid when the channel or the person in charge changes.

Automations

Integrations only connect obskitpy to the world (Slack, Telegram, e-mail…). Automations say what to do with what your robots record. In the dash's Automações (Automations) tab you draw a flow, as in n8n:

Trigger (what to watch) → Condition (optional, picks the path) → Action (what to do).

  1. Click + Nova automação (+ New automation) and pick a ready-made template (or start blank).
  2. Drag steps from the palette onto the canvas (or click them) and connect them by pulling the dot on the right of one step to the left of the next. Click a step to adjust its fields in the right-hand panel.
  3. Salvar (Save), ▶ Testar (Test) and leave the Ativa (Active) switch on.
Step Type What it does
Erros nos logs (Errors in the logs) Trigger Fires with ERROR/CRITICAL logs above the limit in the window; has the outputs Disparou (fired) and Normalizou (recovered)
Etapas com falha (Failed spans) Trigger Fires with error spans (traces) above the limit
Automação parada (Automation stopped) Trigger Fires when no data arrives in the window (robot stuck or did not run)
A cada intervalo (Every interval) Trigger Runs every so often (good for summaries); the value is the error count in the interval
Condição (Condition) Logic Picks Sim (yes) or Não (no) by comparing the value, the window or the service name
Enviar aviso (Send notification) Action Sends a message to a destination (Slack channel, Telegram chat, e-mail…)
Abrir ticket (Open ticket) Action Opens an incident in Slack with buttons (see Tickets)

In messages you use variables: {{service}}, {{value}}, {{window}}, {{automation}}, {{event}} and {{time}}. For errors there are three more, filled with the most recent error in the window: {{erro}} (the exception type and message), {{origem}} (file:function:line) and {{trace}} (the Python traceback, limited to the last 1500 characters). With no error in the window (e.g. "Automação parada"), they are empty.

Code is always formatted as code: {{trace}}, {{erro}} and {{origem}} never go out as plain text. In Slack and Telegram the traceback goes in a code block (and short things, like the origin, as inline code); in Teams it goes in a monospace font; in e-mail it goes as plain text. Code you write by hand in the message with ``` also works in Slack.

Tickets (incidents) in Slack

Instead of just dropping a message in the channel, the automation can open a ticket: the Abrir ticket node (or the "Abrir ticket no Slack" template) creates a numbered incident (INC-0001) and posts a card in the channel with the status, the person in charge, occurrences, the error and the traceback in a code block, the AI's explanation, and the buttons Assumir (Take), Resolver (Resolve) and Reabrir (Reopen).

Turning on the buttons (once): Slack sends the clicks over a connection the portal itself opens (Socket Mode), so no public address is needed. In your Slack app at https://api.slack.com/apps:

  1. Socket Mode → turn it on.
  2. Basic Information → App-Level Tokens → Generate Token with the connections:write permission → copy the xapp-… token.
  3. Interactivity & Shortcuts → turn it on (no URL needed).
  4. Put it in observability/.portal.env and run uv run obskitpy portal enable:
OBSKITPY_SLACK_APP_TOKEN=xapp-...

Apps created by the new "Conectar com Slack" already come with Socket Mode and Interactivity turned on; only step 2 is missing. Without the token, the card goes out without buttons (the ticket and the Incidents tab work the same way). The buttons need no new bot permissions.

Who can click: anyone in the channel where the ticket was posted. In the dash, only operators and administrators.

AI explanation of the error ({{explicacao}})

obskitpy does not ship with a built-in AI or pick one for you: you use the AI of your choice, with your own key. The {{explicacao}} variable brings 1 or 2 sentences with the likely cause of the error and what to do, right in the Slack, Teams, Telegram or e-mail notification. With nothing configured, it stays empty and everything else works the same.

Supported providers (OBSKITPY_AI_PROVIDER):

Provider Value Default model (cheap) Notes
Google Gemini gemini (default) gemini-3.5-flash-lite a key from AI Studio
Anthropic (Claude) anthropic claude-haiku-5-5
OpenAI-compatible openai gpt-4.1-nano also serves Groq, OpenRouter, Ollama (local AI, no key), etc., by setting OBSKITPY_AI_URL

To turn it on, put this in observability/.portal.env (which stays outside git) and run uv run obskitpy portal enable:

OBSKITPY_AI_PROVIDER=gemini          # gemini | anthropic | openai
OBSKITPY_AI_KEY=your-key
# optional:
# OBSKITPY_AI_MODEL=gemini-3.5-flash-lite
# OBSKITPY_AI_URL=http://host.docker.internal:11434/v1   # only for "openai" (e.g. local Ollama)
# OBSKITPY_AI_DAILY_CAP=30

If you prefer a local AI, such as Ollama, nothing leaves your machine: use OBSKITPY_AI_PROVIDER=openai, OBSKITPY_AI_URL and OBSKITPY_AI_MODEL, with no key. With a cloud AI, only what is needed goes to the provider: the error line and the last lines of the traceback (see below), never the whole log.

Built to spend as little as possible (one call costs about 300 tokens):

  1. Only if you use the variable in a message. Without {{explicacao}}, the AI is never called.
  2. Cache per error: the same error (type + origin, ignoring numbers and ids) is explained once and reused for 7 days, including in reminders and tests.
  3. Minimal input: only the error line and the last 6 lines of the traceback (up to 600 characters), never the whole log.
  4. Short output: up to ~40 words, at most 120 tokens, minimal reasoning and temperature 0.
  5. A daily cap on calls (default 30, failures count). Past the cap, the notification goes out all the same, without the explanation.
  6. If it fails, it does not insist: it waits 10 minutes before trying again.

How it runs: the portal evaluates the triggers every 30 s by querying Elasticsearch. When a trigger goes over its limit, it walks the flow from the Disparou output; if it stays over, it repeats only after the "remind every" time (0 = never); when it goes back to normal, it walks the Normalizou output. Each trigger shows its live state on the canvas (● ok · valor 0, ● disparado) and the Execuções (Runs) tab keeps the result of each step. If Elasticsearch or a destination fails, the reason shows up and the rest of the flow continues.

Test runs the flow right now for real: the notifications are sent (with [Teste] in the title) and each step shows ✓ or ✗.

Who can do what

Administrators create and edit; operators test; viewers only look.

Security

Protection How
Secrets (tokens, webhook URLs, passwords) Encrypted in the database (Fernet) and never returned by the API: only the name of the stored field shows
Browser Session in an HttpOnly + SameSite=Strict cookie; actions that change data require the X-Obskitpy-Csrf header
Roles (RBAC) viewer reads; operator also tests integrations; admin creates, changes and removes, manages users and sees the audit log
Webhooks Only https and only the provider's domains (hooks.slack.com, *.logic.azure.com...). Addresses that resolve to the internal network are blocked (SSRF)
Login Passwords with scrypt; a limit of 5 attempts per minute per e-mail and IP
Provider errors Secrets are masked before any error is stored or shown
Audit Every action (login, create/change/remove, test) is recorded with the author and time

Local use

Like the rest of the stack, the portal is published only on 127.0.0.1 and uses HTTP. Do not expose it to the internet without a proxy with HTTPS in front (and OBSKITPY_COOKIE_SECURE=1). Elasticsearch still has security turned off.

API

Interactive documentation at /api/docs. Main routes:

Route Role What it does
GET /api/v1/health — Health of the portal and the database
POST /api/v1/auth/login · logout · GET /auth/me — / logged in Session
GET /api/v1/integrations/kinds logged in Catalog of providers and fields
GET/POST/PUT/DELETE /api/v1/integrations viewer / admin Connections to the providers
POST /api/v1/integrations/{id}/test operator Validates and, with destination_id, sends a test message
GET/POST/DELETE /api/v1/destinations viewer / admin Destinations
GET/POST/DELETE /api/v1/contacts · /contact-groups viewer / admin Contacts and groups
GET/POST/PUT/DELETE /api/v1/automations viewer / admin Automation flows (a graph of steps)
GET /api/v1/automations/nodes logged in Catalog of steps, fields and variables
POST /api/v1/automations/{id}/test operator Runs the flow now
GET /api/v1/automations/runs logged in Run history
GET /api/v1/tickets logged in Tickets (incidents); filter with ?status=open\|ack\|resolved
POST /api/v1/tickets/{id}/status operator Takes, resolves or reopens a ticket (action: ack, resolve, reopen)
GET/POST/DELETE /api/v1/users admin Users
GET /api/v1/audit admin Audit log

Data model

users, provider_connections, notification_destinations, contacts, contact_groups (with the link tables) and oauth_apps, automations, automation_runs, tickets and audit_events, in PostgreSQL through SQLAlchemy.

Roadmap

Planned, not implemented yet (the visual flow editor, the trigger engine and Slack tickets already exist):

Phase Deliverable
2. Delivery Message templates, workers with retry and deduplication, delivery history
3. More triggers and actions Triggers by metrics and by error signature; webhook, batch e-mail and wait actions
4. Operations Escalation, silencing and recovery
5. Multichannel Gmail OAuth connection and Teams through Graph (Slack through OAuth is already available)
7. Intelligence Cause suggestions and routing

One point to settle before the rules: today "Runs with errors" can stay at zero even with a recorded ConnectionError (an error handled inside the run). The alerting engine will need to distinguish a recorded error, a failed span and the final result of the run.

Troubleshooting

✎ Edit this page on GitHub