-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_ticket.fp
371 lines (315 loc) · 10.8 KB
/
create_ticket.fp
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
pipeline "create_ticket" {
title = "Create Ticket"
description = "Create a ticket."
tags = {
type = "featured"
}
param "cred" {
type = string
description = local.cred_param_description
default = "default"
}
param "comment" {
type = object({
body = string
public = bool
author_id = number
})
description = "An object that defines the properties of the ticket comment."
}
param "allow_attachments" {
type = bool
description = "Permission for agents to add attachments to a comment. Defaults to true."
optional = true
}
param "allow_channelback" {
type = bool
description = "Is false if channelback is disabled, true otherwise. Only applicable for channels framework ticket."
optional = true
}
param "assignee_email" {
type = string
description = "Write only. The email address of the agent to assign the ticket to."
optional = true
}
param "assignee_id" {
type = number
description = "The agent currently assigned to the ticket."
optional = true
}
param "attribute_value_ids" {
type = list(number)
description = "Write only. An array of the IDs of attribute values to be associated with the ticket."
optional = true
}
param "brand_id" {
type = number
description = "Enterprise only. The ID of the brand this ticket is associated with."
optional = true
}
param "collaborator_ids" {
type = list(number)
description = "The IDs of users currently CC'ed on the ticket."
optional = true
}
param "collaborators" {
type = list(object({
name = string
email = string
}))
description = "POST requests only. Users to add as CC's when creating a ticket. See Setting Collaborators."
optional = true
}
param "created_at" {
type = string
description = "When this record was created."
optional = true
}
param "custom_fields" {
type = list(object({
id = number
value = string
}))
description = "Custom fields for the ticket. See Setting custom field values."
optional = true
}
param "custom_status_id" {
type = number
description = "The custom ticket status ID of the ticket. See custom ticket statuses."
optional = true
}
param "description" {
type = string
description = "Read-only first comment on the ticket. When creating a ticket, use comment to set the description. See Description and first comment."
optional = true
}
param "due_at" {
type = string
description = "If this is a ticket of type 'task', it has a due date. Due date format uses ISO 8601 format."
optional = true
}
param "email_cc_ids" {
type = list(number)
description = "The IDs of agents or end users currently CC'ed on the ticket. See CCs and followers resources in the Support Help Center."
optional = true
}
param "email_ccs" {
type = list(object({
user_id = number
email = string
}))
description = "Write only. An array of objects that represent agent or end users email CCs to add or delete from the ticket. See Setting email CCs."
optional = true
}
param "external_id" {
type = string
description = "An ID you can use to link Zendesk Support tickets to local records."
optional = true
}
param "follower_ids" {
type = list(number)
description = "The IDs of agents currently following the ticket. See CCs and followers resources."
optional = true
}
param "followers" {
type = list(object({
user_id = number
}))
description = "Write only. An array of objects that represent agent followers to add or delete from the ticket. See Setting followers."
optional = true
}
param "followup_ids" {
type = list(number)
description = "The IDs of the followups created from this ticket. IDs are only visible once the ticket is closed."
optional = true
}
param "forum_topic_id" {
type = number
description = "The topic in the Zendesk Web portal this ticket originated from, if any. The Web portal is deprecated."
optional = true
}
param "from_messaging_channel" {
type = bool
description = "If true, the ticket's via type is a messaging channel."
optional = true
}
param "group_id" {
type = number
description = "The group this ticket is assigned to."
optional = true
}
param "has_incidents" {
type = bool
description = "Is true if a ticket is a problem type and has one or more incidents linked to it. Otherwise, the value is false."
optional = true
}
param "ticket_id" {
type = number
description = "Automatically assigned when the ticket is created."
optional = true
}
param "is_public" {
type = bool
description = "Is true if any comments are public, false otherwise."
optional = true
}
param "macro_id" {
type = number
description = "Write only. A macro ID to be recorded in the ticket audit."
optional = true
}
param "macro_ids" {
type = list(number)
description = "POST requests only. List of macro IDs to be recorded in the ticket audit."
optional = true
}
param "metadata" {
type = map
description = "Write only. Metadata for the audit. In the audit object, the data is specified in the custom property of the metadata object. See Setting Metadata."
optional = true
}
param "organization_id" {
type = number
description = "The organization of the requester. You can only specify the ID of an organization associated with the requester. See Organization Memberships."
optional = true
}
param "priority" {
type = string
description = "The urgency with which the ticket should be addressed. Allowed values are 'urgent', 'high', 'normal', or 'low'."
optional = true
}
param "problem_id" {
type = number
description = "For tickets of type 'incident', the ID of the problem the incident is linked to."
optional = true
}
param "raw_subject" {
type = string
description = "The dynamic content placeholder, if present, or the 'subject' value, if not. See Dynamic Content Items."
optional = true
}
param "recipient" {
type = string
description = "The original recipient e-mail address of the ticket. Notification emails for the ticket are sent from this address."
optional = true
}
param "requester" {
type = object({
name = string
email = string
})
description = "Write only. See Creating a ticket with a new requester."
optional = true
}
param "requester_id" {
type = number
description = "The user who requested this ticket."
optional = true
}
param "safe_update" {
type = bool
description = "Write only. Optional boolean. When true and an update_stamp date is included, protects against ticket update collisions and returns a message to let you know if one occurs. See Protecting against ticket update collisions. A value of false has the same effect as true. Omit the property to force the updates to not be safe."
optional = true
}
param "satisfaction_rating" {
type = object({
score = number
comment = string
reason = string
created_at = string
updated_at = string
assignee_id = number
group_id = number
requester_id = number
})
description = "The satisfaction rating of the ticket, if it exists, or the state of satisfaction, 'offered' or 'unoffered'. The value is null for plan types that don't support CSAT."
optional = true
}
param "sharing_agreement_ids" {
type = list(number)
description = "The IDs of the sharing agreements used for this ticket."
optional = true
}
param "status" {
type = string
description = "The state of the ticket. If your account has activated custom ticket statuses, this is the ticket's status category. See custom ticket statuses. Allowed values are 'new', 'open', 'pending', 'hold', 'solved', or 'closed'."
optional = true
}
param "subject" {
type = string
description = "The value of the subject field for this ticket."
optional = true
}
param "submitter_id" {
type = number
description = "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket."
optional = true
}
param "tags" {
type = list(string)
description = "The array of tags applied to this ticket."
optional = true
}
param "ticket_form_id" {
type = number
description = "Enterprise only. The ID of the ticket form to render for the ticket."
optional = true
}
param "type" {
type = string
description = "The type of this ticket. Allowed values are 'problem', 'incident', 'question', or 'task'."
optional = true
}
param "updated_at" {
type = string
description = "When this record last got updated."
optional = true
}
param "updated_stamp" {
type = string
description = "Write only. Datetime of last update received from API. See the safe_update property."
optional = true
}
param "url" {
type = string
description = "The API URL of this ticket."
optional = true
}
param "via" {
type = object({
channel = string
})
description = "For more information, see the Via object reference."
optional = true
}
param "via_followup_source_id" {
type = number
description = "POST requests only. The ID of a closed ticket when creating a follow-up ticket. See Creating a follow-up ticket."
optional = true
}
param "via_id" {
type = number
description = "Write only. For more information, see the Via object reference."
optional = true
}
param "voice_comment" {
type = object({
value = string
})
description = "Write only. See Creating voicemail ticket."
optional = true
}
step "http" "create_ticket" {
method = "post"
url = "https://${credential.zendesk[param.cred].subdomain}.zendesk.com/api/v2/tickets.json"
request_headers = {
Content-Type = "application/json"
Authorization = "Basic ${base64encode("${credential.zendesk[param.cred].email}/token:${credential.zendesk[param.cred].token}")}"
}
request_body = jsonencode({ ticket = { for name, value in param : name => value if value != null } })
}
output "ticket" {
description = "The ticket that has been created."
value = step.http.create_ticket.response_body.ticket
}
}