Neurotic Pantaloon Maker
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    tela-clipublic

    TELA CLI

    Tela CLI is eases interaction with a Tela Server from the command line.

    Installation

    NPM

    Tela CLI is a Node application and can be installed directly from npm:

    npm install -g tela-cli

    Then, you should be able to execute:

    tela-cli --help

    Manual Installation

    Assuming that we are inside the folder of the application, we just have to install the project with npm:

    npm install

    Then, we are ready to use the CLI tool:

    node /bin/cli --help

    Connection to a Tela Server

    Connection

    In order to create a connection with our Tela Server, execute:

    tela-cli connect <host> [<port>]

    For example, using the public server:

    tela-cli connect tela.herokuapp.com

    This command will create a session in the server, and write it into a .tela file, which stores the details of the connection.

    Disconnection

    Disconnection from the Tela Server can be achieve by executing:

    tela-cli disconnect

    This will delete the session from the server, as well as all its associated tokens.

    Executing Actions

    Actions can be executed with the execute command:

    tela-cli execute <module> <action> [<param1>=<value1> [<param2>=<value2> ...]]

    The result is printed into the system output, encoded as JSON. This allows to use the Tela CLI along with console commands. For example, save the results into a file:

    tela-cli execute <module> <action> > result.txt

    Or format the JSON output:

    tela-cli execute <module> <action> | jq

    Scheduling

    Schedule an Action

    In order to schedule an action, execute the schedule command, followed by the delay of execution (in seconds) and the same arguments than the execute command:

    tela-cli schedule <delay> <module> <action> [<param1>=<value1> [<param2>=<value2> ...]]

    The information of the scheduled task, as well as the result of its execution, will be outputted to the console.

    Get the Scheduled Actions

    It is possible to retrieve all the actions that the authorized user has scheduled, by running:

    tela-cli scheduled

    Cancel Scheduled Action(s)

    It is possible to stop the scheduled execution of an action using the cancel command:

    tela-cli cancel (<scheduled_action_id> | all)

    If an ID is provided, only that action will be cancelled. In case all is supplied, all the actions scheduled by the authorized user will be cancelled.

    Help

    To obtain all the available modules and actions configured in the Tela Server we are connected to, execute:

    tela-cli help

    Or, just for a certain module:

    tela-cli help <module>

    Note: the help command returns all the modules and actions configured within the Tela Server. Some of them might not be supported in this CLI tool.

    Modules

    Configuring Modules

    Modules might have specific properties which can be configured, by executing:

    tela-cli configure <module> <property> <value>

    Linking & Unlinking Modules

    Linking a module is the process of obtaining an access token for it, and storing it in our Tela session. This process is only needed if the module requires a token.

    tela-cli link <module>

    On the other hand, the unlink command deletes the module token from the session:

    tela-cli unlink <module>

    Supported Modules

    Instagram

    The Instagram module requires the configuration properties clientId and clientSecret, which can be obtained creating an Instagram Application, with the redirect URI http://127.0.0.1:8082.

    Setting Up
    tela-cli connect <host> <port>
    tela-cli configure instagram clientId <client_id>
    tela-cli configure instagram clientSecret <client_secret>
    tela-cli link instagram
    Executing Actions

    Once the Instagram module has been set up, you can execute actions with:

    tela-cli execute instagram <action> [<param1>=<value1> [<param2>=<value2> ...]]

    For example:

    # Obtain info about the logged user 
    tela-cli execute instagram self
     
    # Search a user 
    tela-cli execute instagram user username=themedizine

    Twitter

    The Instagram module requires the configuration properties apiKey and apiSecret, which can be obtained creating a Twitter Application, with the redirect URI http://127.0.0.1:8082.

    Setting Up
    tela-cli connect <host> <port>
    tela-cli configure twitter apiKey <api_key>
    tela-cli configure twitter apiSecret <api_secret>
    tela-cli link twitter
    Executing Actions

    Once the Twitter module has been set up, you can execute actions with:

    tela-cli execute twitter <action> [<param1>=<value1> [<param2>=<value2> ...]]

    For example:

    # Obtain info about the logged user 
    tela-cli execute twitter self

    Keywords

    none

    install

    npm i tela-cli

    Downloadsweekly downloads

    35

    version

    1.0.2

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar