Notebook: Execute Node

The Notebook: Execute Node allows a workflow to request an execution of one of your Losant Notebooks.

Notebook: Execute Node

This node does not wait for a notebook execution to complete; it only requests the execution of a notebook. If you want to react to the completion of a notebook in a workflow, use the Notebook Trigger.

Node Properties

There are four main properties to set for this node …

Notebook

First, choose which of your application’s notebooks you would like to execute. You may also provide a string template that resolves to a notebook ID to dynamically choose which notebook to execute.

Notebook Context

Next, define the context to pass to the notebook execution. Context may be provided one of four ways …

  • None: Provide no additional context to the execution.
  • JSON Template: Define the execution context inline as a JSON template.
  • Payload Path: Provide a payload path to an object that will serve as the execution context.
  • Full Payload: Provide the full workflow payload as context to the execution.

Time

Next, define the timestamp to use as the Query Time for the notebook execution. This can be defined a few different ways …

  • Use the time of the current payload: Use the time property of the current workflow payload as the query time. This is the default option.
  • Use the current time: Use the current time as the query time. This value will often be very similar to the timestamp on the current workflow payload, but can vary slightly depending on the length of time running the workflow takes. In cases of workflows kicked off by Device State Triggers responding to historical or future state reports, the current time can vary by hours or even days from the time on the current payload.
  • Use the time at the specified payload path: Select this option to provide a custom query time. When selected, you must provide a payload path to the desired query time. This value should conform to the same rules as a timestamp on a state report.

Response

Optionally, you may provide a payload path for where to store the response to the notebook execution request. Notebook execution requests can be rejected for a variety of reasons, so we recommend capturing this response to verify the execution request was successful.

Node Example

Given a response path of executionResponse, a successful execution request might look like:

{
  "executionResponse": {
    "success": true,
    "executionId":"51c40a11501297850136c5b13"
  },
  ...
}

Node Errors

Given a response path of executionResponse, a failed execution request might look like:

{
  "executionResponse": {
    "error": {
      "type": "NotFound",
      "message": "Notebook was not found"
    }
  },
  ...
}

There are two common errors that can occur with this node:

  • Notebook was not found: This means that the notebook you requested to execute was not found. It may have been deleted elsewhere, or you may be dynamically resolving to a notebook ID that does not exist.
  • No more notebook executions available at this time: This means that you are out of either total minutes available for notebook executions this billing period, or there are too many concurrent notebook executions currently running in your account.

Node Throttling and Limits

While the Notebook: Execute node itself does not have any built-in throttles or limits, the underlying notebook executions have various ones that can affect the use of this node. You can read more about them here.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.