Class: MessageQuickly::Api::ThreadSettings
- Inherits:
-
Base
- Object
- Base
- MessageQuickly::Api::ThreadSettings
show all
- Defined in:
- lib/message_quickly/api/thread_settings.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
client, #initialize
Class Method Details
.create(message) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/message_quickly/api/thread_settings.rb', line 5
def self.create(message)
ThreadSettings.new.create(message)
end
|
.delete ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/message_quickly/api/thread_settings.rb', line 20
def self.delete
ThreadSettings.new.delete
end
|
Instance Method Details
#create(message) ⇒ Object
29
30
31
32
33
|
# File 'lib/message_quickly/api/thread_settings.rb', line 29
def create(message)
request_string = "#{ENV['FACEBOOK_MESSENGER_PAGE_ID']}/thread_settings"
json = @client.post(request_string, { setting_type: 'call_to_actions', thread_state: 'new_thread', call_to_actions: [{ message: { text: message } }] })
json['result'] == "Successfully added new_thread's CTAs"
end
|
#delete ⇒ Object
35
36
37
38
39
|
# File 'lib/message_quickly/api/thread_settings.rb', line 35
def delete
request_string = "#{ENV['FACEBOOK_MESSENGER_PAGE_ID']}/thread_settings"
json = @client.post(request_string, { setting_type: 'call_to_actions', thread_state: 'new_thread', call_to_actions: [] })
json['result'] == "Successfully removed all new_thread's CTAs"
end
|