Skip to content

Commit 204e7e7

Browse files
authored
feat(zendesk-user-field): Add zendesk user field (#431)
## Describe your changes ## Issue ticket number and link ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] External API requests have `retries` - [ ] Pagination is used where appropriate - [ ] The built in `nango.paginate` call is used instead of a `while (true)` loop - [ ] Third party requests are NOT parallelized (this can cause issues with rate limits) - [ ] If a sync requires metadata the `nango.yaml` has `auto_start: false` - [ ] If the sync is a `full` sync then `track_deletes: true` is set - [ ] I followed the best practices and guidelines from the [Writing Integration Scripts](/NangoHQ/integration-templates/blob/main/guides/WRITING_SCRIPTS.md) doc
1 parent 8e53b9e commit 204e7e7

File tree

11 files changed

+91
-31
lines changed

11 files changed

+91
-31
lines changed

integrations/.nango/nango.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16882,7 +16882,7 @@
1688216882
"User",
1688316883
"SyncMetadata_zendesk_users"
1688416884
],
16885-
"version": "2.0.0",
16885+
"version": "2.0.1",
1688616886
"webhookSubscriptions": []
1688716887
}
1688816888
],

integrations/.nango/schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65801,6 +65801,17 @@
6580165801
},
6580265802
"email": {
6580365803
"type": "string"
65804+
},
65805+
"user_fields": {
65806+
"type": "object",
65807+
"additionalProperties": {
65808+
"anyOf": [
65809+
{},
65810+
{
65811+
"not": {}
65812+
}
65813+
]
65814+
}
6580465815
}
6580565816
},
6580665817
"required": [

integrations/.nango/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14066,6 +14066,7 @@ export interface ActionOutput_zendesk_createuser {
1406614066
firstName: string;
1406714067
lastName: string;
1406814068
email: string;
14069+
user_fields?: { [key: string]: any | undefined;};
1406914070
};
1407014071

1407114072
export interface ActionInput_zendesk_deleteuser {

integrations/zendesk/.nango/nango.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
"User",
318318
"SyncMetadata_zendesk_users"
319319
],
320-
"version": "2.0.0",
320+
"version": "2.0.1",
321321
"webhookSubscriptions": []
322322
}
323323
],

integrations/zendesk/.nango/schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,17 @@
902902
},
903903
"email": {
904904
"type": "string"
905+
},
906+
"user_fields": {
907+
"type": "object",
908+
"additionalProperties": {
909+
"anyOf": [
910+
{},
911+
{
912+
"not": {}
913+
}
914+
]
915+
}
905916
}
906917
},
907918
"required": [

integrations/zendesk/.nango/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export interface ActionOutput_zendesk_createuser {
170170
firstName: string;
171171
lastName: string;
172172
email: string;
173+
user_fields?: { [key: string]: any | undefined;};
173174
};
174175

175176
export interface ActionInput_zendesk_deleteuser {

integrations/zendesk/mocks/users/User/batchSave.json

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,138 +3,161 @@
33
"id": "32763192893073",
44
"firstName": "The",
55
"lastName": "Customer",
6-
"email": "customer@example.com"
6+
"email": "customer@example.com",
7+
"user_fields": {}
78
},
89
{
910
"id": "32763206658065",
1011
"firstName": "Kelvin",
1112
"lastName": "Wari",
12-
"email": "hassanwari254@gmail.com"
13+
"email": "hassanwari254@gmail.com",
14+
"user_fields": {}
1315
},
1416
{
1517
"id": "32763235076113",
1618
"firstName": "Zhang",
1719
"lastName": "Wei",
18-
"email": "zhang.weixu@example.com"
20+
"email": "zhang.weixu@example.com",
21+
"user_fields": {}
1922
},
2023
{
2124
"id": "32763235217681",
2225
"firstName": "Ingrid",
2326
"lastName": "Van",
24-
"email": "ingrid.vandijk@example.com"
27+
"email": "ingrid.vandijk@example.com",
28+
"user_fields": {}
2529
},
2630
{
2731
"id": "32763266879633",
2832
"firstName": "Soobin",
2933
"lastName": "Do",
30-
"email": "soobin.do@example.com"
34+
"email": "soobin.do@example.com",
35+
"user_fields": {}
3136
},
3237
{
3338
"id": "32763282580241",
3439
"firstName": "Customer",
3540
"lastName": "",
36-
"email": "example@zendesk.com"
41+
"email": "example@zendesk.com",
42+
"user_fields": {}
3743
},
3844
{
3945
"id": "32768199515537",
4046
"firstName": "Roger",
4147
"lastName": "Wilco",
42-
"email": null
48+
"email": null,
49+
"user_fields": {}
4350
},
4451
{
4552
"id": "32768693470737",
4653
"firstName": "Roger",
4754
"lastName": "Wilco",
48-
"email": null
55+
"email": null,
56+
"user_fields": {}
4957
},
5058
{
5159
"id": "32768722488209",
5260
"firstName": "Roger",
5361
"lastName": "Wilco",
54-
"email": null
62+
"email": null,
63+
"user_fields": {}
5564
},
5665
{
5766
"id": "32768749121553",
5867
"firstName": "tests",
5968
"lastName": "in",
60-
"email": "tco@test.com"
69+
"email": "tco@test.com",
70+
"user_fields": {}
6171
},
6272
{
6373
"id": "32777971122577",
6474
"firstName": "John",
6575
"lastName": "Doe",
66-
"email": "johndoe@example.com"
76+
"email": "johndoe@example.com",
77+
"user_fields": {}
6778
},
6879
{
6980
"id": "32778022853009",
7081
"firstName": "Johns",
7182
"lastName": "Doe",
72-
"email": "johndoes@example.com"
83+
"email": "johndoes@example.com",
84+
"user_fields": {}
7385
},
7486
{
7587
"id": "32778051354129",
7688
"firstName": "Johns",
7789
"lastName": "Doe",
78-
"email": "johndoes@examples.com"
90+
"email": "johndoes@examples.com",
91+
"user_fields": {}
7992
},
8093
{
8194
"id": "32778088066961",
8295
"firstName": "Johns",
8396
"lastName": "Does",
84-
"email": "johndoesss@example.com"
97+
"email": "johndoesss@example.com",
98+
"user_fields": {}
8599
},
86100
{
87101
"id": "32778096357905",
88102
"firstName": "Johnsw",
89103
"lastName": "Does",
90-
"email": "johndoesssww@example.com"
104+
"email": "johndoesssww@example.com",
105+
"user_fields": {}
91106
},
92107
{
93108
"id": "32778150390161",
94109
"firstName": "John",
95110
"lastName": "Doe",
96-
"email": "customer1@example.com"
111+
"email": "customer1@example.com",
112+
"user_fields": {}
97113
},
98114
{
99115
"id": "32778203764369",
100116
"firstName": "James",
101117
"lastName": "Doe",
102-
"email": "jamescustomer@example.com"
118+
"email": "jamescustomer@example.com",
119+
"user_fields": {}
103120
},
104121
{
105122
"id": "32888998590865",
106123
"firstName": "Jane",
107124
"lastName": "Doe",
108-
"email": "janedoe@example.com"
125+
"email": "janedoe@example.com",
126+
"user_fields": {}
109127
},
110128
{
111129
"id": "32889172187409",
112130
"firstName": "Sample",
113131
"lastName": "User",
114-
"email": "sampleuser-1@gmail.com"
132+
"email": "sampleuser-1@gmail.com",
133+
"user_fields": {}
115134
},
116135
{
117136
"id": "32889564879505",
118137
"firstName": "Sample",
119138
"lastName": "User2",
120-
"email": "sampleuser-2@gmail.com"
139+
"email": "sampleuser-2@gmail.com",
140+
"user_fields": {}
121141
},
122142
{
123143
"id": "32889653118481",
124144
"firstName": "Sample",
125145
"lastName": "User2",
126-
"email": "sampleuser-2@gmail.comp"
146+
"email": "sampleuser-2@gmail.comp",
147+
"user_fields": {}
127148
},
128149
{
129150
"id": "32890003697937",
130151
"firstName": "Sample",
131152
"lastName": "User2999",
132-
"email": "sampleuser-3@gmail.com"
153+
"email": "sampleuser-3@gmail.com",
154+
"user_fields": {}
133155
},
134156
{
135157
"id": "32981016448017",
136158
"firstName": "Sample",
137159
"lastName": "User2",
138-
"email": "sampleuser-43@gmail.com"
160+
"email": "sampleuser-43@gmail.com",
161+
"user_fields": {}
139162
}
140-
]
163+
]

integrations/zendesk/models.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const User = z.object({
2525
id: z.string(),
2626
firstName: z.string(),
2727
lastName: z.string(),
28-
email: z.string()
28+
email: z.string(),
29+
user_fields: z.record(z.string(), z.any()).optional()
2930
});
3031

3132
export type User = z.infer<typeof User>;

integrations/zendesk/syncs/users.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { z } from 'zod';
88

99
const sync = createSync({
1010
description: 'Fetches a list of admin or agent users from Zendesk',
11-
version: '2.0.0',
11+
version: '2.0.1',
1212
frequency: 'every 6 hours',
1313
autoStart: true,
1414
syncType: 'full',
@@ -58,7 +58,8 @@ const sync = createSync({
5858
id: zUser.id.toString(),
5959
firstName: firstName || '',
6060
lastName: lastName || '',
61-
email: zUser.email
61+
email: zUser.email,
62+
user_fields: zUser.user_fields
6263
};
6364
});
6465

integrations/zendesk/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export interface ZendeskUser {
230230
suspended: boolean;
231231
default_group_id: number;
232232
report_csv: boolean;
233-
user_fields: Record<string, any>;
233+
user_fields?: Record<string, any>;
234234
}
235235

236236
interface ZendeskAttachmet {

0 commit comments

Comments
 (0)