Skip to content

Hailer CLI

@hailer/cli is a Node.js package with two uses:

  • Interactive console - a REPL that connects to Hailer and lets you call any API endpoint from the terminal, with tab completion and live signals.
  • Programmatic usage - the Client class for writing your own integrations, bots, and scripts.

All backend RPC endpoints (see the endpoint reference) are available from both. The endpoint list is fetched from the server at connection time, so nothing is hardcoded in the package.

Install

For the interactive console, install globally:

bash
npm install -g @hailer/cli

For programmatic use, add it to your project:

bash
npm install @hailer/cli

Quick start

Open a console session (you are prompted for the password):

bash
hailer-cli --user you@example.com

Call an endpoint:

javascript
hailer> await api.wall2.new_post({ subject: 'Hello', text: 'Posted from the CLI.' })

Or do the same from a script:

javascript
const { Client } = require('@hailer/cli');

(async () => {
    const client = await Client.create({
        username: 'you@example.com',
        password: 'set-this',
    });

    const post = await client.request('wall2.new_post', [{ subject: 'Hello', text: 'Posted from a script.' }]);
    console.log('Post created:', post);

    client.disconnect();
})();

Scripts can also authenticate with a user API key instead of a password, see programmatic usage.

Hailer Developer Documentation · v1.3.4