feat: Add native support for CSML in agent_bot API (#4913)
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
# Table name: agent_bots
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# bot_config :jsonb
|
||||
# bot_type :integer default(0)
|
||||
# description :string
|
||||
# name :string
|
||||
# outgoing_url :string
|
||||
@@ -27,6 +29,9 @@ class AgentBot < ApplicationRecord
|
||||
has_many :inboxes, through: :agent_bot_inboxes
|
||||
has_many :messages, as: :sender, dependent: :restrict_with_exception
|
||||
belongs_to :account, optional: true
|
||||
enum bot_type: { webhook: 0, csml: 1 }
|
||||
|
||||
validate :validate_agent_bot_config
|
||||
|
||||
def available_name
|
||||
name
|
||||
@@ -48,4 +53,10 @@ class AgentBot < ApplicationRecord
|
||||
type: 'agent_bot'
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_agent_bot_config
|
||||
errors.add(:bot_config, 'Invalid Bot Configuration') unless AgentBots::ValidateBotService.new(agent_bot: self).perform
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user