Class: HighLevel::Resources::ConversationAi

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/conversation_ai.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#create_action(agent_id:, body:, **_opts) ⇒ Object

Attach Action to Agent

Creates and attach a new action for an AI agent. Actions define specific tasks or behaviors that the agent can perform, such as booking appointments, sending follow-ups, or collecting information.



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/conversation_ai.rb', line 12

def create_action(agent_id:, body:, **_opts)
  request(
    method: :post,
    path: "/conversation-ai/agents/#{agent_id}/actions",
    security: ["bearer"],
    body: body
  )
end

#create_agent(body:, **_opts) ⇒ Object

Create an Agent

Creates a new AI agent for the location. The agent will be created with the specified configuration including name, role, actions, and behavior settings.



81
82
83
84
85
86
87
88
# File 'lib/high_level/resources/conversation_ai.rb', line 81

def create_agent(body:, **_opts)
  request(
    method: :post,
    path: "/conversation-ai/agents",
    security: ["bearer"],
    body: body
  )
end

#delete_action(action_id:, agent_id:, **_opts) ⇒ Object

Remove Action from Agent

Permanently deletes an action. This will remove the action from all associated agents and cannot be undone.



58
59
60
61
62
63
64
# File 'lib/high_level/resources/conversation_ai.rb', line 58

def delete_action(action_id:, agent_id:, **_opts)
  request(
    method: :delete,
    path: "/conversation-ai/agents/#{agent_id}/actions/#{action_id}",
    security: ["bearer"]
  )
end

#delete_agent(agent_id:, **_opts) ⇒ Object

Delete Agent

Deletes an AI agent permanently. This action cannot be undone. All associated configurations and conversation history will be removed.



128
129
130
131
132
133
134
# File 'lib/high_level/resources/conversation_ai.rb', line 128

def delete_agent(agent_id:, **_opts)
  request(
    method: :delete,
    path: "/conversation-ai/agents/#{agent_id}",
    security: ["bearer"]
  )
end

#get_action_by_id(action_id:, agent_id:, **_opts) ⇒ Object

Get Action by ID

Retrieves detailed information about a specific action using its unique identifier. Returns the action configuration, associated agents, and performance metrics.



35
36
37
38
39
40
41
# File 'lib/high_level/resources/conversation_ai.rb', line 35

def get_action_by_id(action_id:, agent_id:, **_opts)
  request(
    method: :get,
    path: "/conversation-ai/agents/#{agent_id}/actions/#{action_id}",
    security: ["bearer"]
  )
end

#get_agent(agent_id:, **_opts) ⇒ Object

Get Agent

Retrieves a specific AI agent by its ID. Returns the complete agent configuration including name, status, actions, and settings.



105
106
107
108
109
110
111
# File 'lib/high_level/resources/conversation_ai.rb', line 105

def get_agent(agent_id:, **_opts)
  request(
    method: :get,
    path: "/conversation-ai/agents/#{agent_id}",
    security: ["bearer"]
  )
end

#get_generation_details(message_id: nil, source: nil, **_opts) ⇒ Object

Get the generation details

Retrieves detailed information about AI responses including the System Prompt, Conversation history, Knowledge base, website, FAQ chunks, and Rich Text chunks.



139
140
141
142
143
144
145
146
# File 'lib/high_level/resources/conversation_ai.rb', line 139

def get_generation_details(message_id: nil, source: nil, **_opts)
  request(
    method: :get,
    path: "/conversation-ai/generations",
    security: ["bearer"],
    params: { "messageId" => message_id, "source" => source }.compact
  )
end

#list_actions(agent_id:, **_opts) ⇒ Object

List Actions for an Agent

List for actions for an agent



24
25
26
27
28
29
30
# File 'lib/high_level/resources/conversation_ai.rb', line 24

def list_actions(agent_id:, **_opts)
  request(
    method: :get,
    path: "/conversation-ai/agents/#{agent_id}/actions/list",
    security: ["bearer"]
  )
end

#search_agent(start_after: nil, limit: nil, query: nil, **_opts) ⇒ Object

Search Agents

Searches for AI agents based on various criteria including name, status, and configuration. Supports advanced filtering and full-text search capabilities.



93
94
95
96
97
98
99
100
# File 'lib/high_level/resources/conversation_ai.rb', line 93

def search_agent(start_after: nil, limit: nil, query: nil, **_opts)
  request(
    method: :get,
    path: "/conversation-ai/agents/search",
    security: ["bearer"],
    params: { "startAfter" => start_after, "limit" => limit, "query" => query }.compact
  )
end

#update_action(action_id:, agent_id:, body:, **_opts) ⇒ Object

Update Action

Updates an existing action’s configuration. This includes modifying the action name, description, trigger conditions, and behavior settings.



46
47
48
49
50
51
52
53
# File 'lib/high_level/resources/conversation_ai.rb', line 46

def update_action(action_id:, agent_id:, body:, **_opts)
  request(
    method: :put,
    path: "/conversation-ai/agents/#{agent_id}/actions/#{action_id}",
    security: ["bearer"],
    body: body
  )
end

#update_agent(agent_id:, body:, **_opts) ⇒ Object

Update Agent

Updates an existing AI agent’s configuration. All fields in the agent configuration can be updated including name, status, actions, and behavior settings.



116
117
118
119
120
121
122
123
# File 'lib/high_level/resources/conversation_ai.rb', line 116

def update_agent(agent_id:, body:, **_opts)
  request(
    method: :put,
    path: "/conversation-ai/agents/#{agent_id}",
    security: ["bearer"],
    body: body
  )
end

#update_followup_settings(agent_id:, body:, **_opts) ⇒ Object

Update Followup Settings

Update the followup settings for an action



69
70
71
72
73
74
75
76
# File 'lib/high_level/resources/conversation_ai.rb', line 69

def update_followup_settings(agent_id:, body:, **_opts)
  request(
    method: :patch,
    path: "/conversation-ai/agents/#{agent_id}/followup-settings",
    security: ["bearer"],
    body: body
  )
end