---
title: "Add a new automation rule"
method: POST
path: "/v1/workspaces/{workspace_id}/automation_rules"
tags: ["Automation rules"]
---

# Add a new automation rule

`POST /v1/workspaces/{workspace_id}/automation_rules`

## Request

- Base URL: `https://api.oxvo.com`
- URL: `https://api.oxvo.com/v1/workspaces/{workspace_id}/automation_rules`
- Auth: API key in header `api_access_token`

Add a new automation rule to account

## Request body

- AutomationRuleCreateUpdatePayload
  - `name` string: Rule name
  - `description` string: The description about the automation and actions
  - `event_name` 'conversation_created' | 'conversation_updated' | 'conversation_resolved' | 'message_created': The event when you want to execute the automation actions
  - `active` boolean: Enable/disable automation rule
  - `actions` object[]: Array of actions which you want to perform when condition matches, e.g add label support if message contains content help.
  - `conditions` object[]: Array of conditions on which conversation filter would work, e.g message content contains text help.

## Response `200`

Success

- AutomationRule
  - `payload` union: Response payload that contains automation rule(s)
    - AutomationRuleItem[]: Array of automation rules (for listing endpoint)
      - `id` integer: The ID of the automation rule
      - `account_id` integer: Account Id
      - `name` string: The name of the rule
      - `description` string: Description to give more context about the rule
      - `event_name` 'conversation_created' | 'conversation_updated' | 'message_created': Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)
      - `conditions` object[]: Array of conditions on which conversation/message filter would work
        - `values` string[]
        - `attribute_key` string
        - `query_operator` string
        - `filter_operator` string
      - `actions` object[]: Array of actions which we perform when condition matches
        - `action_name` string
        - `action_params` string[]
      - `created_on` integer: The timestamp when the rule was created
      - `active` boolean: Enable/disable automation rule
    - object: Single automation rule (for show/create/update endpoints)
      - `id` integer: The ID of the automation rule
      - `account_id` integer: Account Id
      - `name` string: The name of the rule
      - `description` string: Description to give more context about the rule
      - `event_name` 'conversation_created' | 'conversation_updated' | 'message_created': Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)
      - `conditions` object[]: Array of conditions on which conversation/message filter would work
        - `values` string[]
        - `attribute_key` string
        - `query_operator` string
        - `filter_operator` string
      - `actions` object[]: Array of actions which we perform when condition matches
        - `action_name` string
        - `action_params` string[]
      - `created_on` integer: The timestamp when the rule was created
      - `active` boolean: Enable/disable automation rule

## Other responses

- `403`: Access denied

---

[API](https://skmtc.dev/oxvo/apis/oxvo-apis.md) · [All operations](https://skmtc.dev/oxvo/apis/oxvo-apis/llms.txt) · [OpenAPI document](https://skmtc.dev/oxvo/apis/oxvo-apis/revisions/9a8448cbd1fe?raw)
