Repository navigation
Expand file tree
/
Copy pathstrings.py
More file actions
664 lines (550 loc) · 21.6 KB
/
Copy pathstrings.py
File metadata and controls
664 lines (550 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
import copy
from enum import Enum
from jinja2 import Template
from typing import List
from dispatch.conversation.enums import ConversationButtonActions
from dispatch.incident.enums import IncidentStatus
from dispatch.config import (
INCIDENT_RESOURCE_CONVERSATION_REFERENCE_DOCUMENT,
INCIDENT_RESOURCE_EXECUTIVE_REPORT_DOCUMENT,
INCIDENT_RESOURCE_INCIDENT_FAQ_DOCUMENT,
INCIDENT_RESOURCE_INCIDENT_REVIEW_DOCUMENT,
INCIDENT_RESOURCE_INVESTIGATION_DOCUMENT,
INCIDENT_RESOURCE_INVESTIGATION_SHEET,
)
class MessageType(str, Enum):
document_evergreen_reminder = "document-evergreen-reminder"
incident_closed_information_review_reminder = "incident-closed-information-review-reminder"
incident_daily_report = "incident-daily-report"
incident_executive_report = "incident-executive-report"
incident_feedback_daily_digest = "incident-feedback-daily-digest"
incident_notification = "incident-notification"
incident_participant_suggested_reading = "incident-participant-suggested-reading"
incident_participant_welcome = "incident-participant-welcome"
incident_rating_feedback = "incident-rating-feedback"
incident_resources_message = "incident-resources-message"
incident_status_reminder = "incident-status-reminder"
incident_tactical_report = "incident-tactical-report"
incident_task_list = "incident-task-list"
incident_task_reminder = "incident-task-reminder"
INCIDENT_STATUS_DESCRIPTIONS = {
IncidentStatus.active.value: "This incident is under active investigation.",
IncidentStatus.stable.value: "This incident is stable, the bulk of the investigation has been completed or most of the risk has been mitigated.",
IncidentStatus.closed.value: "This no longer requires additional involvement, long term incident action items have been assigned to their respective owners.",
}
INCIDENT_TASK_REMINDER_DESCRIPTION = """
You are assigned to the following incident tasks.
This is a reminder that these tasks have passed their due date.
Please review and update them as appropriate. Resolving them will stop the reminders.""".replace(
"\n", " "
).strip()
INCIDENT_TASK_LIST_DESCRIPTION = """The following are open incident tasks."""
DOCUMENT_EVERGREEN_REMINDER_DESCRIPTION = """
You are the owner of the following incident documents.
This is a reminder that these documents should be kept up to date in order to effectively
respond to incidents. Please review them and update, or clearly mark the documents as deprecated.""".replace(
"\n", " "
).strip()
INCIDENT_FEEDBACK_DAILY_DIGEST_DESCRIPTION = """
This is a daily digest of feedback about incidents handled by you.""".replace(
"\n", " "
).strip()
INCIDENT_DAILY_REPORT_TITLE = """
Incidents Daily Report""".replace(
"\n", " "
).strip()
INCIDENT_DAILY_REPORT_DESCRIPTION = """
This is a daily report of incidents that are currently active and incidents that have been marked as stable or closed in the last 24 hours.""".replace(
"\n", " "
).strip()
INCIDENT_DAILY_REPORT_FOOTER_CONTEXT = """
For questions about an incident, please reach out to the incident's commander.""".replace(
"\n", " "
).strip()
INCIDENT_REPORTER_DESCRIPTION = """
The person who reported the incident. Contact them if the report details need clarification.""".replace(
"\n", " "
).strip()
INCIDENT_COMMANDER_DESCRIPTION = """
The Incident Commander (IC) is responsible for
knowing the full context of the incident.
Contact them about any questions or concerns.""".replace(
"\n", " "
).strip()
INCIDENT_COMMANDER_READDED_DESCRIPTION = """
{{ commander_fullname }} (Incident Commander) has been re-added to the conversation.
Please, handoff the Incident Commander role before leaving the conversation.""".replace(
"\n", " "
).strip()
INCIDENT_TICKET_DESCRIPTION = """
Ticket for tracking purposes. It contains a description of
the incident and links to resources.""".replace(
"\n", " "
).strip()
INCIDENT_CONVERSATION_DESCRIPTION = """
Private conversation for real-time discussion. All incident participants get added to it.
""".replace(
"\n", " "
).strip()
INCIDENT_CONVERSATION_REFERENCE_DOCUMENT_DESCRIPTION = """
Document containing the list of slash commands available to the Incident Commander (IC)
and participants in the incident conversation.""".replace(
"\n", " "
).strip()
INCIDENT_CONFERENCE_DESCRIPTION = """
Video conference and phone bridge to be used throughout the incident. Password: {{conference_challenge if conference_challenge else 'N/A'}}
""".replace(
"\n", ""
).strip()
INCIDENT_STORAGE_DESCRIPTION = """
Common storage for all incident artifacts and
documents. Add logs, screen captures, or any other data collected during the
investigation to this drive. It is shared with all incident participants.""".replace(
"\n", " "
).strip()
INCIDENT_INVESTIGATION_DOCUMENT_DESCRIPTION = """
This is a document for all incident facts and context. All
incident participants are expected to contribute to this document.
It is shared with all incident participants.""".replace(
"\n", " "
).strip()
INCIDENT_INVESTIGATION_SHEET_DESCRIPTION = """
This is a sheet for tracking impacted assets. All
incident participants are expected to contribute to this sheet.
It is shared with all incident participants.""".replace(
"\n", " "
).strip()
INCIDENT_FAQ_DOCUMENT_DESCRIPTION = """
First time responding to an information security incident? This
document answers common questions encountered when
helping us respond to an incident.""".replace(
"\n", " "
).strip()
INCIDENT_REVIEW_DOCUMENT_DESCRIPTION = """
This document will capture all lessons learned, questions, and action items raised during the incident.""".replace(
"\n", " "
).strip()
INCIDENT_EXECUTIVE_REPORT_DOCUMENT_DESCRIPTION = """
This is a document that contains an executive report about the incident.""".replace(
"\n", " "
).strip()
INCIDENT_DOCUMENT_DESCRIPTIONS = {
INCIDENT_RESOURCE_CONVERSATION_REFERENCE_DOCUMENT: INCIDENT_CONVERSATION_REFERENCE_DOCUMENT_DESCRIPTION,
INCIDENT_RESOURCE_EXECUTIVE_REPORT_DOCUMENT: INCIDENT_EXECUTIVE_REPORT_DOCUMENT_DESCRIPTION,
INCIDENT_RESOURCE_INCIDENT_FAQ_DOCUMENT: INCIDENT_FAQ_DOCUMENT_DESCRIPTION,
INCIDENT_RESOURCE_INCIDENT_REVIEW_DOCUMENT: INCIDENT_REVIEW_DOCUMENT_DESCRIPTION,
INCIDENT_RESOURCE_INVESTIGATION_DOCUMENT: INCIDENT_INVESTIGATION_DOCUMENT_DESCRIPTION,
INCIDENT_RESOURCE_INVESTIGATION_SHEET: INCIDENT_INVESTIGATION_SHEET_DESCRIPTION,
}
INCIDENT_PARTICIPANT_WELCOME_DESCRIPTION = """
You\'re being contacted because we think you may
be able to help us during this information security incident.
Please review the content below and join us in the
incident Slack channel.""".replace(
"\n", " "
).strip()
INCIDENT_WELCOME_CONVERSATION_COPY = """
This is the incident conversation. Please pull in any
individuals you feel may be able to help resolve this incident.""".replace(
"\n", " "
).strip()
INCIDENT_PARTICIPANT_SUGGESTED_READING_DESCRIPTION = """
Dispatch thinks the following documents might be
relevant to this incident.""".replace(
"\n", " "
).strip()
INCIDENT_NOTIFICATION_PURPOSES_FYI = """
This message is for notification purposes only.""".replace(
"\n", " "
).strip()
INCIDENT_CAN_REPORT_REMINDER = """
It's time to send a new CAN report. Go to the Demisto UI and run the
CAN Report playbook from the Playground Work Plan.""".replace(
"\n", " "
).strip()
INCIDENT_VULNERABILITY_DESCRIPTION = """
We are tracking the details of the vulnerability that led to this incident
in the VUL Jira issue linked above.""".replace(
"\n", " "
).strip()
INCIDENT_STABLE_DESCRIPTION = """
The risk has been contained and the incident marked as stable.""".replace(
"\n", " "
).strip()
INCIDENT_CLOSED_DESCRIPTION = """
The incident has been resolved and marked as closed.""".replace(
"\n", " "
).strip()
INCIDENT_TACTICAL_REPORT_DESCRIPTION = """
The following conditions, actions, and needs summarize the current status of the incident.""".replace(
"\n", " "
).strip()
INCIDENT_NEW_ROLE_DESCRIPTION = """
{{assigner_fullname if assigner_fullname else assigner_email}} has assigned the role of {{assignee_role}} to {{assignee_fullname if assignee_fullname else assignee_email}}.
Please, contact {{assignee_fullname if assignee_fullname else assignee_email}} about any questions or concerns.""".replace(
"\n", " "
).strip()
INCIDENT_REPORT_REMINDER_DESCRIPTION = """You have not provided a {{report_type}} for this incident recently.
You can use `{{command}}` in the conversation to assist you in writing one.""".replace(
"\n", " "
).strip()
INCIDENT_STATUS_REMINDER_DESCRIPTION = """You have not updated the status for this incident recently. If the incident has been resolved,
you can use `{{command}}` in the conversation to assist you in closing your incident.""".replace(
"\n", " "
).strip()
INCIDENT_TASK_NEW_DESCRIPTION = """
The following incident task has been created in the incident document.\n\n*Description:* {{task_description}}\n\n*Assignees:* {{task_assignees|join(',')}}"""
INCIDENT_TASK_RESOLVED_DESCRIPTION = """
The following incident task has been resolved in the incident document.\n\n*Description:* {{task_description}}\n\n*Assignees:* {{task_assignees|join(',')}}"""
INCIDENT_WORKFLOW_CREATED_DESCRIPTION = """
A new workflow instance has been created.
\n\n *Creator:* {{instance_creator_name}}
"""
INCIDENT_WORKFLOW_UPDATE_DESCRIPTION = """
This workflow's status has changed from *{{ instance_status_old }}* to *{{ instance_status_new }}*.
\n\n*Workflow Description*: {{workflow_description}}
\n\n *Creator:* {{instance_creator_name}}
"""
INCIDENT_WORKFLOW_COMPLETE_DESCRIPTION = """
This workflow's status has changed from *{{ instance_status_old }}* to *{{ instance_status_new }}*.
\n\n *Workflow Description:* {{workflow_description}}
\n\n *Creator:* {{instance_creator_name}}
{% if instance_artifacts %}
\n\n *Workflow Artifacts:*
\n\n {% for a in instance_artifacts %}- <{{a.weblink}}|{{a.name}}> \n\n{% endfor %}
{% endif %}
"""
INCIDENT_CLOSED_INFORMATION_REVIEW_REMINDER_DESCRIPTION = """
Thanks for closing incident {{name}}. Please take a minute to review the following incident data:
\n - *Title:* {{title}}
\n - *Description:* {{description}}
\n - *Incident Type:* {{type}}
\n - *Incident Priority:* {{priority}}
\n\n
Is the information up to date? If not, please edit the incident in the <{{dispatch_ui_url}}|Dispatch Web UI>.
\n\n
Also please be sure to take the following actions:
\n - Update or add any relevant incident tags using the <{{dispatch_ui_url}}|Dispatch Web UI>.
\n - Review and close any incident tasks that are no longer relevant/required.
"""
INCIDENT_CLOSED_RATING_FEEDBACK_DESCRIPTION = """
Thanks for participating in the {{name}} ("{{title}}") incident. We would appreciate if you could rate your experience and provide feedback."""
INCIDENT_TYPE_CHANGE_DESCRIPTION = """
The incident type has been changed from {{ incident_type_old }} to {{ incident_type_new }}.""".replace(
"\n", " "
).strip()
INCIDENT_STATUS_CHANGE_DESCRIPTION = """
The incident status has been changed from {{ incident_status_old }} to {{ incident_status_new }}.""".replace(
"\n", " "
).strip()
INCIDENT_PRIORITY_CHANGE_DESCRIPTION = """
The incident priority has been changed from {{ incident_priority_old }} to {{ incident_priority_new }}.""".replace(
"\n", " "
).strip()
INCIDENT_NAME_WITH_ENGAGEMENT = {
"title": "{{name}} Incident Notification",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_NOTIFICATION_PURPOSES_FYI,
"button_text": "Join Incident",
"button_value": "{{incident_id}}",
"button_action": ConversationButtonActions.invite_user.value,
}
INCIDENT_NAME_WITH_ENGAGEMENT_NO_DESCRIPTION = {
"title": "{{name}}",
"title_link": "{{ticket_weblink}}",
"text": "{{ignore}}",
"button_text": "{{button_text}}",
"button_value": "{{button_value}}",
"button_action": "{{button_action}}",
}
INCIDENT_NAME = {
"title": "{{name}} Incident Notification",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_NOTIFICATION_PURPOSES_FYI,
}
INCIDENT_TITLE = {"title": "Title", "text": "{{title}}"}
INCIDENT_DESCRIPTION = {"title": "Description", "text": "{{description}}"}
INCIDENT_STATUS = {
"title": "Status - {{status}}",
"status_mapping": INCIDENT_STATUS_DESCRIPTIONS,
}
INCIDENT_TYPE = {"title": "Type - {{type}}", "text": "{{type_description}}"}
INCIDENT_PRIORITY = {
"title": "Priority - {{priority}}",
"text": "{{priority_description}}",
}
INCIDENT_PRIORITY_FYI = {
"title": "Priority - {{priority}}",
"text": "{{priority_description}}",
}
INCIDENT_REPORTER = {
"title": "Reporter - {{reporter_fullname}}, {{reporter_team}}",
"title_link": "{{reporter_weblink}}",
"text": INCIDENT_REPORTER_DESCRIPTION,
}
INCIDENT_COMMANDER = {
"title": "Commander - {{commander_fullname}}, {{commander_team}}",
"title_link": "{{commander_weblink}}",
"text": INCIDENT_COMMANDER_DESCRIPTION,
}
INCIDENT_CONFERENCE = {
"title": "Conference",
"title_link": "{{conference_weblink}}",
"text": INCIDENT_CONFERENCE_DESCRIPTION,
}
INCIDENT_STORAGE = {
"title": "Storage",
"title_link": "{{storage_weblink}}",
"text": INCIDENT_STORAGE_DESCRIPTION,
}
INCIDENT_CONVERSATION_COMMANDS_REFERENCE_DOCUMENT = {
"title": "Incident Conversation Commands Reference Document",
"title_link": "{{conversation_commands_reference_document_weblink}}",
"text": INCIDENT_CONVERSATION_REFERENCE_DOCUMENT_DESCRIPTION,
}
INCIDENT_INVESTIGATION_DOCUMENT = {
"title": "Investigation Document",
"title_link": "{{document_weblink}}",
"text": INCIDENT_INVESTIGATION_DOCUMENT_DESCRIPTION,
}
INCIDENT_INVESTIGATION_SHEET = {
"title": "Investigation Sheet",
"title_link": "{{sheet_weblink}}",
"text": INCIDENT_INVESTIGATION_SHEET_DESCRIPTION,
}
INCIDENT_REVIEW_DOCUMENT = {
"title": "Review Document",
"title_link": "{{review_document_weblink}}",
"text": INCIDENT_REVIEW_DOCUMENT_DESCRIPTION,
}
INCIDENT_FAQ_DOCUMENT = {
"title": "FAQ Document",
"title_link": "{{faq_weblink}}",
"text": INCIDENT_FAQ_DOCUMENT_DESCRIPTION,
}
INCIDENT_TYPE_CHANGE = {"title": "Incident Type Change", "text": INCIDENT_TYPE_CHANGE_DESCRIPTION}
INCIDENT_STATUS_CHANGE = {
"title": "Status Change",
"text": INCIDENT_STATUS_CHANGE_DESCRIPTION,
}
INCIDENT_PRIORITY_CHANGE = {
"title": "Priority Change",
"text": INCIDENT_PRIORITY_CHANGE_DESCRIPTION,
}
INCIDENT_PARTICIPANT_SUGGESTED_READING_ITEM = {
"title": "{{name}}",
"title_link": "{{weblink}}",
"text": "{{description}}",
}
INCIDENT_PARTICIPANT_WELCOME = {
"title": "Welcome to {{name}}",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_PARTICIPANT_WELCOME_DESCRIPTION,
}
INCIDENT_PARTICIPANT_WELCOME_MESSAGE = [
INCIDENT_PARTICIPANT_WELCOME,
INCIDENT_TITLE,
INCIDENT_DESCRIPTION,
INCIDENT_STATUS,
INCIDENT_TYPE,
INCIDENT_PRIORITY,
INCIDENT_REPORTER,
INCIDENT_COMMANDER,
INCIDENT_INVESTIGATION_DOCUMENT,
INCIDENT_STORAGE,
INCIDENT_CONFERENCE,
INCIDENT_CONVERSATION_COMMANDS_REFERENCE_DOCUMENT,
INCIDENT_FAQ_DOCUMENT,
]
INCIDENT_RESOURCES_MESSAGE = [
INCIDENT_TITLE,
INCIDENT_DESCRIPTION,
INCIDENT_REPORTER,
INCIDENT_COMMANDER,
INCIDENT_INVESTIGATION_DOCUMENT,
INCIDENT_REVIEW_DOCUMENT,
INCIDENT_STORAGE,
INCIDENT_CONFERENCE,
INCIDENT_CONVERSATION_COMMANDS_REFERENCE_DOCUMENT,
INCIDENT_FAQ_DOCUMENT,
]
INCIDENT_NOTIFICATION_COMMON = [INCIDENT_TITLE]
INCIDENT_NOTIFICATION = INCIDENT_NOTIFICATION_COMMON.copy()
INCIDENT_NOTIFICATION.extend(
[
INCIDENT_DESCRIPTION,
INCIDENT_STATUS,
INCIDENT_TYPE,
INCIDENT_PRIORITY_FYI,
INCIDENT_REPORTER,
INCIDENT_COMMANDER,
]
)
INCIDENT_TACTICAL_REPORT = [
{"title": "Incident Tactical Report", "text": INCIDENT_TACTICAL_REPORT_DESCRIPTION},
{"title": "Conditions", "text": "{{conditions}}"},
{"title": "Actions", "text": "{{actions}}"},
{"title": "Needs", "text": "{{needs}}"},
]
INCIDENT_EXECUTIVE_REPORT = [
{"title": "Incident Title", "text": "{{title}}"},
{"title": "Current Status", "text": "{{current_status}}"},
{"title": "Overview", "text": "{{overview}}"},
{"title": "Next Steps", "text": "{{next_steps}}"},
]
INCIDENT_REPORT_REMINDER = [
{
"title": "{{name}} Incident - {{report_type}} Reminder",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_REPORT_REMINDER_DESCRIPTION,
},
INCIDENT_TITLE,
]
INCIDENT_STATUS_REMINDER = [
{
"title": "{{name}} Incident - Status Reminder",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_STATUS_REMINDER_DESCRIPTION,
},
INCIDENT_TITLE,
INCIDENT_STATUS,
]
INCIDENT_TASK_REMINDER = [
{"title": "Incident - {{ name }}", "text": "{{ title }}"},
{"title": "Creator", "text": "{{ creator }}"},
{"title": "Description", "text": "{{ description }}"},
{"title": "Priority", "text": "{{ priority }}"},
{"title": "Created At", "text": "", "datetime": "{{ created_at}}"},
{"title": "Resolve By", "text": "", "datetime": "{{ resolve_by }}"},
{"title": "Link", "text": "{{ weblink }}"},
]
DOCUMENT_EVERGREEN_REMINDER = [
{"title": "Document", "text": "{{ name }}"},
{"title": "Description", "text": "{{ description }}"},
{"title": "Link", "text": "{{ weblink }}"},
]
INCIDENT_NEW_ROLE_NOTIFICATION = [
{
"title": "New {{assignee_role}} - {{assignee_fullname if assignee_fullname else assignee_email}}",
"title_link": "{{assignee_weblink}}",
"text": INCIDENT_NEW_ROLE_DESCRIPTION,
}
]
INCIDENT_TASK_NEW_NOTIFICATION = [
{
"title": "New Incident Task",
"title_link": "{{task_weblink}}",
"text": INCIDENT_TASK_NEW_DESCRIPTION,
}
]
INCIDENT_TASK_RESOLVED_NOTIFICATION = [
{
"title": "Resolved Incident Task",
"title_link": "{{task_weblink}}",
"text": INCIDENT_TASK_RESOLVED_DESCRIPTION,
}
]
INCIDENT_WORKFLOW_CREATED_NOTIFICATION = [
{
"title": "Workflow Created - {{workflow_name}}",
"text": INCIDENT_WORKFLOW_CREATED_DESCRIPTION,
}
]
INCIDENT_WORKFLOW_UPDATE_NOTIFICATION = [
{
"title": "Workflow Status Change - {{workflow_name}}",
"title_link": "{{instance_weblink}}",
"text": INCIDENT_WORKFLOW_UPDATE_DESCRIPTION,
}
]
INCIDENT_WORKFLOW_COMPLETE_NOTIFICATION = [
{
"title": "Workflow Completed - {{workflow_name}}",
"title_link": "{{instance_weblink}}",
"text": INCIDENT_WORKFLOW_COMPLETE_DESCRIPTION,
}
]
INCIDENT_COMMANDER_READDED_NOTIFICATION = [
{"title": "Incident Commander Re-Added", "text": INCIDENT_COMMANDER_READDED_DESCRIPTION}
]
INCIDENT_CLOSED_INFORMATION_REVIEW_REMINDER_NOTIFICATION = [
{
"title": "{{name}} Incident - Information Review Reminder",
"title_link": "{{dispatch_ui_url}}",
"text": INCIDENT_CLOSED_INFORMATION_REVIEW_REMINDER_DESCRIPTION,
}
]
INCIDENT_CLOSED_RATING_FEEDBACK_NOTIFICATION = [
{
"title": "{{name}} Incident - Rating and Feedback",
"title_link": "{{ticket_weblink}}",
"text": INCIDENT_CLOSED_RATING_FEEDBACK_DESCRIPTION,
"button_text": "Provide Feeback",
"button_value": "{{incident_id}}",
"button_action": ConversationButtonActions.provide_feedback.value,
}
]
INCIDENT_FEEDBACK_DAILY_DIGEST = [
{"title": "Incident", "text": "{{ name }}"},
{"title": "Incident Title", "text": "{{ title }}"},
{"title": "Rating", "text": "{{ rating }}"},
{"title": "Feedback", "text": "{{ feedback }}"},
{"title": "Participant", "text": "{{ participant }}"},
{"title": "Created At", "text": "", "datetime": "{{ created_at}}"},
]
INCIDENT_DAILY_REPORT_HEADER = {
"type": "header",
"text": INCIDENT_DAILY_REPORT_TITLE,
}
INCIDENT_DAILY_REPORT_HEADER_DESCRIPTION = {
"text": INCIDENT_DAILY_REPORT_DESCRIPTION,
}
INCIDENT_DAILY_REPORT_FOOTER = {
"type": "context",
"text": INCIDENT_DAILY_REPORT_FOOTER_CONTEXT,
}
INCIDENT_DAILY_REPORT = [
INCIDENT_DAILY_REPORT_HEADER,
INCIDENT_DAILY_REPORT_HEADER_DESCRIPTION,
INCIDENT_DAILY_REPORT_FOOTER,
]
INCIDENT = [
INCIDENT_NAME_WITH_ENGAGEMENT_NO_DESCRIPTION,
INCIDENT_TITLE,
INCIDENT_STATUS,
INCIDENT_TYPE,
INCIDENT_PRIORITY,
INCIDENT_COMMANDER,
]
def render_message_template(message_template: List[dict], **kwargs):
"""Renders the jinja data included in the template itself."""
data = []
new_copy = copy.deepcopy(message_template)
for d in new_copy:
if d.get("header"):
d["header"] = Template(d["header"]).render(**kwargs)
if d.get("title"):
d["title"] = Template(d["title"]).render(**kwargs)
if d.get("title_link"):
d["title_link"] = Template(d["title_link"]).render(**kwargs)
if d["title_link"] == "None": # skip blocks with no content
continue
# skip blocks that do not have new links rendered, as no real value was provided
if not d["title_link"]:
continue
if d.get("text"):
d["text"] = Template(d["text"]).render(**kwargs)
if d.get("button_text"):
d["button_text"] = Template(d["button_text"]).render(**kwargs)
if d.get("button_value"):
d["button_value"] = Template(d["button_value"]).render(**kwargs)
if d.get("button_action"):
d["button_action"] = Template(d["button_action"]).render(**kwargs)
if d.get("status_mapping"):
d["text"] = d["status_mapping"][kwargs["status"]]
if d.get("datetime"):
d["datetime"] = Template(d["datetime"]).render(**kwargs)
if d.get("context"):
d["context"] = Template(d["context"]).render(**kwargs)
data.append(d)
return data