lib/bobot/page.rb in bobot-3.0.7 vs lib/bobot/page.rb in bobot-3.5.0
- old
+ new
@@ -34,15 +34,17 @@
#
#####################################
def deliver(payload_template:, to:)
raise Bobot::FieldFormat.new('payload_template is required.') unless payload_template.present?
- job = Bobot::DeliverJob
- if Bobot.config.async
- job.perform_later(target_facebook_uid: to, access_token: page_access_token, payload_template: payload_template)
- else
- job.perform_now(target_facebook_uid: to, access_token: page_access_token, payload_template: payload_template)
- end
+ Bobot::Commander.deliver(
+ body: {
+ recipient: { id: to },
+ }.merge(payload_template),
+ query: {
+ access_token: page_access_token,
+ },
+ )
end
def sender_action(sender_action:, to: nil)
deliver(payload_template: { sender_action: sender_action }, to: to)
end