Integrating Your Application with Automateo: A Step-by-Step Guide
Published: 2024-07-01 14:09:02

This guide will help you integrate your application with [Automateo](https://automateo.app), allowing you to use it as your LLM backend. By following these steps, you'll be able to set up a workflow where your app can send user inputs to Automateo, process them using an LLM workflow, and retrieve the results.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvy241onvot0qfchg2jg.jpg)

## Step 1: Create an LLM Workflow in Automateo

1. **Log in to Automateo**: Access your Automateo dashboard by logging in with your credentials.
2. **Create a New Workflow**: Navigate to the workflows section and click on "Create New Workflow."
3. **Define Workflow Steps**: Add and configure the LLM steps for your workflow. Each step will define how the input data is processed.
4. **Generate Webhook URL**: Once your workflow is configured, Automateo will provide a unique webhook URL for this workflow.

## Step 2: Integrate Automateo with Your Application

1. **Prepare Your Application**: Ensure your application is ready to send webhook requests.
2. **Send Webhook Request**: From your application, send a webhook request to the Automateo workflow URL. This request should include the user input data that you want to process.

```sh
curl --location 'https://api.automateo.test/api/w/{YOUR_WORKFLOW_ID}' \
--header 'Authorization: Bearer {YOUR_AUTOMATEO_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
    "input": "Your user input data here - can also be JSON depending on the workflow configuation"
}'
```

## Step 3: Save the Workflow Execution ID

1. **Receive Execution ID**: Automateo will respond to your webhook request with a `workflow_execution_id`.
2. **Store Execution ID**: Save this `workflow_execution_id` in your application's database. This ID is important for linking the resulting data back to the user input.

```json
{
    "data": {
        "workflow_id": "604cf153-1c5f-4e6d-849b-6449fd7812b2",
        "status": "running",
        "debug_mode": false,
        "user_id": "3cfa14ca-c31f-4307-96a2-cae89a10621d",
        "id": "e34c2af5-571a-4543-8e59-a4cd30facbd1",
        "updated_at": "2024-06-14T18:18:56.000000Z",
        "created_at": "2024-06-14T18:18:56.000000Z"
    },
    "metadata": null
}
```

## Step 4: Workflow Execution by Automateo

1. **Automateo Processing**: Automateo will execute the workflow using the provided user input. The processing may take some time depending on the complexity of the workflow and the LLM steps involved.

## Step 5: Receive Processed Data from Automateo

1. **Define Webhook URL**: In your Automateo workflow, specify the webhook URL of your server where the processed data should be posted.
2. **Receive Data**: Automateo will post the resulting data to your server at the defined webhook URL once the workflow execution is complete.

## Step 6: Save the Resulting Data

1. **Handle Webhook Response**: Your server should be configured to handle incoming webhook responses from Automateo.
2. **Extract Data**: Extract the `workflow_execution_id` and the processed data from the webhook payload.
3. **Save to Database**: Save the `workflow_execution_id` and the `outputs` in your database, linking it to the original user input.

```json
{
  "workflow_id":"604cf153-1c5f-4e6d-849b-6449fd7812b2",
  "workflow_execution_id":"e34c2af5-571a-4543-8e59-a4cd30facbd1",
  "output": {
    "Summary":"The app idea to generate direc...",
    "Idea Scorer": {
      "ease":5
      "size":7
      "importance":8
    },
    "Idea Analysis": {
      "Primary Problem":"The primary problem this start...",
      "Target Audience":"Small retail business owners a...",
      "Unique Selling Proposition":"The app uses AI to generate pe..."
    }
  }
}
```

## Step 7: Display the Result to the User

1. **Retrieve Data**: Query your database to retrieve the processed data using the `workflow_execution_id`.
2. **Display to User**: Present the processed data to the user within your application interface.

## Example Workflow

To illustrate, let's consider an example where your application takes user-generated text, processes it through an LLM workflow in Automateo to convert it into emojis, and then displays the result  back to the user.

![Automateo Workflow to generate Emojis](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3olcamk1oxp2f0w4t6z8.png)

1. **User Input**: "my dog is eating an apple"
2. **Send Webhook Request**:
```json
{
  "input": "my dog is eating an apple"
}
```
3. **Receive Execution ID**:
```json
{
  "workflow_execution_id": "abc123"
}
```
4. **Automateo Processes Input**: The workflow converts text into emojis.
5. **Receive Processed Data**:
```json
{
  "workflow_execution_id": "abc123",
  "outputs": {
    "LLMNode": {
      "emojis": "🐶🍎"
    }
  }
}
```
6. **Save and Retrieve Data**: Store the result and display "🐶🍎" to the user.

## Conclusion

By following these steps, you can integrate Automateo into your application, leveraging its LLM capabilities to enhance your users' experience. Automateo handles the complex processing, allowing you to focus on building great features for your users. If you have any questions or need further assistance, please refer to our [support documentation](https://docs.automateo.app) or contact our [support](https://x.com/SaaSNoCap).

Happy automating!