X Plugin
The X plugin lets Slack users ask Junior what people post on X about a topic, what an account posted recently, or what a linked post says. Junior calls the X API v2 from the sandbox.
The plugin is read-only. It uses one deployment-level app-only Bearer Token. X does not allow writes with app-only auth, so Junior cannot post, reply, like, repost, follow, or send DMs.
Install
Section titled “Install”Install the plugin package alongside @sentry/junior:
pnpm add @sentry/junior @sentry/junior-xdotcomRuntime setup
Section titled “Runtime setup”Add the package name to the plugin set exported from plugins.ts:
import { defineJuniorPlugins } from "@sentry/junior";
export const plugins = defineJuniorPlugins(["@sentry/junior-xdotcom"]);Config
Section titled “Config”Set deployment variables in the Junior environment, then redeploy.
Environment variables
Section titled “Environment variables”X_BEARER_TOKEN
X API app-only Bearer Token for read-only requests.
- Define: Set
X_BEARER_TOKENin the deployment environment - Required: Yes
- Environment override:
X_BEARER_TOKEN
Create an app in the X Developer Console and copy its Bearer Token. The console shows the token one time only.
Billing
Section titled “Billing”The X API is pay-per-use. There is no free read tier.
- X bills each post and user that a response returns against the app’s prepaid credits.
- X bills the same resource one time per UTC day.
- Set a monthly spending limit in the X Developer Console. When the app reaches the limit, X blocks requests until the next billing cycle.
- The bundled skill keeps requests small: it asks for the minimum page size and does not page unless the user asks for more results.
See X API pricing for current rates.
Auth model
Section titled “Auth model”- The plugin uses one deployment-level X app, not per-user OAuth.
- Junior keeps the real
X_BEARER_TOKENvalue on the host. - Sandbox requests to
api.x.comreceive a host-managedAuthorization: Bearer <token>header. - The sandbox never receives the token in env, files, or command arguments.
- Users do not connect individual X accounts to Junior.
What users can do
Section titled “What users can do”- Search recent posts (last 7 days) or the full archive.
- Count posts that match a query over time.
- Read a post from an
x.comortwitter.comlink, and read its replies. - Look up an account by handle, and read its recent posts and mentions.
Verify
Section titled “Verify”- Set
X_BEARER_TOKENand redeploy. - Ask Junior in a channel:
What has @XDevelopers posted this week? - Confirm the reply summarizes recent posts and links each post on
x.com.
Failure modes
Section titled “Failure modes”X_BEARER_TOKENmissing or invalid: X returns401 Unauthorized. Set the env var and redeploy.403 Forbidden: the endpoint needs user context, or the account is protected.429 Too Many Requests: X is throttling, or the app has no credits left or reached its spending limit. Add credits or raise the limit in the X Developer Console.- Write requests (post, like, follow, DM): app-only auth cannot do them, and the skill declines them.
Next step
Section titled “Next step”Review Credentials & OAuth and Security Hardening.