triggers.rb 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. Trigger.create_or_update(
  3. name: 'auto reply (on new tickets)',
  4. condition: {
  5. 'ticket.action' => {
  6. 'operator' => 'is',
  7. 'value' => 'create',
  8. },
  9. 'ticket.state_id' => {
  10. 'operator' => 'is not',
  11. 'value' => Ticket::State.by_category(:closed).first.id,
  12. },
  13. 'article.type_id' => {
  14. 'operator' => 'is',
  15. 'value' => [
  16. Ticket::Article::Type.lookup(name: 'email').id,
  17. Ticket::Article::Type.lookup(name: 'phone').id,
  18. Ticket::Article::Type.lookup(name: 'web').id,
  19. ],
  20. },
  21. 'article.sender_id' => {
  22. 'operator' => 'is',
  23. 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
  24. },
  25. },
  26. perform: {
  27. 'notification.email' => {
  28. 'body' => '<div>Your request <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
  29. <br/>
  30. <div>To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password):
  31. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  32. </div>
  33. <br/>
  34. <div>Your #{config.product_name} Team</div>
  35. <br/>
  36. <div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
  37. 'recipient' => 'article_last_sender',
  38. 'subject' => 'Thanks for your inquiry (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  39. },
  40. },
  41. activator: 'action',
  42. execution_condition_mode: 'selective',
  43. active: true,
  44. created_by_id: 1,
  45. updated_by_id: 1,
  46. )
  47. Trigger.create_or_update(
  48. name: 'auto reply (on follow-up of tickets)',
  49. condition: {
  50. 'ticket.action' => {
  51. 'operator' => 'is',
  52. 'value' => 'update',
  53. },
  54. 'article.sender_id' => {
  55. 'operator' => 'is',
  56. 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
  57. },
  58. 'article.type_id' => {
  59. 'operator' => 'is',
  60. 'value' => [
  61. Ticket::Article::Type.lookup(name: 'email').id,
  62. Ticket::Article::Type.lookup(name: 'phone').id,
  63. Ticket::Article::Type.lookup(name: 'web').id,
  64. ],
  65. },
  66. },
  67. perform: {
  68. 'notification.email' => {
  69. 'body' => '<div>Your follow-up for <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
  70. <br/>
  71. <div>To provide additional information, please reply to this email or click on the following link:
  72. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  73. </div>
  74. <br/>
  75. <div>Your #{config.product_name} Team</div>
  76. <br/>
  77. <div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
  78. 'recipient' => 'article_last_sender',
  79. 'subject' => 'Thanks for your follow-up (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  80. },
  81. },
  82. activator: 'action',
  83. execution_condition_mode: 'selective',
  84. active: false,
  85. created_by_id: 1,
  86. updated_by_id: 1,
  87. )
  88. Trigger.create_or_update(
  89. name: 'customer notification (on owner change)',
  90. condition: {
  91. 'ticket.owner_id' => {
  92. 'operator' => 'has changed',
  93. 'pre_condition' => 'current_user.id',
  94. 'value' => '',
  95. 'value_completion' => '',
  96. }
  97. },
  98. perform: {
  99. 'notification.email' => {
  100. 'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
  101. <br/>
  102. <p>To provide additional information, please reply to this email or click on the following link:
  103. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  104. </p>
  105. <br/>
  106. <p><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></p>',
  107. 'recipient' => 'ticket_customer',
  108. 'subject' => 'Owner has changed (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  109. },
  110. },
  111. activator: 'action',
  112. execution_condition_mode: 'selective',
  113. active: false,
  114. created_by_id: 1,
  115. updated_by_id: 1,
  116. )