socialbuffer
v0.1.0
Published
Queue markdown-based social posts to Buffer for X and LinkedIn from the terminal.
Downloads
8
Maintainers
Readme
socialbuffer
Minimal CLI for turning markdown files into queued Buffer posts for X and LinkedIn.
socialbuffer is the public name and primary command. tweetx remains available as a backward-compatible alias for now.
Run from source
Clone the repo, create a local .env, and run the CLI directly from source:
nvm use
cp .env.example .env
node ./bin/socialbuffer.js --help
node ./bin/socialbuffer.js post --file ./example-post.md --dry-runThe root .env is loaded automatically, so source usage works without a global install.
Node 20 is the supported runtime for development and CI.
Global install
Install the CLI globally so socialbuffer is available from any directory:
npm install -g .When run outside this repo, socialbuffer looks for config in this order:
$SOCIALBUFFER_ENV_FILE
$TWEETX_ENV_FILE
$XDG_CONFIG_HOME/socialbuffer/.env
~/.config/socialbuffer/.env
~/.socialbuffer/.env
~/.config/tweetx/.env
~/.tweetx/.env
./.envUse ~/.config/socialbuffer/.env for the public config path. The older tweetx config paths still work as legacy fallbacks.
Discover your channel
List Buffer channels:
node ./bin/socialbuffer.js channelsList only X/Twitter channels:
node ./bin/socialbuffer.js channels --service twitterList only LinkedIn channels:
node ./bin/socialbuffer.js channels --service linkedinWith a global install, the same commands become:
socialbuffer channels --service twitter
socialbuffer channels --service linkedinFirst command
node ./bin/socialbuffer.js post --file ./post.md --dry-runSetup
Set these environment variables in one of the supported env files:
BUFFER_API_KEY=your_buffer_api_key
BUFFER_X_CHANNEL_ID=your_buffer_x_channel_id
BUFFER_LINKEDIN_CHANNEL_ID=your_buffer_linkedin_channel_id
X_BEARER_TOKEN=your_x_bearer_tokenX_BEARER_TOKEN is only needed for the read-only analytics command.
Usage
Queue an X post in Buffer:
socialbuffer post --file ./post.mdQueue a LinkedIn post in Buffer:
socialbuffer post --platform linkedin --file ./post.mdQueue a post with one image:
socialbuffer post --file ./post.md --image ./shot.pngQueue a post with one remote image URL:
socialbuffer post --file ./post.md --image-url https://example.com/shot.pngShare immediately:
socialbuffer post --file ./post.md --mode shareNowPreview the payload without sending anything:
socialbuffer post --file ./post.md --dry-runRead X analytics:
socialbuffer analytics --username xdevelopersNotes
- The first version reads the markdown file as source text and flattens markdown formatting before publish.
channelsuses Buffer's GraphQL API so it works with the API key from Buffer's API settings page.- The CLI auto-loads values from global config files and then lets the current directory's
.envoverride them. postdefaults to platformx. Use--platform linkedinto target the configured LinkedIn channel.analyticsuses the X API directly and expectsX_BEARER_TOKENin.envor a supported global env file.BUFFER_CHANNEL_IDremains supported as a legacy fallback for X only.- YAML frontmatter is stripped if present at the top of the file.
- The current image path supports one local image or one remote image URL.
Built alongside DocsALot: convert your commits into documentation, social media posts on autopilot.
