Skip to content

Interactive console

hailer-cli starts a Node.js REPL connected to Hailer. On login it fetches the list of available endpoints from the server and exposes them as the api object.

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

If --password is omitted you are prompted for it.

Arguments

ArgumentDescription
--userEmail address used to log in
--passwordPassword. Omit to be prompted
--hostBackend server. Defaults to the HOST environment variable, then https://api.hailer.com
--quietSuppress the login status line
--insecureSkip SSL certificate verification
--help, -hShow help and exit

The REPL environment

The prompt is a JavaScript REPL. These variables are available:

VariableDescription
apiAll endpoints as async functions, e.g. api.wall2.new_post(...), api.v3.activity.create(...)
resultResult of the last call
historyAll results as an array, newest first
errorLast error
upload(path)Upload a local file, returns the file id
cliThe underlying Client instance
help()Print usage and the full endpoint tree

The response of v2.core.init is also merged into the context, so state such as users, networks, and processes is available directly.

Tab completion works on the api tree. Typing a method without calling it prints its signature and documentation.

Examples

Create a wall post, then remove it using result:

javascript
await api.wall2.new_post({ subject: 'This is a wall post.', text: 'Made from the CLI.' })
await api.wall2.remove_post(result._id)

Upload a file and attach it to a post:

javascript
fileId = await upload('myfile.jpg')
await api.wall2.new_post({ subject: 'With attachment', text: 'File included.', files: [fileId] })

Live signals

The console prints signals from Hailer as they happen: new wall posts, comments, created activities, and discussion syncs are formatted; other signals are printed with their name and metadata.

Hailer Developer Documentation · v1.3.4