back
loading skill details...
MANDATORY recipe for every Caffeine build that posts to X (Twitter) from a canister. The supported path is the `x-client` mops package (X API v2) over outbound…
Posting to X with x-client
Motoko bindings for the X API v2,
generated from X's OpenAPI spec. The write path is TweetsApi.createPosts
(POST /2/tweets); the request model is TweetCreateRequest.
Backend
A minimal canister that posts a tweet on behalf of a user holding an OAuth 2.0
bearer token (token acquisition/refresh is canister-side — see below). Non-
replicated is the default, so you just supply the token; every optional field
must be present, and null means "not supplied":
import { createPosts } "mo:x-client/Apis/TweetsApi";
import { type TweetCreateRequest } "mo:x-client/Models/TweetCreateRequest";
import { defaultConfig } "mo:x-client/Config";don't have the plugin yet? install it then click "run inline in claude" again.