Product Events

These are Freshteam events, such as onEmployeeCreate, onEmployeeUpdate, and onNewHireCreate, which can be used to trigger apps. When product events occur, the appropriate method in the server.js file is invoked.

Note: The serverless component of the app is executed in sandbox mode where some methods, such as setTimeout and setInterval, cannot be used.

Payload

When a supported product event occurs, the corresponding method in the server.js file is invoked and the following payload is passed to the app.

Copied Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ "account_id" : "value", "domain" : "value", "event" : "value", "region" : "value", "timestamp" : "value", "data" : { //“data” contains the list of objects related to the event. }, "iparams" : { "Param1" : "value", "Param2" : "value" } }
EXPAND ↓

The following table lists the payload attributes.

Attribute Type Description
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
domain string Freshteam account domain.
event string Name of the event.
region string Region where the app is installed - "US".
timestamp number App installation timestamp in the epoch format.
iparams object Installation parameters.
Registration

When a product event occurs, an event listener is required for the appropriate method to be invoked. This is done in the following format.

server.js Copied Copy
1
2
3
4
5
6
7
8
9
exports = { events: [ { event: "eventName", callback: "eventCallbackMethod" } ], eventCallbackMethod: function(payload) { //Multiple events can access the same callback console.log("Logging arguments from the event: " + JSON.stringify(payload)); } }

Note:
1. Include the event and callback definition in the exports block.
2. Include only one callback method for an event.

onEmployeeCreate

When a new employee record is created, the onEmployeeCreate event is invoked and the registered callback method is executed. Use the following format to include this event in the server.js file.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onEmployeeCreate", callback: "onEmployeeCreateCallback" } ], onEmployeeCreateCallback: function(payload) { console.log("Logging arguments from onEmployeeCreate event: " + JSON.stringify(payload)); } }
Sample Code Copied Copy
1
2
3
4
5
6
7
8
9
10
11
12
exports = { events: [ { event: "onEmployeeCreate", callback: "onEmployeeCreateCallback" } ], onEmployeeCreateCallback: function(payload) { console.log("Logging arguments from onEmployeeCreate event: " + JSON.stringify(payload)); if(payload.data.employee.priority >= 3) { //your code goes here } } }
EXPAND ↓
Sample Payload
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
{ "timestamp": 1496400354326, "account_id": 15, "domain": "sample.freshteam.com", "event": "onEmployeeCreate", "region": "US", "data": { "employee": { "id": 21, "account_id": 1, "first_name": "Alayna", "last_name": "Marvin", "middle_name": null, "user_emails": [ "alayna@freshteam.com" ], "employee_id": null, "status": { "id": 1, "value": "Active" }, "designation": "Regional Manager", "deleted": false, "user_category": { "id": 1, "value": "Regular" }, "user_type": { "id": 2, "value": "Full Time" }, "custom_fields": [ { "ff_alias": "werw_cf_str01", "ff_name": "cf_str01", "ff_coltype": "varchar_255", "field_value": null }, { "ff_alias": "string_cf_str02", "ff_name": "cf_str02", "ff_coltype": "varchar_255", "field_value": null } ], "updated_at": "2019-10-15 10:10:22 UTC", "created_at": "2019-10-15 10:10:22 UTC", "time_zone": "US/Pacific", "language": "en", "demo": null, "confirmed": false, "joining_date": null, "shift_timings": null, "account_admin": false, "contract_end_date": null, "introduction": null, "imported_id": null, "leave_policy_id": null, "reportees_count": 0, "draft": false, "level_id": null, "terminated": false, "sub_department_id": null, "twitter_id": null, "facebook_id": null, "seating_location": null, "internship_end_date": null, "work_contact": { }, "ceo": false, "ancestry": null, "signature": null }, "associations": { "branch": { "id": 1, "account_id": 1, "name": "Default - Head office", "street": null, "city": "San Francisco", "state": null, "country_code": "US", "zip": null, "time_zone": "US/Pacific", "contact_info": { }, "currency": "USD", "main_office": true, "deleted": false, "language": null, "holiday_list": [], "location": "San Francisco, United States of America", "date_format": "MonthFirst", "created_at": "2019-09-21 03:52:22 UTC", "updated_at": "2019-09-21 03:52:22 UTC" }, "personal_detail": { "id": 21, "account_id": 1, "user_id": 21, "nick_name": null, "date_of_birth": null, "marital_status": null, "gender": null, "blood_group": null, "email": null, "street": null, "emergency_contacts": [], "social_profiles": [], "country_code": null, "zip_code": null, "state": null, "city": null, "phone_numbers": [ { "name": "Work", "number": "" } ], "communication_street": null, "communication_city": null, "communication_state": null, "communication_country_code": null, "communication_zip_code": null, "address": { }, "communication_address": { "same_as_residential": false }, "created_at": "2019-10-15 10:10:23 UTC", "updated_at": "2019-10-15 10:10:23 UTC" }, "additional_detail": { "id": 21, "account_id": 1, "user_id": 21, "eeo_gender": null, "eeo_veteran": null, "eeo_ethnicity": null, "eeo_disabled": null, "eeo_job_category": null, "eeo_company_code": null, "id_card_details": null, "hire_reason": null, "workstation_number": null, "secondary_business_email": null, "created_at": "2019-10-15 10:10:23 UTC", "updated_at": "2019-10-15 10:10:23 UTC", "work_numbers": [ { "name": "Work", "number": "" } ] }, "additional_personal_detail": { "id": 21, "account_id": 1, "user_id": 21, "secondary_last_name": null, "heriditary_last_name": null, "legal_name": null, "previous_name": null, "previous_name_change_date": null, "im_address": null, "place_of_birth": null, "country_of_birth": null, "flsa_required": false, "user_title_id": null, "user_suffix_name_id": null, "user_honorary_suffix_id": null, "user_professional_suffix_id": null, "user_academic_suffix_id": null, "citizenship_status_id": null, "deleted": false, "created_at": "2019-10-15 10:10:23 UTC", "updated_at": "2019-10-15 10:10:23 UTC" }, "termination_details": [ { "id": 21, "account_id": 1, "user_id": 21, "employment_end_date": null, "retirement_eligibility_date": null, "expected_retirement_date": null, "actual_retirement_date": null, "termination_date": null, "termination_reason": null, "notice_period": null, "notice_start_date": null, "notice_end_date": null, "retirement_status_id": null, "termination_category_id": null, "current": true, "created_at": "2019-10-15 10:10:23 UTC", "updated_at": "2019-10-15 10:10:23 UTC" } ], "visas": [], "background_verification_details": [], "government_documents": [], "bonuses": [], "stocks": [], "licenses": [], "certificates": [], "awards": [], "honors": [], "teams": [], "qualifications": [], "positions": [], "termination_requests": [] }, "actor": { "id": 13, "name": "Sean Dr. Greenfelder", "email": "651497celestina@example.com" } } }
EXPAND ↓

The following table lists the attributes of the employee object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the employee object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
first_name string First name of the employee.
last_name string Last name of the employee.
middle_name string Middle name of the employee.
user_emails array of strings Official email addresses of the employee.
employee_id string ID of the employee, provided by the organization.
status status object Employment status of the employee. The attributes of the status object are:
id (number) - ID of the status.
value (string) - Status value. Possible values: Active, Inactive, Draft, Deleted, Terminated
designation string Designation of the employee.
deleted boolean Specifies if the employee information has been deleted from the Freshteam database.
user_type object Type of employment assigned to the employee. Attributes of user_type object are:
id (number) - Identifier of the type of employment.
value (string) - Description of the type of employment. For example: full-time, contract, and so on.
custom_fields array of objects Key value pairs containing the names and values of custom fields.
updated_at string Time when the record was last modified, in date_time format. If an employee’s details are not updated, the updated_at value is the same as the created_at value.
created_at string Time when the record was created, in date_time format.
time_zone string Time-zone of the branch location.
language string Primary language at the branch location.
joining_date string Date when the employee joined the organization, specified in date format.
contract_end_date string Date when then employee contract ends, specified in date format.
leave_policy_id string Specifies the ID of the Time_off policy to which the employee is mapped.
reportees_count number Number of reportees assigned to the employee.
draft boolean Specifies if the created employee information is retained in the draft mode or saved for further processing.
level_id number Specifies the job band to which the employee belongs.
terminated boolean Set to 'false' if the employee is part of the organization.
sub_department_id number Specifies the subcategory of the job role to which the employee belongs.
twitter_id string Twitter handle of the employee.
facebook_id string Facebook ID of the employee.
seating_location string Employee’s workstation number.
internship_end_date string End date of the internship.
work_contact object Specifies the official contact numbers of the employee.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
branch branch object Specifies details of the branch office.
personal_detail personal_detail object Specifies personal details of the employee.
additional_detail additional_detail object Specifies additional details, such as gender, veteran, ethnicity, and so on, of the employee.
additional_personal_detail
(optional)
additional_personal_detail object Specifies supplementary details of the employee.
termination_details array of objects Specifies termination details of the employee.
visas array Specifies details of the employee's visas.
background_verification_details array Specifies the background verification details of the employee.
government_documents array Specifies the government documents uploaded by the employee.
bonuses array Details the employee’s various bonuses.
stocks array Specifies the employee’s stock grant options.
licenses array Specifies the license documents uploaded by the employee.
certificates array Specifies the certificates awarded to the employee.
awards array Specifies the awards associated with the employee.
honors array Specifies the honorary titles associated with the employee.
teams array Specifies the additional teams to which the employee belongs.
qualifications array Specifies details of the employee’s education.
positions array Specifies various roles/positions in the employee’s previous employment.
termination_requests array Specifies employee termination details.

The following table lists the attributes of the branch object.

ATTRIBUTE TYPE DESCRIPTION
id number ID of the branch office (location).
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
name string Specifies the name of the branch office.
street string Specifies the street where the branch is located.
city string Specifies the city in which the branch is located.
state string Specifies the province where the branch is located.
country_code string Specifies the country code where the branch is located.
zip string Specifies the ZIP or postal code of the region where the branch is located.
time_zone string Time zone of the region where the branch is located.
contact_info object Specifies the branch contact information.
currency string Specifies the currency code of the region where the branch is located.
main_office boolean Set to 'true' if the branch is the main office at a location.
deleted boolean Set to 'true' if the branch details have been deleted.
language string Primary language of the branch location.
holiday_list array Specifies the list of holidays in the branch location.
location string Specifies the location of the branch office.
date_format string Specifies the date format (MM-DD-YYYY) of the region where the branch is located.
created_at string Time when the branch was created, specified in date-time format.
updated_at string Time when the branch details were last modified, specified in date-time format.

The following table lists the attributes of the personal_detail object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the personal_detail object.
account_id number Auto-generated and uniquely identifies a customer account on Freshteam.
nick_name string Specifies an alternate display name for the employee.
date_of_birth string Specifies the employee's date of birth.
marital_status string Specifies if the employee is married or not.
gender string Specifies the gender of the employee.
blood_group string Specifies employee’s blood group.
email string Specifies the official email address of the employee.
street string Specifies the street name in the employee’s residential address.
emergency_contacts array Specifies the employee's emergency contact numbers.
social_profiles array Specifies the social profile information (linkedin, Facebook) of the employee.
country_code string Specifies the country code of the employee's residential address.
zip_code string Specifies the ZIP or postal code of the employee's residential address.
state string Specifies the state where the employee resides.
city string Specifies the city where the employee resides.
phone_numbers array of phone_numbers objects Specifies the personal phone numbers of the employee. The attributes of the phone_numbers object are:
name (string) - Type of phone number. Possible values (enum): Home, Mobile, Main, Others
number (string) - Personal contact number of the employee.
communication_street string Specifies the employee's official communication address.
communication_city string Specifies the city in the employee's official communication address.
communication_state string Specifies the state in the employee's official communication address.
communication_country_code string Specifies the country code in the employee's official communication address.
communication_zip_code string Specifies the ZIP or postal code in the employee's official communication address.
address address object Specifies the employee's residential address.
communication_address communication_address object Specifies the employee's official communication address. The attribute of the communication_address object is:
same_as_residential (boolean) - Set to 'true' if the communication address is the same as residential address.
created_at string Time when the employee's record was created, specified in date-time format.
updated_at string Time when the employee's record was last modified, specified in date-time format.

The following table lists the attributes of the additional_detail object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the additional_detail object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
eeo_gender string Details the gender category as specified in EEO.
eeo_veteran string Details the veteran category as specified in EEO.
eeo_ethnicity string Details the ethnicity category as specified in EEO.
eeo_disabled string Details the disabled category as specified in EEO.
eeo_job_category string Details the job category as specified in EEO.
eeo_company_code string Details the company code category as specified in EEO.
id_card_details string Specifies the employee's identification card details.
hire_reason string Specifies the reason why the employee was hired.
workstation_number string Specifies the number to contact the employee at the employee’s desk.
secondary_business_email string Secondary business email address of the employee.
created_at string Time when the additional_detail record was created, specified in date-time format.
updated_at string Time when the additional_detail record was last modified, specified in date-time format.
work_numbers array of work_numbers objects Specifies the official contact numbers of the employee. The attributes of the work_numbers object are:
name (string) - Type of phone number. Possible values (enum): Work, Office Ext., Mobile, Others
number (string) - Official contact number of the employee.

The following table lists the attributes of the termination_details object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the termination_detail object.
account_id number Auto-generated and uniquely identifies a customer account on Freshteam.
employment_end_date string Specifies the date when the employee's employment ends, in date format.
retirement_eligibility_date string Specifies the retirement date, if the employee is eligible, in date format.
expected_retirement_date string Specifies the date when the employee is expected to retire, in date format.
actual_retirement_date string Specifies the actual retirement date of the employee, in date format.
termination_date string Specifies the date when the employee leaves the organization, in date format.
termination_reason string Specifies the reason why the employee was terminated.
notice_period string Specifies the notice period of the employee.
notice_start_date string Specifies the notice period start date.
notice_end_date string Specifies the notice period end date.
retirement_status_id string Specifies the retirement status identifier.
termination_category_id string Specifies the termination category identifier.
current boolean Set to 'true' if it is the latest active termination request.
created_at string Time when the termination record was created, specified in date-time format.
updated_at string Time when the termination record was last modified, specified in date-time format.

The following table lists the attributes of the actor object.

ATTRIBUTE TYPE DESCRIPTION
id number Specifies the identfier of the person who created the record.
name string Specifies the name of the person who created the record.
email string Specifies the email address of the person who created the record.
onEmployeeUpdate

When a employee record is updated, the onEmployeeUpdate event is invoked and the registered callback method is executed.

Note: An employee's record deletion is captured by the onEmployeeUpdate event and the deleted field is changed to 'true' in the changes object. The changes field is passed along with the payload.

Use the following format to include the event in the server.js file.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onEmployeeUpdate", callback: "onEmployeeUpdateCallback" } ], onEmployeeUpdateCallback: function(payload) { console.log("Logging arguments from onEmployeeUpdate event: " + JSON.stringify(payload)); } }

Sample Code Copied Copy
1
2
3
4
5
6
7
8
9
10
11
exports = { events: [ { event: "onEmployeeUpdate", callback: "onEmployeeUpdateCallback" } ], onEmployeeUpdateCallback: function(payload) { console.log("Logging arguments from onEmployeeUpdate event: " + JSON.stringify(payload)); //Finding fields that are changed var changes = payload.data.employee.changes; //Your code goes here } }
EXPAND ↓

Sample Payload
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
{ "timestamp": 1496400354326, "account_id": 15, "domain": "sample.freshteam.com", "event": "onEmployeeUpdate", "region": "US", "data": { "employee": { "id": 9, "account_id": 1, "first_name": "Tyron", "last_name": "Dena", "middle_name": "Dr.", "user_emails": [ "124498fannie.jones@example.org", "marshall_powlowski@example.net" ], "employee_id": "1", "status": { "id": 1, "value": "Active" }, "designation": "Developer", "deleted": false, "user_category": { "id": 1, "value": "Regular" }, "user_type": { "id": 1, "value": "Contract" }, "custom_fields": [], "updated_at": "2019-10-11 06:18:10 -0700", "created_at": "2019-10-11 06:17:41 -0700", "time_zone": "US/Pacific", "language": "en", "demo": null, "confirmed": false, "joining_date": "2019-10-11", "shift_timings": "{:start_time=>\"09:00\", :end_time=>\"15:00\"}", "account_admin": false, "contract_end_date": "2019-03-21 11:30:00 -0700", "introduction": "[\"Eius aperiam omnis tenetur aut.\", \"Rerum sed doloremque neque et nulla aut porro consequuntur.\", \"Quam qui sed laborum porro quisquam nemo.\"]", "imported_id": null, "leave_policy_id": 1, "reportees_count": 0, "draft": false, "level_id": 1, "terminated": false, "sub_department_id": null, "twitter_id": null, "facebook_id": null, "seating_location": "559", "internship_end_date": "2019-03-23 11:30:00 -0700", "work_contact": { }, "current_sign_in_at": null, "last_sign_in_at": null, "current_sign_in_ip": null, "last_sign_in_ip": null, "misc": { "date_format": "MonthFirst" }, "failed_attempts": 0, "last_failed_login_ip": null, "ceo": false, "ancestry": "1", "signature": "<p>Thanks,<br>Freshteam Support</p>", "sign_in_count": 0, "root_user": false, "stripped_employee_id": null }, "associations": { "team": { "id": 1, "account_id": 1, "name": "Business", "email": null, "leader_id": null, "deleted": false, "created_at": "2019-10-11 06:17:26 -0700", "updated_at": "2019-10-11 06:17:26 -0700" }, "branch": { "id": 1, "account_id": 1, "name": "Default - Head office", "street": null, "city": "San Francisco", "state": null, "country_code": "US", "zip": null, "time_zone": "US/Pacific", "contact_info": { }, "currency": "USD", "main_office": true, "deleted": false, "language": null, "holiday_list": [], "location": "San Francisco, United States of America", "date_format": "MonthFirst", "created_at": "2019-10-11 06:17:26 -0700", "updated_at": "2019-10-11 06:17:26 -0700" }, "job_role": { "id": 1, "account_id": 1, "name": "Marketing", "deleted": false, "created_at": "2019-10-11 06:17:27 -0700", "updated_at": "2019-10-11 06:17:27 -0700" }, "reporting_to": { "id": 1, "account_id": 1, "first_name": "John", "last_name": "Smith", "middle_name": null, "user_emails": [ "john@freshteam.com" ], "employee_id": "E001", "status": { "id": 1, "value": "Active" }, "designation": null, "deleted": false, "user_category": { "id": 1, "value": "Regular" }, "user_type": { "id": 2, "value": "Full Time" }, "custom_fields": [ ], "updated_at": "2019-10-11 06:17:59 -0700", "created_at": "2019-10-11 06:17:27 -0700", "time_zone": "US/Pacific", "language": "en", "demo": null, "confirmed": true, "joining_date": "2019-10-11", "shift_timings": null, "account_admin": true, "contract_end_date": null, "introduction": null, "imported_id": null, "leave_policy_id": null, "reportees_count": 3, "draft": false, "level_id": null, "terminated": false, "sub_department_id": null, "twitter_id": null, "facebook_id": null, "seating_location": null, "internship_end_date": null, "work_contact": { }, "ancestry": null, "signature": null }, "hr_incharge": { "id": 1, "account_id": 1, "first_name": "John", "last_name": "Smith", "middle_name": null, "user_emails": [ "john@freshteam.com" ], "employee_id": "E001", "status": { "id": 1, "value": "Active" }, "designation": null, "deleted": false, "user_category": { "id": 1, "value": "Regular" }, "user_type": { "id": 2, "value": "Full Time" }, "custom_fields": [ ], "updated_at": "2019-10-11 06:17:59 -0700", "created_at": "2019-10-11 06:17:27 -0700", "time_zone": "US/Pacific", "language": "en", "demo": null, "confirmed": true, "joining_date": "2019-10-11", "shift_timings": null, "account_admin": true, "contract_end_date": null, "introduction": null, "imported_id": null, "leave_policy_id": null, "reportees_count": 3, "draft": false, "level_id": null, "terminated": false, "sub_department_id": null, "twitter_id": null, "facebook_id": null, "seating_location": null, "internship_end_date": null, "work_contact": { }, "current_sign_in_at": "2019-10-11 06:17:59 -0700", "last_sign_in_at": "2019-10-11 06:17:59 -0700", "current_sign_in_ip": "127.0.0.1", "last_sign_in_ip": "127.0.0.1", "misc": { "date_format": "MonthFirst" }, "failed_attempts": 0, "last_failed_login_ip": null, "ceo": false, "ancestry": null, "signature": null, "sign_in_count": 1, "root_user": false, "stripped_employee_id": null }, "level": { "id": 1, "name": "IC1", "account_id": 1, "created_at": "2019-10-11 06:17:27 -0700", "updated_at": "2019-10-11 06:17:27 -0700", "deleted": false }, "leave_policy": { "id": 1, "account_id": 1, "name": "Demo Policy", "description": null, "policy_start_date": "2019-01-01", "status": { "id": 1, "value": "Active" }, "default": true, "deleted": false, "demo": true, "created_at": "2019-10-11 06:17:37 -0700", "updated_at": "2019-10-11 06:17:37 -0700", "transfer_leaves": false }, "personal_detail": { "id": 9, "account_id": 1, "user_id": 9, "nick_name": null, "date_of_birth": null, "marital_status": null, "gender": null, "blood_group": null, "email": null, "street": null, "emergency_contacts": [ ], "social_profiles": [ ], "country_code": null, "zip_code": null, "state": null, "city": null, "phone_numbers": [ { "name": "Work", "number": "" } ], "communication_street": null, "communication_city": null, "communication_state": null, "communication_country_code": null, "communication_zip_code": null, "address": { }, "communication_address": { }, "created_at": "2019-10-11 06:17:41 -0700", "updated_at": "2019-10-11 06:17:41 -0700" }, "additional_detail": { "id": 9, "account_id": 1, "user_id": 9, "eeo_gender": null, "eeo_veteran": null, "eeo_ethnicity": null, "eeo_disabled": null, "eeo_job_category": null, "eeo_company_code": null, "id_card_details": null, "hire_reason": null, "workstation_number": null, "secondary_business_email": null, "created_at": "2019-10-11 06:17:41 -0700", "updated_at": "2019-10-11 06:17:41 -0700", "work_numbers": [ { "name": "Work", "number": "" } ] }, "additional_personal_detail": { "id": 9, "account_id": 1, "user_id": 9, "secondary_last_name": null, "heriditary_last_name": null, "legal_name": null, "previous_name": null, "previous_name_change_date": null, "im_address": null, "place_of_birth": null, "country_of_birth": null, "flsa_required": false, "user_title_id": null, "user_suffix_name_id": null, "user_honorary_suffix_id": null, "user_professional_suffix_id": null, "user_academic_suffix_id": null, "citizenship_status_id": null, "deleted": false, "created_at": "2019-10-11 06:17:41 -0700", "updated_at": "2019-10-11 06:17:41 -0700" }, "termination_details": [ { "id": 9, "account_id": 1, "user_id": 9, "employment_end_date": null, "retirement_eligibility_date": null, "expected_retirement_date": null, "actual_retirement_date": null, "termination_date": null, "termination_reason": null, "notice_period": null, "notice_start_date": null, "notice_end_date": null, "retirement_status_id": null, "termination_category_id": null, "current": true, "created_at": "2019-10-11 06:17:41 -0700", "updated_at": "2019-10-11 06:17:41 -0700" } ], "visas": [], "background_verification_details": [], "government_documents": [], "bonuses": [], "stocks": [], "licenses": [], "certificates": [], "awards": [], "honors": [], "teams": [], "qualifications": [], "termination_requests": [], "positions": [ { "id": 1, "account_id": 1, "user_id": 9, "company": "Hills-Grimes", "start_date": "2009-09-22 11:30:00 -0700", "end_date": "2015-07-25 11:30:00 -0700", "role": "Lead Security Administrator", "job_type": 0, "location": null, "country_code": "KR", "state_code": "PA", "city": "Gutmannhaven", "description": null, "other_salary_components": null, "salary_value": null, "references": null, "deleted": false, "currency": null, "created_at": "2019-10-11 06:18:10 -0700", "updated_at": "2019-10-11 06:18:10 -0700" } ], "cost_center": { "id": 51, "account_id": 1, "value": "Costcenter 1", "position": 1, "deleted": false, "created_at": "2019-10-11 06:17:29 -0700", "updated_at": "2019-10-11 06:17:29 -0700", "type": 8 } }, "actor": { "id": 9, "name": "Tyron Dr. Dena", "email": "124498fannie.jones@example.org" }, "changes": { "model_changes": { "user_type": [ 2, 1 ], "branch_id": [ 2, 1 ], "first_name": [ "Wanetta", "Tyron" ], "middle_name": [ "Ms.", "Dr." ], "last_name": [ "Stamm", "Dena" ], "joining_date": [ "2019-06-17", "2019-10-11" ], "designation": [ "Forward Marketing Coordinator", "Developer" ], "updated_at": [ "2019-10-11T06:17:41.000-07:00", "2019-10-11T13:18:10.000Z" ] } } } }
EXPAND ↓

The following table lists the attributes of the employee object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the employee object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
first_name string First name of the employee.
last_name string Last name of the employee.
middle_name string Middle name of the employee.
user_emails array of strings Official email addresses of the employee.
employee_id string ID of the employee, provided by the organization.
status status object Employment status of the employee. The attributes of the status object are:
id (number) - ID of the status.
value (string) - Status value. Possible values: Active, Inactive, Draft, Deleted, Terminated
designation string Designation of the employee.
deleted boolean Specifies if the employee information has been deleted from the Freshteam database.
user_type object Type of employment assigned to the employee. For example: full-time, contract, and so on.
custom_fields array of objects Key value pairs containing the names and values of custom fields.
updated_at string Time when the record was last modified, in date_time format. If an employee’s details are not updated, the updated_at value is the same as the created_at value.
created_at string Time when the record is created, in date_time format.
time_zone string Time-zone of the branch location.
language string Primary language at the branch location.
joining_date string Date when the employee joins the organization, specified in date format.
contract_end_date string Date when then employee contract ends, specified in date format.
leave_policy_id string Specifies the ID of the Time_off policy to which the employee is mapped.
reportees_count number Number of reportees assigned to the employee.
draft boolean Specifies if the created employee information is retained in the draft mode or saved for further processing.
level_id number Specifies the job band to which the employee belongs.
terminated boolean Set to 'false' if the employee is part of the organization.
sub_department_id number Specifies the subcategory of the job role to which the employee belongs.
twitter_id string Twitter handle of the employee.
facebook_id string Facebook ID of the employee.
seating_location string Employee’s workstation number.
internship_end_date string End date of the internship.
work_contact object Specifies the official contact numbers of the employee.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
team team object Specifies the primary team to which the employee belongs.
branch branch object Specifies details of the branch office.
job_role job_role object Specifies the department to which the employee belongs.
reporting_to reporting_to object Specifies the reporting manager of the employee.
hr_incharge hr_incharge object Specifies the HR manager of the employee.
level level object Specifies the job band to which the employee belongs.
leave_policy leave_policy object Specifies the leave of absence information of the employee.
personal_detail personal_detail object Specifies personal details of the employee.
additional_detail additional_detail object Specifies additional details of the employee.
additional_personal_detail
(optional)
additional_personal_detail object Specifies supplementary details of the employee.
termination_details array of objects Specifies termination details of the employee.
visas array Specifies details of the employee's visas.
background_verification_details array Specifies the background verification details of the employee.
government_documents array Specifies the government documents uploaded by the employee.
bonuses array Details the employee’s various bonuses.
stocks array Specifies the employee’s stock grant options.
licenses array Specifies the license documents uploaded by the employee.
certificates array Specifies the certificates awarded to the employee.
awards array Specifies the awards associated with the employee.
honors array Specifies the honorary titles associated with the employee.
teams array Specifies the additional teams to which the employee belongs.
qualifications array Specifies details of the employee’s education.
positions array Specifies various roles/positions in the employee’s previous employment.
cost_center cost_center object Specifies the cost group to which the employee belong.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE DESCRIPTION
model_changes model_changes object Specifies the updated keys with old and new values.

The following table lists the attributes of the team object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the team object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
name string Describes the identifier of the team.
email string Specifies the official email address of the department/team.
leader_id string Specifies the identifier of the team leader.
deleted boolean Set to 'true' if the team is still a valid grouping in the organization.
created_at string Time when the team was created in the organization, specified in date-time format.
updated_at string Time when the team name was last modified, specified in the date-time format.

The following table lists the attributes of the job_role object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the job_role object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
name string Specifies the department.
deleted boolean Specifies if the department still exists in the organization.
created_at string Time when the department was created in the organization, specified in date-time format.
updated_at string Time when the department name was last modified, specified in the date-time format.

The following table lists the attributes of the reporting_to/hr_incharge object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the employee object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
first_name string Specifies the business name of the reporting manager or HR.
last_name string Specifies the last name of the reporting manager or HR.
middle_name string Specifies the middle name of the reporting manager or HR.
user_emails array Specifies the official email addresses of the reporting manager or HR.
employee_id string Specifies the employee ID of the reporting manager or HR.
status status object Employment status of the reporting manager or HR. The attributes of the status object are:
id (number) - ID of the status.
value (string) - Status value.
designation string Specifies the designation of the reporting manager or HR.
deleted boolean Specifies if the reporting manager or HR information has been deleted from the Freshteam system.
user_type user_type object Type of employment assigned to the reporting manager or HR. Attributes of user_type object are:
id (number) - Identifier of the type of employment.
value (string) - Description of the type of employment. For example: full-time, contract, and so on.
custom_fields array of objects Key value pairs containing the names and values of custom fields.
created_at string Time when the record was created, specified in date-time format.
updated_at string Time when the record was last modified, specified in the date-time format.
time_zone string Time-zone of the branch location.
language string Primary language at the branch location.
joining_date string Date when the reporting manager or HR joined the organization, specified in date format.
contract_end_date string Date when then the reporting manager's or HR's contract ends, specified in date format.
leave_policy_id string Specifies the ID of the Time_off policy to which the reporting manager or HR is mapped.
reportees_count number Number of reportees assigned to the reporting manager or HR.
draft boolean Specifies if the created reporting manager or HR information is retained in the draft mode or saved for further processing.
level_id number Specifies the job band to which the reporting manager or HR belongs.
terminated boolean Set to 'false' if the reporting manager or HR is part of the organization.
sub_department_id number Specifies the subcategory of the job role to which the reporting manager or HR belongs.
twitter_id string Twitter handle of the reporting manager or HR.
facebook_id string Facebook ID of the reporting manager or HR.
seating_location string Reporting manager's or HR’s workstation number.
internship_end_date string End date of the internship.
work_contact object Specifies the official contact numbers of the reporting manager or HR.
level
(HR specific)
level object Specifies the various job bands in an organization. Attributes of the level object are:
id (number) - ID of the job band.
name (string) - Describes the identifier of the level.
account_id (number) - Auto-generated value and uniquely identifies a customer account on Freshteam
created_at (string) - Time when the level was created in the organization, specified in the date-time format.
updated_at (string) - Time when the level details were last modified, specified in the date-time format.
deleted (boolean) - Specifies if the level is still a valid hierarchy in the organization.
leave_policy
(HR specific)
leave_policy object Specifies various leave policies available in the organization. Attributes of the leave_policy object are:
id (number) - ID of the leave policy.
account_id (number) - Auto-generated value and uniquely identifies a customer account on Freshteam
name (string) - Describes the identifier of the leave policy.
description (string) - Description of the leave policy.
policy_start_date (string) - Time when the leave policy was enforced in the organization, specified in the date-time format.
status (object) - Status of the policy. created_at (string) - Time when the leave policy was created in the organization, specified in the date-time format.
updated_at (string) - Time when the leave policy details were last modified, specified in the date-time format.
deleted (boolean) - Specifies if the level is still a valid hierarchy in the organization.

The following table lists the attributes of the actor object.

ATTRIBUTE TYPE DESCRIPTION
id number Specifies the identfier of the person who created the record.
name string Specifies the name of the person who created the record.
email string Specifies the email address of the person who created the record.
onNewHireCreate

When a new hire is onboarded, the onNewHireCreate event is invoked and the registered callback method is executed.

Use the following format to include the event in the server.js file.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onNewHireCreate", callback: "onNewHireCreateCallback" } ], onNewHireCreateCallback: function(payload) { console.log("Logging arguments from onNewHireCreate event: " + JSON.stringify(payload)); } }

Sample Payload
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
{ "timestamp": 1496400354326, "account_id": 15, "domain": "sample.freshteam.com", "event": "onNewHireCreate", "region": "US", "data": { "newhire": { "id": 14, "account_id": 1, "first_name": "Jamar", "last_name": "Kristal", "middle_name": null, "user_emails": [ "lawrence_nicolas@example.com" ], "employee_id": null, "status": { "id": 1, "value": "Active" }, "designation": "Developer", "deleted": false, "user_category": { "id": 4, "value": "Onboarding" }, "user_type": { "id": 2, "value": "Full Time" }, "custom_fields": [ ], "updated_at": "2019-10-11 13:00:16 UTC", "created_at": "2019-10-11 13:00:16 UTC", "time_zone": "Chennai", "language": "en", "demo": null, "confirmed": false, "joining_date": "2019-10-11", "shift_timings": null, "account_admin": false, "contract_end_date": null, "introduction": null, "imported_id": null, "leave_policy_id": null, "draft": false, "level_id": null, "terminated": false, "sub_department_id": null, "twitter_id": null, "facebook_id": null, "seating_location": null, "internship_end_date": null, "work_contact": { }, "ancestry": "1", "signature": null }, "associations": { "branch": { "id": 4, "account_id": 1, "name": "Edmundo Barton", "street": "4643 Ginny Viaduct", "city": "Lake Baoberg", "state": "New York", "country_code": "AU", "zip": "55792", "time_zone": "Chennai", "contact_info": { }, "currency": "BRL", "main_office": false, "deleted": false, "language": "en", "holiday_list": [], "location": "Lake Baoberg, Australia", "date_format": "MonthFirst", "created_at": "2019-10-11 12:59:17 UTC", "updated_at": "2019-10-11 12:59:17 UTC" }, "personal_detail": { "id": 14, "account_id": 1, "user_id": 14, "nick_name": null, "date_of_birth": null, "marital_status": null, "gender": null, "blood_group": null, "email": null, "street": null, "emergency_contacts": [], "social_profiles": [], "country_code": null, "zip_code": null, "state": null, "city": null, "phone_numbers": [ { "name": "Work", "number": "" } ], "communication_street": null, "communication_city": null, "communication_state": null, "communication_country_code": null, "communication_zip_code": null, "address": { }, "communication_address": { }, "created_at": "2019-10-11 13:00:16 UTC", "updated_at": "2019-10-11 13:00:16 UTC" }, "additional_detail": { "id": 14, "account_id": 1, "user_id": 14, "eeo_gender": null, "eeo_veteran": null, "eeo_ethnicity": null, "eeo_disabled": null, "eeo_job_category": null, "eeo_company_code": null, "id_card_details": null, "hire_reason": null, "workstation_number": null, "secondary_business_email": null, "created_at": "2019-10-11 13:00:16 UTC", "updated_at": "2019-10-11 13:00:16 UTC", "work_numbers": [ { "name": "Work", "number": "" } ] }, "additional_personal_detail": { "id": 14, "account_id": 1, "user_id": 14, "secondary_last_name": null, "heriditary_last_name": null, "legal_name": null, "previous_name": null, "previous_name_change_date": null, "im_address": null, "place_of_birth": null, "country_of_birth": null, "flsa_required": false, "user_title_id": null, "user_suffix_name_id": null, "user_honorary_suffix_id": null, "user_professional_suffix_id": null, "user_academic_suffix_id": null, "citizenship_status_id": null, "deleted": false, "created_at": "2019-10-11 13:00:16 UTC", "updated_at": "2019-10-11 13:00:16 UTC" }, "visas": [], "background_verification_details": [], "government_documents": [], "bonuses": [], "stocks": [], "licenses": [], "certificates": [], "awards": [], "honors": [], "teams": [], "qualifications": [], "positions": [] }, "actor": { "id": 13, "name": "Sean Dr. Greenfelder", "email": "651497celestina@example.com" } } }
EXPAND ↓

The following table lists the attributes of the newhire object.

ATTRIBUTE TYPE DESCRIPTION
id number Auto-generated value and is used to identify the new hire object.
account_id number Auto-generated value and uniquely identifies a customer account on Freshteam.
first_name string First name of the new hire.
last_name string Last name of the new hire.
middle_name string Middle name of the new hire.
user_emails array of strings Official email addresses of the new hire.
employee_id string ID of the new hire, provided by the organization.
status status object Employment status of the new hire. The attributes of the status object are:
id (number) - ID of the status.
value (string) - Status value. Possible values: Active, Inactive, Draft, Deleted, Terminated
designation string Designation of the new hire.
deleted boolean Specifies if the new hire information has been deleted from the Freshteam database.
user_type object Type of employment assigned to the new hire. For example: full-time, contract, and so on.
custom_fields array of objects Key value pairs containing the names and values of custom fields.
updated_at string Time when the record was last modified, in date_time format. If an new hire’s details are not updated, the updated_at value is the same as the created_at value.
created_at string Time when the record is created, in date_time format.
time_zone string Time-zone of the branch location.
language string Primary language at the branch location.
joining_date string Date when the new hire joins the organization, specified in date format.
contract_end_date string Date when then new hire's contract ends, specified in date format.
leave_policy_id string Specifies the ID of the Time_off policy to which the new hire is mapped.
draft boolean Specifies if the created new hire information is retained in the draft mode or saved for further processing.
level_id number Specifies the job band to which the new hire belongs.
terminated boolean Set to 'false' if the new hire is part of the organization.
sub_department_id number Specifies the subcategory of the job role to which the new hire belongs.
twitter_id string Twitter handle of the new hire.
facebook_id string Facebook ID of the newhire.
seating_location string New hire's workstation number.
internship_end_date string End date of the internship.
work_contact object Specifies the official contact numbers of the new hire.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
branch branch object Specifies details of the branch office.
personal_detail personal_detail object Specifies personal details of the new hire.
additional_detail additional_detail object Specifies additional details of the new hire.
additional_personal_detail
(optional)
additional_personal_detail object Specifies supplementary details of the new hire.
visas array Specifies details of the enew hire's visas.
background_verification_details array Specifies the background verification details of the new hire.
government_documents array Specifies the government documents uploaded by the new hire.
bonuses array Details the new hire’s various bonuses.
stocks array Specifies the new hire’s stock grant options.
licenses array Specifies the license documents uploaded by the new hire.
certificates array Specifies the certificates awarded to the new hire.
awards array Specifies the awards associated with the new hire.
honors array Specifies the honorary titles associated with the new hire.
teams array Specifies the additional teams to which the new hire belongs.
qualifications array Specifies details of the new hire’s education.
positions array Specifies various roles/positions in the new hire’s previous employment.

The following table lists the attributes of the actor object.

ATTRIBUTE TYPE DESCRIPTION
id number Specifies the identfier of the person who created the record.
name string Specifies the name of the person who created the record.
email string Specifies the email address of the person who created the record.
Testing

Note: For testing, we recommend that you use the latest version of Chrome browser.

You can test your app on your computer by simulating events, and you can test different scenarios by directly modifying the payload.

Note:
As the testing is only a simulation of events, an actual event will not be recorded in the back end. If you need an actual record to be created, then it is recommended to publish your app as a custom app and test the operation manually.

To simulate events for testing, follow the given steps.

  1. From the command line, navigate to your project directory and run the following command. $ fdk run
  2. In the browser, enter the following URL to test the app: http://localhost:10001/web/events.
  3. Select the event that you want to simulate.
  4. Once you select an event, the corresponding event payload is displayed. Edit the values and then click Simulate. When you edit the payload, ensure that you adhere to the JSON format.