microsoft_teams.rb 988 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Webhook::PreDefined::MicrosoftTeams < Webhook::PreDefined
  3. def name
  4. __('Microsoft Teams Notifications')
  5. end
  6. # rubocop:disable Lint/InterpolationCheck
  7. def custom_payload
  8. {
  9. '@type': 'MessageCard',
  10. '@context': 'http://schema.org/extensions',
  11. themeColor: '#{ticket.current_state_color}',
  12. title: '#{ticket.title}',
  13. text: '#{notification.message}',
  14. sections: [
  15. {
  16. text: '#{notification.changes}'
  17. },
  18. {
  19. text: '#{notification.body}'
  20. }
  21. ],
  22. potentialAction: [
  23. {
  24. targets: [
  25. {
  26. os: 'default',
  27. uri: '#{notification.link}'
  28. }
  29. ],
  30. '@type': 'OpenUri',
  31. name: 'Ticket##{ticket.number}'
  32. }
  33. ]
  34. }
  35. end
  36. # rubocop:enable Lint/InterpolationCheck
  37. end