Commands

The command rhub --help list all available core commands. Here follows the currently available command list:

Command

Description

status

Shows the authentication status.

login

Authenticates your Reactivehub account (you'll be redirected to the console admin to issue your auth code).

add:event

Creates a new event config YAML in the /events folder in the directory where the command was executed.

add:filter

Adds a new filter to an event.

add:action

Adds a Cloud Service action to an Event Filter.

add:trigger

Adds a new trigger for a given action's outcome

deploy

Deploy all events to your Reactivehub namespace API.

test

Test your event YAML config files.

status

rhub status

Shows the login status, user authenticated and namespace.

add:event

rhub add:event

Creates a new event YAML file in the /events folder, it starts an interactive flow that asks for required information to fill the YAML properties:

Property

Description

id

The event id, this is used to map the event url: POST https://{namespace}.reactivehub.io/event/{id}

name

The event display name at the dashboard.

eventGroup

Event grouping strategy for organization purposes only.

model

Event payload model, it always should be an object, arrays are not allowed. Define the object property and types as YAML key/value properties.

YAML Example:

events/payment.payment-received.YAML
id: payment-received
name: Payment Received
eventGroup: payment
model:
id: String
customerId: String
billing:
date: Date
amount: Number
subscriptionPlanId: String
recurring: String

After running the rhub deploy command the event is available at your api:

POST https://{namespace}.reactivehub.io/event/payment-received
Body:
{
id: 'my-payment-id',
customerId: 'my-customer-id',
billing: {
date: 'the-billing-date',
amount: 888,
subscriptionPlanId: 'my-subscription-plan-id'
}
}

add:filter

rhub add:filter

By default, all events have an on-event filter created with a null condition, that means that this filter runs every time the event API endpoint is called. The configuration properties are:

Property

Description

id

Filter unique id.

name

Dashboard's display name.

condition

Query conditions, if this property is null this filter is run every time the event API endpoint is called. More about filter conditions.

YAML Example

You can find the filter configuration in the event YAML file under the filters property; this property must always be an array of filters.

events/payment.payment-received.YAML
id: payment-received
name: Payment Received
eventGroup: payment
model:
id: String
customerId: String
billing:
date: Date
amount: Number
subscriptionPlanId: String
recurring: String
filters:
-
id: 'on-event'
name: 'on-event'
condition: null
-
id: 'yearly-plan'
name: 'Yearly Plan'
condition: billing.recurring = 'yearly'

In this example the event has two filters, one with the null condition executes every time the event is called, the other only when the billing.recurring property in the payload is equal to 'yearly'.

add:action

Adds an action to a event filter. Check the CLI actions section for full examples.

rhub add:action {eventId} {filterId} {type} {action}

Property

Description

eventId

Full event id path (group + eventId).

Example: For an event named payment-received in the payment group, the command would looks like payment.payment-received

filterId

The event filter id to apply.

type

Action type. Check the CLI actions section for full examples.

action

Action to perform. Check the CLI actions section for full examples.

add:trigger

Adds a trigger event to be called upon success or failure of an action.

rhub add:trigger {triggerEvent} {eventId} {filterId} {actionId}

Property

Description

triggerEvent

The condition in which the trigger will be called. At the moment, we support success conditions (onSuccess) and failure conditions (onFailure).

eventId

Full event id path (group + eventId).

Example: For an event named payment-received in the payment group, the command would looks like payment.payment-received.

filterId

The event filter id to apply.

actionId

The action to which the trigger applies to.

deploy

rhub deploy

All events are deployed under your namespace ({namespace}.reactivehub.io/events). the rhub deploy command will check and send to our servers all the YAML configuration files under the /events folder in the directory where the command was executed.

test

rhub test

Validates all the YAML configuration files under the /events folder in the directory where the command was executed.