message.rb 586 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Whatsapp::Outgoing::Message < Whatsapp::Client
  3. attr_reader :phone_number_id, :recipient_number, :messages_api
  4. def initialize(access_token:, phone_number_id:, recipient_number:)
  5. super(access_token:)
  6. @phone_number_id = phone_number_id
  7. @recipient_number = recipient_number
  8. @messages_api = WhatsappSdk::Api::Messages.new client
  9. end
  10. def deliver
  11. raise NotImplementedError
  12. end
  13. def handle_response(response:)
  14. {
  15. id: response.data.messages.first.id,
  16. }
  17. end
  18. end