Module: Frontapp::Client::Channels

Included in:
Frontapp::Client
Defined in:
lib/frontapp/client/channels.rb

Instance Method Summary collapse

Instance Method Details

#channels(params = {}) ⇒ Object



5
6
7
# File 'lib/frontapp/client/channels.rb', line 5

def channels(params = {})
  list("channels", params)
end

#create_channel!(inbox_id, params = {}) ⇒ Object

Only custom channels can be created through the api!

Parameters Name Type Description


inbox_id string Id of the inbox into which the channel messages will go


Allowed attributes: Name Type Description


type enum Type of the channel. settings object settings.webhook_url string (optional) custom type only. URL to which will be sent the replies of a custom message.




52
53
54
55
# File 'lib/frontapp/client/channels.rb', line 52

def create_channel!(inbox_id, params = {})
  cleaned = params.permit(:type, { settings: [:webhook_url] })
  create("inboxes/#{inbox_id}/channels", cleaned)
end

#get_channel(channel_id) ⇒ Object

Parameters Name Type Description


channel_id string Id of the requested channel




14
15
16
# File 'lib/frontapp/client/channels.rb', line 14

def get_channel(channel_id)
  get("channels/#{channel_id}")
end

#get_channel_inbox(channel_id) ⇒ Object

Parameters Name Type Description


channel_id string Id of the requested channel




62
63
64
# File 'lib/frontapp/client/channels.rb', line 62

def get_channel_inbox(channel_id)
  get("channels/#{channel_id}/inbox")
end

#update_channel!(channel_id, params = {}) ⇒ Object

Only custom channels can be updated through the api!

Parameters Name Type Description


channel_id string Id of the requested channel


Allowed attributes: Name Type Description


settings object settings.webhook_url string (optional) custom type only. URL to which will be sent the replies of a custom message.




32
33
34
35
# File 'lib/frontapp/client/channels.rb', line 32

def update_channel!(channel_id, params = {})
  cleaned = params.permit({ settings: [:webhook_url] })
  update("channels/#{channel_id}", cleaned)
end