CLI Overview
The Mention CLI provides a command-line interface for interacting with the Mention API. It allows you to manage alerts, mentions, and application data directly from your terminal.Installation
Install the Mention Python package:Authentication
The CLI requires an OAuth2 access token to authenticate with the Mention API. Set up authentication using environment variables:Required Environment Variables
Your Mention API OAuth2 access token
Optional Environment Variables
Default account ID for all commands (can be overridden with
--account-id flag)Custom API base URL (defaults to the official Mention API)
Request timeout in seconds
Setting Up Environment Variables
Linux/macOS
Add to your~/.bashrc, ~/.zshrc, or ~/.profile:
Windows (PowerShell)
Using a .env File
Create a.env file in your project directory:
Quick Start
Once configured, you can start using the CLI:Command Structure
The CLI uses a hierarchical command structure:Global Options
Account ID (can also be set via
MENTION_ACCOUNT_ID environment variable)Short form: -aOutput format. Available options:
json, tableShort form: -oDisplay the CLI version
Available Commands
The CLI provides the following command groups:app-data
Get application data including available sources and languages.alerts
Manage alerts for monitoring keywords and topics:list- List all alerts for an accountget- Get details of a specific alertcreate- Create a new alertdelete- Delete an alert
mentions
Manage mentions found by your alerts:list- List mentions for an alert with filteringget- Get a specific mentioncurate- Update mention properties (favorite, read, trashed, tone)mark-read- Mark all mentions as read for an alertstream- Stream all mentions with automatic pagination
Output Format
By default, all commands output JSON formatted data:Error Handling
The CLI provides clear error messages:Exit Codes
0- Success1- Error (configuration, API error, or general error)130- Interrupted (Ctrl+C)