feat: Line Channel (#2904)
- Ability to configure line bots as a channel in chatwoot - Receive a message sent to the line bot in chatwoot - Ability to reply to line users from chatwoot fixes: #2738
This commit is contained in:
39
app/models/channel/line.rb
Normal file
39
app/models/channel/line.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_line
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# line_channel_secret :string not null
|
||||
# line_channel_token :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# line_channel_id :string not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_line_on_line_channel_id (line_channel_id) UNIQUE
|
||||
#
|
||||
|
||||
class Channel::Line < ApplicationRecord
|
||||
include Channelable
|
||||
|
||||
self.table_name = 'channel_line'
|
||||
EDITABLE_ATTRS = [:line_channel_id, :line_channel_secret, :line_channel_token].freeze
|
||||
|
||||
validates :line_channel_id, uniqueness: true, presence: true
|
||||
validates :line_channel_secret, presence: true
|
||||
validates :line_channel_token, presence: true
|
||||
|
||||
def name
|
||||
'LINE'
|
||||
end
|
||||
|
||||
def client
|
||||
@client ||= Line::Bot::Client.new do |config|
|
||||
config.channel_id = line_channel_id
|
||||
config.channel_secret = line_channel_secret
|
||||
config.channel_token = line_channel_token
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user