Connery Docs
WebsiteGitHubJoin Private Beta
  • Docs
  • SDK
  • Changelog
  • Get started
    • Introduction
    • Core concepts
    • Open-source plugins
  • Guides
    • Create a plugin
    • Use a plugin
  • CLI reference
    • connery dev init
    • connery dev add-action
  • Advanced
    • Plugin server
Powered by GitBook
On this page
  • 1. Create a new GitHub repository
  • 2. Set up development environment
  • 3. Initialize the plugin repository
  • 4. Install dependencies
  • 5. Add a new action to the plugin (optional)
  • 6. Implement the action (optional)
  • 7. Start the plugin server
  • 8. Run the action (optional)
  • 9. Commit the files

Was this helpful?

  1. Guides

Create a plugin

Learn how to create a new plugin with actions.

PreviousOpen-source pluginsNextUse a plugin

Last updated 5 months ago

Was this helpful?

1. Create a new GitHub repository

The repository will be used to store the plugin code and configuration.

Steps to create a repository

Open the and follow the instructions below.

  1. Select the Owner of the repository.

  2. Enter the Repository name. This is also the name of your future plugin. We recommend using the snake case naming convention. For example, if you decide to call your plugin My first plugin, the repository name should be my-first-plugin.

  3. Select the Public repository visibility.

  4. Select the Add a README file option to initialize the repository with a README file. It will also create a new default branch for the repository.

  5. Choose the MIT License as the license for the repository.

  6. Please ensure the branch name is main as it is used across the docs. You can use any branch name but must be aware of it when following the docs.

  7. Click the Create repository button.

2. Set up development environment

3. Initialize the plugin repository

Use the CLI command to initialize the plugin repository with all the necessary files and configuration.

npx connery@latest dev init

This command will also create a sample action for you to explore and test.

4. Install dependencies

5. Add a new action to the plugin (optional)

npx connery@latest dev add-action

6. Implement the action (optional)

Open the ./src/actions directory and find the newly created action file, define the input and output parameters of the action and implement the logic of the action in the handler function.

Install additional NPM packages if required
npm install axios --save

In the same way, you can install any other NPM package.

7. Start the plugin server

8. Run the action (optional)

Let's run the plugin's sample action to see how it works. This is helpful for testing the action during the development process.

Use the following command to run the action from the plugin server. You should receive a response with the result of the action execution. The plugin server must be running to run the action.

curl -X 'POST' \
  'http://localhost:4201/api/actions/sampleAction/run' \
  -H 'accept: application/json' \
  -H 'x-api-key: 123456' \
  -H 'Content-Type: application/json' \
  -d '{
  "input": {
    "number1": "1",
    "number2": "2"
  }
}'
Command explanation

9. Commit the files

Run the following command to commit and push all the files to GitHub.

git add . && git commit -m "Init plugin repository" && git push origin main

Make sure you delete all the secrets you might be using during testing before pushing the changes to the repository.

Use the CLI command to add a new action to the plugin.

Use the sample action as an example and draw inspiration from .

During the development, you may need to install additional packages. For example, the package to make HTTP requests to external APIs. To install it and add it to the ./package.json file, run the following command:

In this example, we use the URL, http://localhost:4201, along with the sample action name, sampleAction, which was generated during initialization.

The action expects input parameters number1 and number2. Additionally, we use the default to authenticate the request.

connery dev add-action
existing open-source plugins
axios
plugin server
GitHub repository creation page
connery dev init

To continue, you must install all the dependencies defined in the ./package.json file. Run the following command to install the dependencies.

npm install
API Key

Open the plugin repository in GitHub Codespaces or clone it on your local machine.

More about GitHub Codespaces

GitHub Codespace is the fastest way to start a development environment without installing additional software on your machine.

Use the green Code button in the top right corner of your repository. Then open the Codespaces tab and click Create codespace on main. It will start the codespace creation process.

GitHub Codespaces are for personal accounts.

By default, a codespace stops running after of inactivity to safe resources.

free of charge for 120 hours per month
30 minutes

Run the following command to start the plugin server.

npm start

Check the documentation to learn more.

plugin server