### Start documentation server Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Install and run the documentation site locally. ```bash cd packages/docs yarn install yarn dev ``` -------------------------------- ### Install and Start Automatisch Source: https://github.com/automatisch/automatisch/blob/main/README.md Use these commands to clone the repository and launch the service via Docker Compose. ```bash # Clone the repository git clone https://github.com/automatisch/automatisch.git # Go to the repository folder cd automatisch # Start docker compose up ``` -------------------------------- ### Configure and start frontend Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Initialize environment variables and start the web development server. ```bash cd packages/web cp .env-example .env ``` ```bash cd packages/web yarn dev ``` -------------------------------- ### Configure backend environment Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Initialize the backend environment variables from the example file. ```bash cd packages/backend cp .env-example .env ``` -------------------------------- ### Install dependencies Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Install required packages for both backend and web components. ```bash cd automatisch # Install backend dependencies cd packages/backend yarn install # Install web dependencies cd packages/web yarn install ``` -------------------------------- ### Start backend services Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Commands to run the main backend server and the worker process. ```bash cd packages/backend yarn dev ``` ```bash cd packages/backend yarn worker ``` -------------------------------- ### Install test dependencies Source: https://github.com/automatisch/automatisch/blob/main/packages/e2e-tests/README.md Install the required project dependencies using yarn. ```sh yarn install ``` -------------------------------- ### Run development server Source: https://github.com/automatisch/automatisch/blob/main/packages/web/README.md Starts the application in development mode with hot reloading enabled. ```bash yarn start ``` -------------------------------- ### Install Playwright browsers Source: https://github.com/automatisch/automatisch/blob/main/packages/e2e-tests/README.md Install the necessary browser binaries for running Playwright tests. ```sh npx playwright install ``` -------------------------------- ### Run Automatisch Services with Docker Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/guide/installation.md Commands to start the main and worker services using a shared environment file. ```bash docker run --env-file=./.env automatischio/automatisch ``` ```bash docker run --env-file=./.env -e WORKER=true automatischio/automatisch ``` -------------------------------- ### Initialize backend database Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Create the development database and run migrations. ```bash yarn db:create ``` ```bash yarn db:migrate ``` -------------------------------- ### Initialize authentication directory Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Creates the necessary directory and file structure for authentication configuration. ```bash mkdir auth touch auth/index.js ``` -------------------------------- ### Create app directory structure Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/app.md Commands to navigate to the apps directory and create the folder for the new integration. ```bash cd packages/backend/src/apps mkdir thecatapi ``` ```bash cd thecatapi touch index.js ``` -------------------------------- ### Build for production Source: https://github.com/automatisch/automatisch/blob/main/packages/web/README.md Bundles the application into the build folder with production optimizations. ```bash yarn build ``` -------------------------------- ### Clone the repository Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Initial step to download the Automatisch source code. ```bash git clone git@github.com:automatisch/automatisch.git ``` -------------------------------- ### Defining Action Metadata Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/actions.md Use defineAction to set up the action's name, key, description, and input arguments. ```javascript import defineAction from '../../../../helpers/define-action.js'; export default defineAction({ name: 'Mark the cat image as favorite', key: 'markCatImageAsFavorite', description: 'Marks the cat image as favorite.', arguments: [ { label: 'Image ID', key: 'imageId', type: 'string', required: true, description: 'The ID of the cat image you want to mark as favorite.', variables: true, }, ], async run($) { // TODO: Implement action! }, }); ``` -------------------------------- ### View the standard app folder structure Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/folder-structure.md Displays the typical directory layout for an Automatisch integration app. ```text . ├── actions ├── assets ├── auth ├── common ├── dynamic-data ├── index.js └── triggers ``` -------------------------------- ### Define verifyCredentials structure Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Create the initial structure for the verify-credentials.js file. ```javascript const verifyCredentials = async ($) => { // TODO: Implement verification of the credentials }; export default verifyCredentials; ``` -------------------------------- ### Run the project linter Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/contribution-guide.md Execute this command in the project root to ensure code quality and adherence to project standards. ```bash yarn lint ``` -------------------------------- ### Define app configuration Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/app.md The index.js file defines the app's metadata, authentication support, and API base URLs. ```javascript import defineApp from '../../helpers/define-app.js'; export default defineApp({ name: 'The cat API', key: 'thecatapi', iconUrl: '{BASE_URL}/apps/thecatapi/assets/favicon.svg', authDocUrl: '{DOCS_URL}/apps/thecatapi/connection', supportsConnections: true, baseUrl: 'https://thecatapi.com', apiBaseUrl: 'https://api.thecatapi.com', primaryColor: '#000000', }); ``` -------------------------------- ### Defining the Actions Index Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/actions.md Create an index file to export all your defined actions as an array. ```javascript import markCatImageAsFavorite from './mark-cat-image-as-favorite/index.js'; export default [markCatImageAsFavorite]; ``` -------------------------------- ### Navigate to E2E tests directory Source: https://github.com/automatisch/automatisch/blob/main/packages/e2e-tests/README.md Change the working directory to the e2e-tests package folder. ```sh cd packages/e2e-tests ``` -------------------------------- ### Implementing Action Logic Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/actions.md Implement the run function to perform HTTP requests and set the action result using setActionItem. ```javascript import defineAction from '../../../../helpers/define-action.js'; export default defineAction({ // ... async run($) { const requestPath = '/v1/favourites'; const imageId = $.step.parameters.imageId; const headers = { 'x-api-key': $.auth.data.apiKey, }; const response = await $.http.post( requestPath, { image_id: imageId }, { headers } ); $.setActionItem({ raw: response.data }); }, }); ``` -------------------------------- ### Configure authentication in app definition Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Add the auth property to the defineApp configuration in the app's index.js file to enable connection support. ```javascript import defineApp from '../../helpers/define-app.js'; import auth from './auth/index.js'; export default defineApp({ name: 'The cat API', key: 'thecatapi', iconUrl: '{BASE_URL}/apps/thecatapi/assets/favicon.svg', authDocUrl: '{DOCS_URL}/apps/thecatapi/connection', supportsConnections: true, baseUrl: 'https://thecatapi.com', apiBaseUrl: 'https://api.thecatapi.com', primaryColor: '#000000', auth, }); ``` -------------------------------- ### Create completion Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/apps/together-ai/actions.md Queries a language, code, or image model to generate content. ```APIDOC ## Create completion ### Description Queries a language, code, or image model. ``` -------------------------------- ### Seed backend user Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/development-setup.md Create a default user for development access. ```bash yarn db:seed:user ``` -------------------------------- ### Retrieve app base URL with $.app.baseUrl Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/global-variable.md Returns the base URL defined in the app configuration. ```javascript $.app.baseUrl; // https://thecatapi.com ``` -------------------------------- ### Implement isStillVerified logic Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Create the is-still-verified.js file to perform the validation check. The method must return a truthy value if credentials are valid. ```javascript import verifyCredentials from './verify-credentials.js'; const isStillVerified = async ($) => { await verifyCredentials($); return true; }; export default isStillVerified; ``` -------------------------------- ### Environment Variable Template Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/guide/installation.md The required environment variables for configuring the application. ```bash APP_ENV=production HOST= PROTOCOL= PORT= ENCRYPTION_KEY= WEBHOOK_SECRET_KEY= APP_SECRET_KEY= POSTGRES_HOST= POSTGRES_PORT= POSTGRES_DATABASE= POSTGRES_USERNAME= POSTGRES_PASSWORD= POSTGRES_ENABLE_SSL= REDIS_HOST= REDIS_PORT= REDIS_USERNAME= REDIS_PASSWORD= REDIS_TLS= ``` -------------------------------- ### Display repository directory structure Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/repository-structure.md Visual representation of the monorepo file hierarchy. ```text . ├── packages │   ├── backend │   ├── docs │   ├── e2e-tests │   └── web ``` -------------------------------- ### Implement authentication logic Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Perform an HTTP request to validate credentials and set the required screenName in the auth data. ```javascript const verifyCredentials = async ($) => { await $.http.get('/v1/images/search'); await $.auth.set({ screenName: $.auth.data.screenName, }); }; export default verifyCredentials; ``` -------------------------------- ### Implement Trigger Logic with Pagination Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/triggers.md Implements the run function to fetch paginated data from an API and push items to Automatisch. Ensure data is pushed in reverse-chronological order and includes a unique internalId. ```javascript import defineTrigger from '../../../../helpers/define-trigger.js'; export default defineTrigger({ // ... async run($) { let page = 0; let response; const headers = { 'x-api-key': $.auth.data.apiKey, }; do { let requestPath = `/v1/images/search?page=${page}&limit=10&order=DESC`; response = await $.http.get(requestPath, { headers }); response.data.forEach((image) => { const dataItem = { raw: image, meta: { internalId: image.id }, }; $.pushTriggerItem(dataItem); }); page += 1; } while (response.data.length >= 10); }, }); ``` -------------------------------- ### Upgrade Automatisch with Docker Compose Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/guide/installation.md Commands to update the local repository and rebuild containers to apply the latest changes. ```bash git pull origin main ``` ```bash docker compose up --force-recreate --build ``` -------------------------------- ### Registering Actions in the App Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/actions.md Add the actions module to your main app definition file to register them with the integration. ```javascript import defineApp from '../../helpers/define-app.js'; import auth from './auth/index.js'; import triggers from './triggers/index.js'; import actions from './actions/index.js'; export default defineApp({ name: 'The cat API', key: 'thecatapi', iconUrl: '{BASE_URL}/apps/thecatapi/assets/favicon.svg', authDocUrl: '{DOCS_URL}/apps/thecatapi/connection', supportsConnections: true, baseUrl: 'https://thecatapi.com', apiBaseUrl: 'https://api.thecatapi.com', primaryColor: '#000000', auth, triggers actions }); ``` -------------------------------- ### Access step parameters with $.step.parameters Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/global-variable.md Retrieves parameters configured by users in the UI for triggers and actions. ```javascript $.step.parameters; // { key: 'value' } ``` -------------------------------- ### Retrieve API base URL with $.app.apiBaseUrl Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/global-variable.md Returns the API base URL defined in the app configuration. ```javascript $.app.apiBaseUrl; // https://api.thecatapi.com ``` -------------------------------- ### Set authentication data with $.auth.set Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/global-variable.md Stores authentication credentials in the database. Data is encrypted before storage and can be retrieved via $.auth.data. ```javascript await $.auth.set({ key: 'value', }); ``` -------------------------------- ### Create a feature branch Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/contributing/contribution-guide.md Use this command to create a new branch for your feature development based on the main branch. ```bash git checkout -b feature/feature-description ``` -------------------------------- ### Define a Trigger Structure Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/triggers.md Initializes a trigger definition with metadata including name, key, and polling interval. ```javascript import defineTrigger from '../../../../helpers/define-trigger.js'; export default defineTrigger({ name: 'Search cat images', key: 'searchCatImages', pollInterval: 15, description: 'Triggers when there is a new cat image.', async run($) { // TODO: Implement trigger! }, }); ``` -------------------------------- ### Define authentication fields Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Exports the authentication fields configuration, including required keys for API interaction and UI identification. ```javascript export default { fields: [ { key: 'screenName', label: 'Screen Name', type: 'string', required: true, readOnly: false, value: null, placeholder: null, description: 'Screen name of your connection to be used on Automatisch UI.', clickToCopy: false, }, { key: 'apiKey', label: 'API Key', type: 'string', required: true, readOnly: false, value: null, placeholder: null, description: 'API key of the cat API service.', clickToCopy: false, }, ], }; ``` -------------------------------- ### Export triggers in the triggers index file Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/triggers.md Create a triggers index file that exports an array of all defined trigger modules. ```javascript import searchCatImages from './search-cat-images/index.js'; export default [searchCatImages]; ``` -------------------------------- ### Register triggers in the app configuration Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/triggers.md Import the triggers module and include it in the defineApp configuration object. ```javascript import defineApp from '../../helpers/define-app.js'; import auth from './auth/index.js'; import triggers from './triggers/index.js'; export default defineApp({ name: 'The cat API', key: 'thecatapi', iconUrl: '{BASE_URL}/apps/thecatapi/assets/favicon.svg', authDocUrl: '{DOCS_URL}/apps/thecatapi/connection', supportsConnections: true, baseUrl: 'https://thecatapi.com', apiBaseUrl: 'https://api.thecatapi.com', primaryColor: '#000000', auth, triggers }); ``` -------------------------------- ### Register verifyCredentials method Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/auth.md Add the verifyCredentials method to the auth configuration object in auth/index.js. ```javascript import verifyCredentials from './verify-credentials.js'; export default { fields: [ // ... ], verifyCredentials, }; ``` -------------------------------- ### Create chat completion Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/apps/together-ai/actions.md Queries a chat model to generate a response based on the provided input. ```APIDOC ## Create chat completion ### Description Queries a chat model. ``` -------------------------------- ### Retrieve authentication fields with $.app.auth.fields Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/build-integrations/global-variable.md Accesses the fields defined in the authentication section of the app. ```javascript $.app.auth.fields; ``` -------------------------------- ### Generate Random Secret Keys Source: https://github.com/automatisch/automatisch/blob/main/packages/docs/pages/guide/installation.md Command to generate a secure random string for encryption and webhook keys. ```bash openssl rand -base64 36 ```