facebook.rb 757 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Kayako::Post::Channel::Facebook < Sequencer::Unit::Import::Kayako::Post::Channel::Base
  3. def mapping
  4. super.merge(
  5. message_id: original_post['id'],
  6. to: to,
  7. body: original_post['contents'],
  8. )
  9. end
  10. private
  11. def article_type_name
  12. return 'facebook direct-message' if original_post['resource_type'] == 'facebook_message'
  13. return 'facebook feed comment' if original_post['resource_type'] == 'facebook_post_comment'
  14. 'facebook feed post'
  15. end
  16. def identify_key
  17. 'facebook_id'
  18. end
  19. def to
  20. return if original_post['recipient'].nil?
  21. original_post['recipient'][identify_key]
  22. end
  23. end