chatwoot.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /** Realistic Chatwoot webhook payloads used across the test suite. */
  2. export const incomingEmailMessage = {
  3. event: 'message_created',
  4. id: 90210,
  5. message_type: 'incoming',
  6. content_type: 'incoming_email',
  7. content: 'Dzień dobry, czy gaz R1234yf pasuje do mojego Golfa VII z 2016 roku?',
  8. private: false,
  9. conversation: {
  10. id: 1311,
  11. inbox_id: 1,
  12. status: 'open',
  13. channel: 'Channel::Email',
  14. labels: [],
  15. custom_attributes: {},
  16. additional_attributes: {
  17. source: 'email',
  18. mail_subject: 'Pytanie o klimatyzację',
  19. },
  20. meta: {
  21. sender: { id: 332, name: 'Jan Kowalski', email: 'jan.kowalski@example.com' },
  22. },
  23. contact_inbox: { source_id: 'jan.kowalski@example.com' },
  24. },
  25. sender: { id: 332, name: 'Jan Kowalski', email: 'jan.kowalski@example.com' },
  26. attachments: [],
  27. };
  28. export const outgoingMessage = {
  29. ...incomingEmailMessage,
  30. id: 90211,
  31. message_type: 'outgoing',
  32. };
  33. export const privateNote = {
  34. ...incomingEmailMessage,
  35. id: 90212,
  36. private: true,
  37. };
  38. export const statusUpdate = {
  39. event: 'conversation_status_changed',
  40. id: 90213,
  41. conversation: { id: 1311 },
  42. };
  43. export const missingConversationId = {
  44. event: 'message_created',
  45. id: 90214,
  46. message_type: 'incoming',
  47. content: 'hello',
  48. conversation: {},
  49. };
  50. export const ticketedConversationMessage = {
  51. ...incomingEmailMessage,
  52. id: 90215,
  53. conversation: {
  54. ...incomingEmailMessage.conversation,
  55. labels: ['ticket'],
  56. custom_attributes: { ticket_number: 'EKS-20260820-1311', handoff: true },
  57. },
  58. };
  59. export const bounceMessage = {
  60. ...incomingEmailMessage,
  61. id: 90216,
  62. content: 'This is the mail system at host mx.example.com. Your message could not be delivered.',
  63. conversation: {
  64. ...incomingEmailMessage.conversation,
  65. additional_attributes: {
  66. source: 'email',
  67. mail_subject: 'Undelivered Mail Returned to Sender',
  68. },
  69. meta: { sender: { id: 9, name: '', email: 'mailer-daemon@example.com' } },
  70. },
  71. sender: { id: 9, name: '', email: 'mailer-daemon@example.com' },
  72. };
  73. export const noLabelsPayload = {
  74. event: 'message_created',
  75. id: 90217,
  76. message_type: 'incoming',
  77. content: 'Gdzie jest moja paczka?',
  78. conversation: {
  79. id: 1412,
  80. inbox_id: 1,
  81. channel: 'Channel::Email',
  82. },
  83. sender: { id: 401, name: 'Anna Nowak', email: 'anna.nowak@example.com' },
  84. };