Action Concepts & Best Practices

You’ve found documentation about extending the Transposit Developer Platform, which is accessible on request. In most cases, you can now set up and use Transposit without needing to extend the Transposit Developer Platform. Go here for the related docs and support.

An action is defined as a Developer Platform application. It implements functionality end-to-end, such as functionality for merging a change on Jenkins, getting the last 10 git commits, and updating the StatusPage incident page.

Concepts

An action application always consists of an execute operation and, optionally, an input operation.

Let's take a look at these operations.

The action template application has both the execute and the optional input prompt operation, and includes many of the best practices we reference here.

However, since the input prompt operation is optional, you may want to take a look at the List recent GitHub commits action, which is an action that only has an execute operation and is therefore a simpler example.

Best Practices

Debugging errors while creating action applications

Most of your debugging with happen by adding print() statements in Python and viewing them in the Monitor section on the left sidebar in the Transposit Developer Platform.

Some server side errors may be only viewable by the Transposit team at this time, please feel free to reach out to support if you are experiencing an error and don't see anything in the Monitor tab.

Sharing errors with users

Execute operation errors

This case is good for errors that involve API calls. It can also be used for validation.

Example: There is a bad API response and you want to let the user know something is wrong. Since the modal is already closed, you will need to share it in the channel and logs:

    workflow.log.fail("Failed to restart VM")

See the catching API errors section below for an example.

Catching API errors

Here’s an example from the GitHub commit log action:

    try:
        commits = api.run("this.list_commits", {
            "repo": repo_name,
            "owner": owner_name
        })
    except ValueError as ex:
        message = "Error from GitHub API: " + str(ex)
        return workflow.log.fail("Error performing an action: {message}")

Input operation errors

A way to provide a good error message to the user in the input prompt step (for example, if you have no options in your dropdown for the. user to choose from) is coming soon.