update automation rules payload for developer docs

This commit is contained in:
Tanmay Deep Sharma
2025-05-15 14:49:26 +07:00
parent c56c1489d5
commit 97c3da6f93
6 changed files with 209 additions and 123 deletions
+2
View File
@@ -223,3 +223,5 @@ contact_conversation_message:
$ref: ./resource/contact_conversation_message.yml
contact_conversations_response:
$ref: ./resource/contact_conversations_response.yml
contactable_inboxes_response:
$ref: ./resource/contactable_inboxes_response.yml
@@ -1,53 +1,82 @@
type: object
properties:
payload:
type: array
items:
type: object
properties:
id:
type: integer
description: The ID of the automation rule
event_name:
type: string
description: Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)
enum:
- conversation_created
- conversation_updated
- message_created
example: message_created
name:
type: string
description: The name of the rule
example: Add label on message create event
description:
type: string
description: Description to give more context about the rule
example: Add label support and sales on message create event if incoming message content contains text help
active:
type: boolean
description: Enable/disable automation rule
actions:
type: array
description: Array of actions which we perform when condition matches
items:
type: object
example:
action_name: add_label
action_params:
- support
- sales
conditions:
type: array
description: Array of conditions on which conversation/message filter would work
items:
type: object
example:
attribute_key: content
filter_operator: contains
values:
- help
query_operator: nil
account_id:
type: integer
description: Account Id
oneOf:
- type: array
items:
$ref: '#/components/schemas/automation_rule_item'
description: Array of automation rules (for listing endpoint)
- $ref: '#/components/schemas/automation_rule_item'
description: Single automation rule (for show/create/update endpoints)
# Schema for an individual automation rule (used by all automation rule endpoints)
automation_rule_item:
type: object
properties:
id:
type: integer
description: The ID of the automation rule
account_id:
type: integer
description: Account Id
name:
type: string
description: The name of the rule
example: Add label on message create event
description:
type: string
description: Description to give more context about the rule
example: Add label support and sales on message create event if incoming message content contains text help
event_name:
type: string
description: Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)
enum:
- conversation_created
- conversation_updated
- message_created
example: message_created
conditions:
type: array
description: Array of conditions on which conversation/message filter would work
items:
type: object
properties:
values:
type: array
items:
type: string
attribute_key:
type: string
query_operator:
type: string
filter_operator:
type: string
example:
attribute_key: content
filter_operator: contains
values:
- help
query_operator: nil
actions:
type: array
description: Array of actions which we perform when condition matches
items:
type: object
properties:
action_name:
type: string
action_params:
type: array
items:
type: string
example:
action_name: add_label
action_params:
- support
- sales
created_on:
type: integer
description: The timestamp when the rule was created
active:
type: boolean
description: Enable/disable automation rule
@@ -0,0 +1,7 @@
type: object
properties:
payload:
type: array
items:
$ref: '#/components/schemas/contact_inbox'
description: List of contactable inboxes for the contact
@@ -14,10 +14,7 @@ responses:
content:
application/json:
schema:
type: array
description: Array of all automation rules
items:
$ref: '#/components/schemas/automation_rule'
$ref: '#/components/schemas/automation_rule'
'403':
description: Access denied
content:
@@ -20,7 +20,7 @@ get:
content:
application/json:
schema:
$ref: '#/components/schemas/contactable_inboxes'
$ref: '#/components/schemas/contactable_inboxes_response'
'401':
description: Authentication error
content:
+119 -68
View File
@@ -3298,7 +3298,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/contactable_inboxes"
"$ref": "#/components/schemas/contactable_inboxes_response"
}
}
}
@@ -3360,11 +3360,7 @@
"content": {
"application/json": {
"schema": {
"type": "array",
"description": "Array of all automation rules",
"items": {
"$ref": "#/components/schemas/automation_rule"
}
"$ref": "#/components/schemas/automation_rule"
}
}
}
@@ -7599,72 +7595,115 @@
"type": "object",
"properties": {
"payload": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The ID of the automation rule"
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/automation_rule_item"
},
"event_name": {
"type": "string",
"description": "Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)",
"enum": [
"conversation_created",
"conversation_updated",
"message_created"
"description": "Array of automation rules (for listing endpoint)"
},
{
"$ref": "#/components/schemas/automation_rule_item"
}
]
}
},
"automation_rule_item": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The ID of the automation rule"
},
"account_id": {
"type": "integer",
"description": "Account Id"
},
"name": {
"type": "string",
"description": "The name of the rule",
"example": "Add label on message create event"
},
"description": {
"type": "string",
"description": "Description to give more context about the rule",
"example": "Add label support and sales on message create event if incoming message content contains text help"
},
"event_name": {
"type": "string",
"description": "Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)",
"enum": [
"conversation_created",
"conversation_updated",
"message_created"
],
"example": "message_created"
},
"conditions": {
"type": "array",
"description": "Array of conditions on which conversation/message filter would work",
"items": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"type": "string"
}
},
"attribute_key": {
"type": "string"
},
"query_operator": {
"type": "string"
},
"filter_operator": {
"type": "string"
}
},
"example": {
"attribute_key": "content",
"filter_operator": "contains",
"values": [
"help"
],
"example": "message_created"
},
"name": {
"type": "string",
"description": "The name of the rule",
"example": "Add label on message create event"
},
"description": {
"type": "string",
"description": "Description to give more context about the rule",
"example": "Add label support and sales on message create event if incoming message content contains text help"
},
"active": {
"type": "boolean",
"description": "Enable/disable automation rule"
},
"actions": {
"type": "array",
"description": "Array of actions which we perform when condition matches",
"items": {
"type": "object",
"example": {
"action_name": "add_label",
"action_params": [
"support",
"sales"
]
}
}
},
"conditions": {
"type": "array",
"description": "Array of conditions on which conversation/message filter would work",
"items": {
"type": "object",
"example": {
"attribute_key": "content",
"filter_operator": "contains",
"values": [
"help"
],
"query_operator": "nil"
}
}
},
"account_id": {
"type": "integer",
"description": "Account Id"
"query_operator": "nil"
}
}
},
"actions": {
"type": "array",
"description": "Array of actions which we perform when condition matches",
"items": {
"type": "object",
"properties": {
"action_name": {
"type": "string"
},
"action_params": {
"type": "array",
"items": {
"type": "string"
}
}
},
"example": {
"action_name": "add_label",
"action_params": [
"support",
"sales"
]
}
}
},
"created_on": {
"type": "integer",
"description": "The timestamp when the rule was created"
},
"active": {
"type": "boolean",
"description": "Enable/disable automation rule"
}
}
}
@@ -11250,6 +11289,18 @@
"description": "List of conversations for the contact"
}
}
},
"contactable_inboxes_response": {
"type": "object",
"properties": {
"payload": {
"type": "array",
"items": {
"$ref": "#/components/schemas/contact_inbox"
},
"description": "List of contactable inboxes for the contact"
}
}
}
},
"parameters": {