Product Events

These are Freshsales events, such as contact create, deal update, and lead create and so on, which can trigger apps. When product events occur, the appropriate method in the server.js file is invoked.

Note:
1. You need to have CLI v5.0.0 to use this feature. For more information on how to get the latest version, click here.
2. 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 Freshsales account ID.
domain string Freshsales account domain.
event string Name of the event.
region string Region where the app is installed, will be either "US", "IND", "EUC", or "AUS".
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.

onContactCreate

When a contact is created, the onContactCreate 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: "onContactCreate", callback: "onContactCreateCallback" } ], onContactCreateCallback: function(payload) { console.log("Logging arguments from onContactCreate event: " + JSON.stringify(payload)); } }
Sample Code Copied Copy
1
2
3
4
5
6
7
8
9
10
exports = { events: [ { event: "onContactCreate", callback: "onContactCreateCallback" } ], onContactCreateCallback: function(payload) { console.log("Logging arguments from onContactCreate event: " + JSON.stringify(payload)); //Print the new contact and email. console.log("Contact name - ", payload.data.contact.name, "\n email - ", payload.data.contact.email); } }
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
{ "iparams": {}, "region": "US", "data": { "contact": { "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "first_name": { "label": "First name", "type": "text", "value": "po" }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "dom_type": "text", "value": "po dsg" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-07-29T05:17:56Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "job_title": { "label": "Job title", "type": "text", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 14266 }, "contact_status_id": { "label": "Status", "type": "dropdown", "value": null }, "lead_quality": { "label": "Lead quality", "type": "dropdown", "value": "Cold" }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-07-29T05:17:56Z" }, "country": { "label": "Country", "type": "text", "value": null }, "medium": { "label": "Medium", "type": "text", "value": null }, "keyword": { "label": "Keyword", "type": "text", "value": null }, "department": { "label": "Department", "type": "text", "value": null }, "id": 505742, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "email_status": { "label": "Email status", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "last_name": { "label": "Last name", "type": "text", "value": "dsg" }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "status": "Active", "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-07-29T05:17:55Z" }, "do_not_disturb": { "label": "Do not disturb", "type": "checkbox", "value": false }, "import_id": null, "sales_account_ids": [], "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "has_authority": { "label": "Has authority", "type": "checkbox", "value": false }, "merged_to": 0, "emails": { "label": "Emails", "type": "group_field", "value": [] }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-07-29T06:01:16Z" }, "work_number": { "label": "Work", "type": "phone_number", "value": null }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "lead_score": { "label": "Lead score", "type": "number", "value": 1 }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "last_seen": { "label": "Last seen", "type": "date_time", "value": null }, "time_zone": { "label": "Time zone", "type": "dropdown", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 14266 }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": null }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": null } }, "associations": { "source": null, "campaign": null, "creator": { "deal_pipeline_id": 1316, "name": "Rachel john", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "contact_status": null, "owner": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "sales_accounts": [] }, "changes": { "model_changes": { "first_name": ["poopsrdtfgyujiko", "po"], "updater_id": [null, 14266], "updated_at": ["2019-07-29T05:17:55Z", "2019-07-29T06:01:16Z"] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onContactUpdate", "timestamp": 1564380076.151892, "version": "2.0" }
EXPAND ↓

The following table lists the attributes of the contact object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
open_deals_amount number Sum of all the open deals associated with the contact.
first_name string First name of the contact.
last_name string Last name of the contact.
city string City where the contact resides.
zipcode string Zipcode.
name string First and last name of the contact.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the contact resides.
lead_source_id number ID of the source.
job_title string Job title of the contact.
tags array of strings Tags associated with this contact.
linkedin string Linkedin address of the contact.
import_csv_id string Reference of all imports that this contact was part of.
creator_id number ID of the user who created the contact.
won_deals_amount string Sum of all won deals associated with the contact.
active_sales_sequences array of numbers Active sales campaigns that this contact was part of.
owner_id number User who owns the record.
contact_status_id number ID of the contact status.
lead_quality string Category to which the lead belongs to.
is_deleted boolean Set to 'true' if contact is deleted.
last_assigned_at datetime Last assigned timestamp.
country string Country of the contact.
medium string Medium tracked in UTM.
keyword string Keyword tracked in UTM.
department string Department of the contact.
id number ID of the contact.
territory_id number ID of the territory.
email_status string Status of the email: active, invalid, or bounced.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
status string Status of the contact. The values are: active, merged, or deleted.
address string Address of the contact.
created_at datetime Contact creation timestamp.
do_not_disturb boolean Set to 'true' if contact is not to be disturbed.
import_id string ID of the equivalent record in the external system from which it was imported.
sales_account_ids array of numbers IDs of the sales account associated with this contact.
twitter string Twitter handle of the contact.
recent_note string Recently added note against the contact.
has_authority boolean Set to 'true' if contact has authority to make decisions.
merged_to array of numbers Reference of secondary contacts merged to the primary contact.
emails array of strings Primary and secondary emails associated with this contact.
updated_at datetime Updated timestamp.
work_number string Telephone number of the contact.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered to the contact.
lead_score number Score to qualify a contact.
completed_sales_sequences array of numbers Completed sales sequences that this contact was part of.
campaign_id string ID of the UTM campaign.
last_seen datetime Last seen timestamp.
time_zone string Time zone of the contact.
updater_id number ID of the user who updated the contact.
web_form_ids array of numbers Forms through which this record was captured.
mobile_number number Mobile number of the contact.
associations object Associations of the contact.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
source string Source details of this contact.
campaign string UTM campaign.
creator object Details of contact creator.
territory string Territory of the contact.
contact_status string Qualification status of the contact.
owner object Details of the contact owner.
updater object Details of the contact updater.
sales_accounts array of numbers Sales accounts of the contact.

The following table lists the attributes of the user object. Here, the user can be the owner, updater, or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.
onContactUpdate

When a contact is updated, the onContactUpdate event is invoked and the registered callback method is executed.

Note: This event is not triggered when an existing contact is converted to an lead.

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: "onContactUpdate", callback: "onContactUpdateCallback" } ], onContactUpdateCallback: function(payload) { console.log("Logging arguments from onContactUpdate event: " + JSON.stringify(payload)); } }

Sample Code Copied Copy
1
2
3
4
5
6
7
8
9
10
11
exports = { events: [ { event: "onContactUpdate", callback: "onContactUpdateCallback" } ], onContactUpdateCallback: function(payload) { console.log("Logging arguments from onContactUpdate event: " + JSON.stringify(payload)); //Finding fields that are changed. var changes = payload.data.contact.changes; // Your code to work with changes. } }
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
"iparams": {}, "region": "US", "data": { "contact": { "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "first_name": { "label": "First name", "type": "text", "value": "passshjjn" }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "dom_type": "text", "value": "passshjjn dsg" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-07-29T05:17:56Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "job_title": { "label": "Job title", "type": "text", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 14266 }, "contact_status_id": { "label": "Status", "type": "dropdown", "value": null }, "lead_quality": { "label": "Lead quality", "type": "dropdown", "value": "Cold" }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-07-29T05:17:56Z" }, "country": { "label": "Country", "type": "text", "value": null }, "medium": { "label": "Medium", "type": "text", "value": null }, "keyword": { "label": "Keyword", "type": "text", "value": null }, "department": { "label": "Department", "type": "text", "value": null }, "id": 505742, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "email_status": { "label": "Email status", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "last_name": { "label": "Last name", "type": "text", "value": "dsg" }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "status": "Active", "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-07-29T05:17:55Z" }, "do_not_disturb": { "label": "Do not disturb", "type": "checkbox", "value": false }, "import_id": null, "sales_account_ids": [], "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "has_authority": { "label": "Has authority", "type": "checkbox", "value": false }, "merged_to": 0, "emails": { "label": "Emails", "type": "group_field", "value": [] }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-12T12:59:55Z" }, "work_number": { "label": "Work", "type": "phone_number", "value": null }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "lead_score": { "label": "Lead score", "type": "number", "value": 1 }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "last_seen": { "label": "Last seen", "type": "date_time", "value": null }, "time_zone": { "label": "Time zone", "type": "dropdown", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 14266 }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": null }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": null } }, "associations": { "source": null, "campaign": null, "creator": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "contact_status": null, "owner": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "sales_accounts": [] }, "changes": { "model_changes": { "first_name": ["po", "passshjjn"], "updated_at": ["2019-07-29T06:01:16Z", "2019-08-12T12:59:55Z"] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onContactUpdate", "timestamp": 1565614795.8707037, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When a contact is deleted, the is_deleted field is set to 'true'.

The following table lists the attributes of the contact object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
open_deals_amount number Sum of all the open deals associated with the contact.
first_name string First name of the contact.
last_name string Last name of the contact.
city string City where the contact resides.
zipcode string Zipcode.
name string First and last name of the contact.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the contact resides.
lead_source_id number ID of the source.
job_title string Job title of the contact.
tags array of strings Tags associated with this contact.
linkedin string Linkedin address of the contact.
import_csv_id string Reference of all imports that this contact is part of.
creator_id number ID of the user who created the contact.
won_deals_amount string Sum of all won deals associated with the contact.
active_sales_sequences array of numbers Active sales campaigns that this contact was part of.
owner_id number User who owns the record.
contact_status_id number ID of the contact status.
lead_quality string Category to which the lead belongs to.
is_deleted boolean Set to 'true' if contact is deleted.
last_assigned_at datetime Last assigned timestamp.
country string Country of the contact.
medium string Medium tracked in UTM.
keyword string Keyword tracked in UTM.
department string Department of the contact.
id number ID of the contact.
territory_id number ID of the territory.
email_status string Status of the email: active, invalid, or bounced.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
status string Status of the contact. The values are: active, merged, or deleted.
address string Address of the contact.
created_at datetime Contact creation timestamp.
do_not_disturb boolean Set to 'true' if contact is not to be disturbed.
import_id string ID of the equivalent record in the external system from which it was imported.
sales_account_ids array of numbers IDs of the sales account associated with this contact.
twitter string Twitter handle of the contact.
recent_note string Recently added note against the contact.
has_authority boolean Set to 'true' if contact has authority to make decisions.
merged_to array of numbers Reference of secondary contacts merged to the primary contact.
emails array of strings Primary and secondary emails associated with this contact.
updated_at datetime Updated timestamp.
work_number string Telephone number of the contact.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered to the contact.
lead_score number Score to qualify a contact.
completed_sales_sequences array of numbers Completed sales sequences that this contact was part of.
campaign_id string ID of the UTM campaign.
last_seen datetime Last seen timestamp.
time_zone string Time zone of the contact.
updater_id number ID of the user who updated the contact.
web_form_ids array of numbers Forms through which this record was captured.
mobile_number number Mobile number of the contact.
associations object Associations of the contact.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
source string Source details of this contact.
campaign string UTM campaign.
creator object Details of contact creator.
territory string Territory of the contact.
contact_status string Qualification status of the contact.
owner object Details of the contact owner.
updater object Details of the contact updater.
sales_accounts array of numbers Sales accounts of the contact.

The following table lists the attributes of the user object. Here, the user can be the owner, updater, or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
model_changes object All changes made in the details of default and custom fields.
system_changes string Changes performed by the system.
misc_changes string Miscellaneous changes made.
onDealCreate

When a deal is created, the onDealCreate 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: "onDealCreate", callback: "onDealCreateCallback" } ], onDealCreateCallback: function(payload) { console.log("Logging arguments from onDealCreate 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
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
{ "iparams": {}, "region": "US", "data": { "deal": { "deal_pipeline_id": { "label": "Deal pipeline", "type": "dropdown", "value": 1316 }, "deal_product_id": { "label": "Product", "type": "dropdown", "value": null }, "name": { "label": "Name", "type": "text", "value": "rachel" }, "custom_fields": [], "upcoming_activities_time": { "label": "Upcoming activities", "type": "date_time", "value": null }, "deal_type_id": { "label": "Type", "type": "dropdown", "value": null }, "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-08-12T14:27:01Z" }, "web_form_id": { "label": "Web form", "type": "dropdown", "value": null }, "contact_ids": [], "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 13479 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-12T14:27:01Z" }, "expected_close": { "label": "Expected close date", "type": "date", "value": null }, "won_from": null, "age": { "label": "Age (in days)", "type": "number", "value": null }, "amount": { "label": "Deal value", "type": "decimal", "value": "0.0" }, "deal_stage_id": { "label": "Deal stage", "type": "dropdown", "value": 9519 }, "base_currency_amount": { "label": "Deal value in Base Currency", "type": "decimal", "value": "0.0" }, "id": 560340, "deal_reason_id": { "label": "Lost reason", "type": "dropdown", "value": null }, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "sales_account_id": { "label": "Account name", "type": "auto_complete", "value": null }, "deal_payment_status_id": { "label": "Payment status", "type": "dropdown", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-08-12T14:27:00Z" }, "import_id": null, "expected_deal_value": { "label": "Expected deal value", "type": "decimal", "value": "0.0" }, "currency_id": { "label": "Currency", "type": "dropdown", "value": 338 }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "stage_updated_time": { "label": "Deal stage updated at", "type": "date_time", "value": "2019-08-12T14:27:00Z" }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-12T14:27:00Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "closed_date": { "label": "Closed date", "type": "date", "value": null }, "lost_from": null, "deal_prediction_tag": { "label": "Deal Prediction", "dom_type": "text", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": null }, "probability": { "label": "Probability (%)", "type": "decimal", "value": 100 } }, "associations": { "source": null, "deal_payment_status": null, "campaign": null, "deal_pipeline": { "id": 1316, "name": "Default Pipeline", "position": 1, "is_default": true }, "contacts": [], "creator": { "deal_pipeline_id": 1316, "name": "Rachel", "is_active": true, "email": "rachel@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "sales_account": null, "deal_stage": { "id": 9519, "name": "New", "position": 1, "forecast_type": "Open" }, "territory": null, "deal_product": null, "currency": { "id": 338, "currency_code": "USD", "exchange_rate": "1.0" }, "owner": { "deal_pipeline_id": 1316, "name": "guru guru", "is_active": true, "email": "rachel.doe@freshworks.com", "job_title": null, "id": 13479, "created_at": "2019-07-11T08:34:27Z", "type": "user", "updated_at": "2019-07-11T08:36:27Z", "work_number": "125125", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": null, "deal_reason": null, "deal_type": null } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onDealCreate", "timestamp": 1565620020.7590804, "version": "2.0" }
EXPAND ↓

The following table lists the attributes of the deal object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
deal_pipeline_id number ID of deal pipeline.
deal_product_id number ID of the product that the deal is associated with.
name string Name of the deal.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
upcoming_activities_time datetime Timestamp for next scheduled activity.
deal_type_id number ID of the deal type.
first_assigned_at datetime First assigned timestamp of the deal.
web_form_id number Form through which this deal was captured.
contact_ids array of numbers IDs of contacts associated with this deal.
lead_source_id number ID of the source of the deal.
tags array of strings Tags associated with this deal.
import_csv_id string Reference of all imports that this deal was part of.
creator_id number ID of the user who created the deal.
active_sales_sequences array of numbers Active sales campaigns that this deal was part of.
owner_id number User who owns the record.
is_deleted boolean Set to 'true' if deal is deleted.
last_assigned_at datetime Last assigned timestamp.
expected_close date Expected close date of the deal.
won_from string Stage from which deal was won.
age number Time elapsed (in days) since the creation of the deal.
amount number Value of the deal.
deal_stage_id number ID of the deal stage.
base_currency_amount number Deal amount converted to base currency configured by admin.
id number ID of the deal.
deal_reason_id number ID of the reason why the deal was lost.
territory_id number ID of the territory.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
sales_account_id string ID of sales account associated with this deal.
deal_payment_status_id number ID of deal payment status.
created_at datetime Created timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
expected_deal_value number Expected deal amount.
currency_id number ID of currency associated with the deal.
recent_note string Recently added note against the deal.
stage_updated_time datetime Timestamp when the deal stage was updated.
updated_at datetime Updated timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered for the deal.
completed_sales_sequences array of numbers Completed sales sequences that this deal was part of.
campaign_id string ID of the UTM campaign.
closed_date datetime Closed date of the deal.
lost_from string Stage where the deal was lost.
updater_id number ID of the user who updated the deal.
probability number Probability of closing the deal.
associations object Associations of the deal.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
source string Source details of this deal.
deal_payment_status string Status of the deal payment.
campaign string UTM campaign.
deal_pipeline object Details of deal pipeline.
contacts array of strings Contacts associated with this deal.
creator object Details of the deal creator.
deal_stage object Details of the deal stage.
territory string Location of the deal.
deal_product string Product that the deal is associated with.
currency object Details of the deal currency.
owner object Details of the deal owner.
updater string User who updated the deal.
deal_reason string Reason why the deal was lost.
deal_type string Type of deal.

The following table lists the attributes of the user object. Here, the user can be the owner or creator.

ATTRIBUTE TYPE of VALUE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that the user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the deal_pipeline object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the deal pipeline.
name string Name of the deal pipeline.
position number Position of the deal.
is_default boolean Set to 'true' for the default pipeline.

The following table lists the attributes of the deal_stage object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the deal stage.
name string Name of the deal stage.
position number Position of the deal stage.
forecast_type string Category to which the deal stage belongs to.

The following table lists the attributes of the currency object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of currency.
currency_code string Code for the currency.
exchange_rate number Exchange rate for the currency.
onDealUpdate

When a deal is updated, the onDealUpdate 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: "onDealUpdate", callback: "onDealUpdateCallback" } ], onDealUpdateCallback: function(payload) { console.log("Logging arguments from onDealUpdate 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
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
{ "iparams": {}, "region": "US", "data": { "deal": { "deal_pipeline_id": { "label": "Deal pipeline", "type": "dropdown", "value": 1316 }, "deal_product_id": { "label": "Product", "type": "dropdown", "value": null }, "name": { "label": "Name", "type": "text", "value": "super deal" }, "custom_fields": [], "upcoming_activities_time": { "label": "Upcoming activities", "type": "date_time", "value": null }, "deal_type_id": { "label": "Type", "type": "dropdown", "value": null }, "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-03-27T13:45:29Z" }, "web_form_id": { "label": "Web form", "type": "dropdown", "value": null }, "contact_ids": [], "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 3131 }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 13479 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-13T07:25:29Z" }, "expected_close": { "label": "Expected close date", "type": "date", "value": "2019-03-28" }, "won_from": null, "age": { "label": "Age (in days)", "type": "number", "value": null }, "amount": { "label": "Deal value", "type": "decimal", "value": "100.0" }, "deal_stage_id": { "label": "Deal stage", "type": "dropdown", "value": 9519 }, "base_currency_amount": { "label": "Deal value in Base Currency", "type": "decimal", "value": "100.0" }, "id": 204599, "deal_reason_id": { "label": "Lost reason", "type": "dropdown", "value": null }, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "sales_account_id": { "label": "Account name", "type": "auto_complete", "value": null }, "deal_payment_status_id": { "label": "Payment status", "type": "dropdown", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-03-27T13:45:28Z" }, "import_id": null, "expected_deal_value": { "label": "Expected deal value", "type": "decimal", "value": "100.0" }, "currency_id": { "label": "Currency", "type": "dropdown", "value": 338 }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "stage_updated_time": { "label": "Deal stage updated at", "type": "date_time", "value": "2019-03-27T13:45:28Z" }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-13T07:25:28Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "closed_date": { "label": "Closed date", "type": "date", "value": null }, "lost_from": null, "deal_prediction_tag": { "label": "Deal Prediction", "dom_type": "text", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 14266 }, "probability": { "label": "Probability (%)", "type": "decimal", "value": 100 } }, "associations": { "source": null, "deal_payment_status": null, "campaign": null, "deal_pipeline": { "id": 1316, "name": "Default Pipeline", "position": 1, "is_default": true }, "contacts": [], "creator": { "deal_pipeline_id": 1316, "name": "Rachel", "is_active": true, "email": "rachel@freshworks.com", "job_title": null, "id": 3131, "created_at": "2019-02-08T05:39:49Z", "type": "user", "updated_at": "2019-02-08T05:51:40Z", "work_number": "A", "time_zone": "UTC", "mobile_number": null }, "sales_account": null, "deal_stage": { "id": 9519, "name": "New", "position": 1, "forecast_type": "Open" }, "territory": null, "deal_product": null, "currency": { "id": 338, "currency_code": "USD", "exchange_rate": "1.0" }, "owner": { "deal_pipeline_id": 1316, "name": "John", "is_active": true, "email": "john@freshworks.com", "job_title": null, "id": 13479, "created_at": "2019-07-11T08:34:27Z", "type": "user", "updated_at": "2019-07-11T08:36:27Z", "work_number": "125125", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": { "deal_pipeline_id": 1316, "name": "Rachel", "is_active": true, "email": "rachel@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "deal_reason": null, "deal_type": null }, "changes": { "model_changes": { "owner_id": [3131, 13479], "updater_id": [3131, 14266], "updated_at": ["2019-06-04T06:38:53Z", "2019-08-13T07:25:28Z"], "last_assigned_at": ["2019-03-27T13:45:29Z", "2019-08-13T07:25:29Z"] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onDealUpdate", "timestamp": 1565681128.7263405, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When a contact is deleted, the is_deleted field is set to 'true'.

The following table lists the attributes of the deal object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
deal_pipeline_id number ID of deal pipeline.
deal_product_id number ID of the product that the deal is associated with.
name string Name of the deal.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
upcoming_activities_time datetime Timestamp for next scheduled activity.
deal_type_id number ID of the deal type.
first_assigned_at datetime First assigned timestamp of the deal.
web_form_id number Form through which this deal was captured.
contact_ids array of numbers IDs of contacts associated with this deal.
lead_source_id number ID of the source of the deal.
tags array of strings Tags associated with this deal.
import_csv_id string Reference of all imports that this deal was part of.
creator_id number ID of the user who created the deal.
active_sales_sequences array of numbers Active sales campaigns that this deal was part of.
owner_id number User who owns the record.
is_deleted boolean Set to 'true' if deal is deleted.
last_assigned_at datetime Last assigned timestamp.
expected_close date Expected close date of the deal.
won_from string Stage from which deal was won.
age number Time elapsed (in days) since the creation of the deal.
amount number Value of the deal.
deal_stage_id number ID of the deal stage.
base_currency_amount number Deal amount converted to base currency configured by admin.
id number ID of the deal.
deal_reason_id number ID of the reason why the deal was lost.
territory_id number ID of the territory.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
sales_account_id string ID of sales account associated with this deal.
deal_payment_status_id number ID of deal payment status.
created_at datetime Created timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
expected_deal_value number Expected deal amount.
currency_id number ID of currency associated with the deal.
recent_note string Recently added note against the deal.
stage_updated_time datetime Timestamp when the deal stage was updated.
updated_at datetime Updated timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered for the deal.
completed_sales_sequences array of numbers Completed sales sequences that this deal was part of.
campaign_id string ID of the UTM campaign.
closed_date datetime Closed date of the deal.
lost_from string Stage where the deal was lost.
updater_id number ID of the user who updated the deal.
probability number Probability of closing the deal.
associations object Associations of the deal.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
source string Source details of this deal.
deal_payment_status string Status of the deal payment.
campaign string UTM campaign.
deal_pipeline object Details of deal pipeline.
contacts array of strings Contacts associated with this deal.
creator object Details of the deal creator.
deal_stage object Details of the deal stage.
territory string Location of the deal.
deal_product string Product that the deal is associated with.
currency object Details of the deal currency.
owner object Details of the deal owner.
updater string User who updated the deal.
deal_reason string Reason why the deal was lost.
deal_type string Type of deal.

The following table lists the attributes of the user object. Here, the user can be the owner or creator.

ATTRIBUTE TYPE of VALUE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that the user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the deal_pipeline object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the deal pipeline.
name string Name of the deal pipeline.
position number Position of the deal.
is_default boolean Set to 'true' for the default pipeline.

The following table lists the attributes of the deal_stage object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the deal stage.
name string Name of the deal stage.
position number Position of the deal stage.
forecast_type string Category to which the deal stage belongs to.

The following table lists the attributes of the currency object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of currency.
currency_code string Code for the currency.
exchange_rate number Exchange rate for the currency.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
model_changes object All changes made in the details of the default and custom fields.
system_changes string Changes performed by the system.
misc_changes string Miscellaneous changes made.
onLeadCreate

When a new lead is created, the onLeadCreate 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: "onLeadCreate", callback: "onLeadCreateCallback" } ], onLeadCreateCallback: function(payload) { console.log("Logging arguments from onLeadCreate 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
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
{ "iparams": {}, "region": "US", "data": { "lead": { "first_name": { "label": "First name", "type": "text", "value": "rachel" }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "dom_type": "text", "value": "rachel john" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-08-13T09:43:57Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "job_title": { "label": "Job title", "type": "text", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 15379 }, "lead_quality": { "label": "Lead quality", "type": "dropdown", "value": "Cold" }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-13T09:43:57Z" }, "country": { "label": "Country", "type": "text", "value": null }, "medium": { "label": "Medium", "type": "text", "value": null }, "keyword": { "label": "Keyword", "type": "text", "value": null }, "lead_reason_id": { "label": "Unqualified reason", "type": "dropdown", "value": null }, "company": { "business_type_id": { "label": "Business type", "dom_type": "dropdown", "value": null }, "website": { "label": "Company website", "dom_type": "url", "value": null }, "city": { "label": "Company city", "dom_type": "text", "value": null }, "zipcode": { "label": "Company zipcode", "dom_type": "text", "value": null }, "name": { "label": "Company name", "dom_type": "text", "value": null }, "state": { "label": "Company state", "dom_type": "text", "value": null }, "annual_revenue": { "label": "Company annual revenue", "dom_type": "decimal", "value": null }, "country": { "label": "Company country", "dom_type": "text", "value": null }, "number_of_employees": { "label": "Number of employees", "dom_type": "dropdown", "value": null }, "industry_type_id": { "label": "Industry type", "dom_type": "dropdown", "value": null }, "address": { "label": "Company address", "dom_type": "text", "value": null }, "phone": { "label": "Company phone", "dom_type": "phone_number", "value": null } }, "department": { "label": "Department", "type": "text", "value": null }, "id": 917263, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "email_status": { "label": "Email status", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "last_name": { "label": "Last name", "type": "text", "value": "john" }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "status": "Active", "sales_account_id": null, "lead_stage_id": { "label": "Lead stage", "type": "dropdown", "value": 2065 }, "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-08-13T09:43:56Z" }, "is_converted": false, "do_not_disturb": { "label": "Do not disturb", "type": "checkbox", "value": false }, "import_id": null, "unqualified_from": null, "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "contact_id": null, "has_authority": { "label": "Has authority", "type": "checkbox", "value": false }, "merged_to": 0, "converted_by": null, "stage_updated_time": "2019-08-13T09:43:56Z", "emails": { "label": "Emails", "type": "group_field", "value": [] }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-13T09:43:56Z" }, "work_number": { "label": "Work", "type": "phone_number", "value": null }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "lead_score": { "label": "Lead score", "type": "number", "value": 0 }, "deal_id": null, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "last_seen": { "label": "Last seen", "type": "date_time", "value": null }, "time_zone": { "label": "Time zone", "type": "dropdown", "value": null }, "deal": { "deal_product_id": { "label": "Product", "dom_type": "dropdown", "value": null }, "name": { "label": "Deal name", "dom_type": "text", "value": null }, "expected_close": { "label": "Deal expected close date", "dom_type": "date", "value": null }, "amount": { "label": "Deal value", "dom_type": "decimal", "value": null }, "base_currency_amount": { "label": "Deal value in Base Currency", "dom_type": "decimal", "value": null }, "currency_id": { "label": "Deal Currency", "dom_type": "dropdown", "value": null } }, "converted_time": null, "updater_id": { "label": "Updated by", "type": "dropdown", "value": null }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": null }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": null } }, "associations": { "source": null, "lead_stage": { "id": 2065, "name": "New", "position": 1, "choice_type": 5 }, "campaign": null, "creator": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "owner": { "deal_pipeline_id": 1316, "name": "one_account_user K", "is_active": true, "email": "vktest9876@gmail.com", "job_title": null, "id": 15379, "created_at": "2019-08-02T07:01:49Z", "type": "user", "updated_at": "2019-08-02T07:02:39Z", "work_number": "+1 (866) 832-3090", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": null, "lead_reason": null } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onLeadCreate", "timestamp": 1565689436.5550723, "version": "2.0" }
EXPAND ↓

The following table lists the attributes of the lead object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
first_name string First name of the lead.
last_name string Last name of the lead.
city string City where the lead resides.
zipcode string Zipcode.
name string First and last name of the lead.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the lead resides.
lead_source_id number ID of the source.
job_title string Job title of the lead.
tags array of strings Tags associated with this lead.
linkedin string Linkedin address of the lead.
import_csv_id string Reference of all imports that this lead was part of.
creator_id number ID of the user who created the lead.
active_sales_sequences array of numbers Active sales campaigns that this lead was part of.
owner_id number User who owns the record.
lead_quality string Category to which the lead belongs to.
is_deleted boolean Set to 'true' if lead is deleted.
last_assigned_at datetime Last assigned timestamp.
country string Country of the lead.
medium string Medium tracked in UTM.
keyword string Keyword tracked in UTM.
lead_reason_id number ID of the reason why the lead was unqualified.
company object Details of the company.
department string Name of the department.
id number ID of the lead.
territory_id number ID of the territory.
email_status string Status of the email: active, invalid, or bounced.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
status string Status of the lead. The values are: active, converted, merged, or deleted.
sales_account_id string ID of sales account associated with this lead.
lead_stage_id number Stage to which the lead belongs to.
address string Address of the lead.
created_at datetime Lead creation timestamp.
is_converted boolean Set to 'true' if lead is converted to contact.
do_not_disturb boolean Set to 'true' if lead is not to be disturbed.
import_id string ID of the equivalent record in the external system from which it was imported.
unqualified_from string Previous stage from which lead was moved to unqualified.
twitter string Twitter handle of the contact.
recent_note string Recently added note against the lead.
contact_id string ID of the contact associated with this lead.
has_authority boolean Set to 'true' if lead has authority to make decisions.
merged_to array of numbers Reference of secondary leads merged to the primary lead.
converted_by string User who converted the lead.
stage_updated_time datetime Timestamp when stage was updated.
emails array of strings Primary and secondary emails associated with this lead.
updated_at datetime Updated timestamp.
work_number string Telephone number of the lead.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered to the lead.
lead_score number Score to qualify a lead.
deal_id number ID of the deal product.
completed_sales_sequences array of numbers Completed sales sequences that this lead was part of.
campaign_id string ID of the UTM campaign.
last_seen datetime Last seen timestamp.
time_zone string Time zone of the contact.
deal object Deal details of the lead.
name string Name of the deal associated with this lead.
expected_close date Expected close date of the deal.
amount number Value of the deal.
base_currency_amount number Deal amount converted to base currency configured by admin.
currency_id number ID of currency associated with the deal.
converted_time string Timestamp when lead was converted.
updater_id number ID of the user who updated the lead.
web_form_ids array of numbers Forms through which this record was captured.
mobile_number number Mobile number of the lead.
associations object Associations of the lead.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
source object Source details of this lead.
lead_stage object Details of the lead stage.
campaign string UTM campaign.
creator object Details of lead creator.
territory string Territory of the lead.
owner object Details of the lead owner.
updater object Details of the lead updater.
lead_reason string Reason why the lead was unqualified.

The following table lists the attributes of the user object. Here, the user can be the owner or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the company object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
business_type_id number ID of the business type that the lead belongs to.
website string Company website.
city string City where the company is located.
zipcode string Zipcode.
name string Name of the company.
state string State where the company is located.
annual_revenue number Annual revenue of the company.
country string Country where the company is located.
number_of_employees number Number of employees in the company.
industry_type_id number ID of the industry type that the lead belongs to.
address string Address of the company.
phone string Phone number of the company.

The following table lists the attributes of the lead_stage object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the lead stage.
name string Name of the lead stage.
position number Position of the lead stage.
choice_type string Category to which the lead stage belongs to.
onLeadUpdate

When a lead property is updated, the onLeadUpdate 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: "onLeadUpdate", callback: "onLeadUpdateCallback" } ], onLeadUpdateCallback: function(payload) { console.log("Logging arguments from onLeadUpdate 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
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
{ "iparams": {}, "region": "US", "data": { "lead": { "first_name": { "label": "First name", "type": "text", "value": "Jane" }, "city": { "label": "City", "type": "text", "value": "Glendale" }, "zipcode": { "label": "Zipcode", "type": "text", "value": "100652" }, "name": { "label": "Name", "dom_type": "text", "value": "Jane Sampleton" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-02-08T05:40:20Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": "Email Opened" }, "state": { "label": "State", "type": "text", "value": "Arizona" }, "lead_source_id": { "label": "Source", "type": "dropdown", "value": 4747 }, "job_title": { "label": "Job title", "type": "text", "value": "Sales Manager" }, "tags": { "label": "Tags", "type": "auto_complete", "value": [{ "name": "wwww", "is_deleted": false, "_association_id": 17015, "id": 3224, "created_at": "2019-03-22T04:23:30Z", "updated_at": "2019-03-22T04:23:30Z" }, { "name": "2323", "is_deleted": false, "_association_id": 17159, "id": 3340, "created_at": "2019-03-25T08:27:01Z", "updated_at": "2019-03-25T08:27:01Z" }, { "name": "eqweq", "is_deleted": false, "_association_id": 17160, "id": 3341, "created_at": "2019-03-25T08:39:12Z", "updated_at": "2019-03-25T08:39:12Z" }] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": "http://linkedin.com/pub/jane-sampleton/109/39/b0" }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 3131 }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 13479 }, "lead_quality": { "label": "Lead quality", "type": "dropdown", "value": "Hot" }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-15T09:24:16Z" }, "country": { "label": "Country", "type": "text", "value": "USA" }, "medium": { "label": "Medium", "type": "text", "value": "Blog" }, "keyword": { "label": "Keyword", "type": "text", "value": "B2B Success" }, "lead_reason_id": { "label": "Unqualified reason", "type": "dropdown", "value": null }, "company": { "business_type_id": { "label": "Business type", "dom_type": "dropdown", "value": 3302 }, "website": { "label": "Company website", "dom_type": "url", "value": "widgetz.io" }, "city": { "label": "Company city", "dom_type": "text", "value": "New Haven" }, "zipcode": { "label": "Company zipcode", "dom_type": "text", "value": "68089" }, "name": { "label": "Company name", "dom_type": "text", "value": "Widgetz.io (sample)" }, "state": { "label": "Company state", "dom_type": "text", "value": "Connecticut" }, "annual_revenue": { "label": "Company annual revenue", "dom_type": "decimal", "value": null }, "country": { "label": "Company country", "dom_type": "text", "value": "United States" }, "number_of_employees": { "label": "Number of employees", "dom_type": "dropdown", "value": null }, "industry_type_id": { "label": "Industry type", "dom_type": "dropdown", "value": 22544 }, "address": { "label": "Company address", "dom_type": "text", "value": "160-6802 Aliquet Rd." }, "phone": { "label": "Company phone", "dom_type": "phone_number", "value": "503-615-3947" } }, "department": { "label": "Department", "type": "text", "value": "Salesdsdsds" }, "id": 134216, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "email_status": { "label": "Email status", "type": "dropdown", "value": "Active" }, "facebook": { "label": "Facebook", "type": "text", "value": "http://facebook.com/profile.php?id=100010587455650" }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": "2019-02-07T05:40:19Z" }, "last_name": { "label": "Last name", "type": "text", "value": "Sampleton" }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": "2019-02-10T12:00:00Z" }, "status": "Active", "sales_account_id": null, "lead_stage_id": { "label": "Lead stage", "type": "dropdown", "value": 2066 }, "address": { "label": "Address", "type": "text", "value": "604-5854 Beckford St." }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-02-01T05:40:18Z" }, "is_converted": false, "do_not_disturb": { "label": "Do not disturb", "type": "checkbox", "value": false }, "import_id": null, "unqualified_from": null, "twitter": { "label": "Twitter", "type": "text", "value": "https://twitter.com/janesampleton" }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": "Expressed interest in purchasing the product and requires a demo." }, "contact_id": null, "has_authority": { "label": "Has authority", "type": "checkbox", "value": true }, "merged_to": 0, "converted_by": null, "stage_updated_time": "2019-04-03T06:57:08Z", "emails": { "label": "Emails", "type": "group_field", "value": [{ "email": "janesampleton@gmail.com", "id": 46607, "email_status": 1, "lead_id": 134216, "unsubscribe": false, "is_primary": true, "created_at": "2019-02-08T05:40:19Z", "updated_at": "2019-03-27T13:37:57Z" }] }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-15T09:24:15Z" }, "work_number": { "label": "Work", "type": "phone_number", "value": "(368) 493-2360" }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": "2019-02-01T05:40:19Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": "Appointment" }, "lead_score": { "label": "Lead score", "type": "number", "value": 29 }, "deal_id": null, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "last_seen": { "label": "Last seen", "type": "date_time", "value": "2019-02-07T05:40:19Z" }, "time_zone": { "label": "Time zone", "type": "dropdown", "value": "Arizona" }, "deal": { "deal_product_id": { "label": "Product", "dom_type": "dropdown", "value": null }, "name": { "label": "Deal name", "dom_type": "text", "value": null }, "expected_close": { "label": "Deal expected close date", "dom_type": "date", "value": null }, "amount": { "label": "Deal value", "dom_type": "decimal", "value": null }, "base_currency_amount": { "label": "Deal value in Base Currency", "dom_type": "decimal", "value": null }, "currency_id": { "label": "Deal Currency", "dom_type": "dropdown", "value": null } }, "converted_time": null, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 14266 }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": null }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": "1-926-652-9891" } }, "associations": { "source": { "id": 4747, "name": "Organic Search", "position": 2 }, "lead_stage": { "id": 2066, "name": "Contacted", "position": 2, "choice_type": 2 }, "campaign": null, "creator": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 3131, "created_at": "2019-02-08T05:39:49Z", "type": "user", "updated_at": "2019-02-08T05:51:40Z", "work_number": "A", "time_zone": "UTC", "mobile_number": null }, "territory": null, "owner": { "deal_pipeline_id": 1316, "name": "guru guru", "is_active": true, "email": "guruprasath.vijayakumar@freshworks.com", "job_title": null, "id": 13479, "created_at": "2019-07-11T08:34:27Z", "type": "user", "updated_at": "2019-07-11T08:36:27Z", "work_number": "125125", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "lead_reason": null }, "changes": { "model_changes": { "owner_id": [3131, 13479], "updater_id": [12860, 14266], "updated_at": ["2019-07-02T11:54:41Z", "2019-08-15T09:24:15Z"], "last_assigned_at": ["2019-02-08T05:40:20Z", "2019-08-15T09:24:16Z"] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onLeadUpdate", "timestamp": 1565861055.916668, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When a lead is deleted, the is_deleted field is set to 'true'.

The following table lists the attributes of the lead object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
first_name string First name of the lead.
last_name string Last name of the lead.
city string City where the lead resides.
zipcode string Zipcode.
name string First and last name of the lead.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the lead resides.
lead_source_id number ID of the source.
job_title string Job title of the lead.
tags array of strings Tags associated with this lead.
linkedin string Linkedin address of the lead.
import_csv_id string Reference of all imports that this lead was part of.
creator_id number ID of the user who created the lead.
active_sales_sequences array of numbers Active sales campaigns that this lead was part of.
owner_id number User who owns the record.
lead_quality string Category to which the lead belongs to.
is_deleted boolean Set to 'true' if lead is deleted.
last_assigned_at datetime Last assigned timestamp.
country string Country of the lead.
medium string Medium tracked in UTM.
keyword string Keyword tracked in UTM.
lead_reason_id number ID of the reason why the lead was unqualified.
company object Details of the company.
department string Name of the department.
id number ID of the lead.
territory_id number ID of the territory.
email_status string Status of the email: active, invalid, or bounced.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
status string Status of the lead. The values are: active, converted, merged, or deleted.
sales_account_id string ID of sales account associated with this lead.
lead_stage_id number Stage to which the lead belongs to.
address string Address of the lead.
created_at datetime Lead creation timestamp.
is_converted boolean Set to 'true' if lead is converted to contact.
do_not_disturb boolean Set to 'true' if lead is not to be disturbed.
import_id string ID of the equivalent record in the external system from which it was imported.
unqualified_from string Previous stage from which lead was moved to unqualified.
twitter string Twitter handle of the contact.
recent_note string Recently added note against the lead.
contact_id string ID of the contact associated with this lead.
has_authority boolean Set to 'true' if lead has authority to make decisions.
merged_to array of numbers Reference of secondary leads merged to the primary lead.
converted_by string User who converted the lead.
stage_updated_time datetime Timestamp when stage was updated.
emails array of strings Primary and secondary emails associated with this lead.
updated_at datetime Updated timestamp.
work_number string Telephone number of the lead.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered to the lead.
lead_score number Score to qualify a lead.
deal_id number ID of the deal product.
completed_sales_sequences array of numbers Completed sales sequences that this lead was part of.
campaign_id string ID of the UTM campaign.
last_seen datetime Last seen timestamp.
time_zone string Time zone of the contact.
deal object Deal details of the lead.
name string Name of the deal associated with this lead.
expected_close date Expected close date of the deal.
amount number Value of the deal.
base_currency_amount number Deal amount converted to base currency configured by admin.
currency_id number ID of currency associated with the deal.
converted_time string Timestamp when lead was converted.
updater_id number ID of the user who updated the lead.
web_form_ids array of numbers Forms through which this record was captured.
mobile_number number Mobile number of the lead.
associations object Associations of the lead.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
source object Source details of this lead.
lead_stage object Details of the lead stage.
campaign string UTM campaign.
creator object Details of lead creator.
territory string Territory of the lead.
owner object Details of the lead owner.
updater object Details of the lead updater.
lead_reason string Reason why the lead was unqualified.

The following table lists the attributes of the user object. Here, the user can be the owner, updater, or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the company object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
business_type_id number ID of the business type that the lead belongs to.
website string Company website.
city string City where the company is located.
zipcode string Zipcode.
name string Name of the company.
state string State where the company is located.
annual_revenue number Annual revenue of the company.
country string Country where the company is located.
number_of_employees number Number of employees in the company.
industry_type_id number ID of the industry type that the lead belongs to.
address string Address of the company.
phone string Phone number of the company.

The following table lists the attributes of the lead_stage object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the lead stage.
name string Name of the lead stage.
position number Position of the lead stage.
choice_type string Category to which the lead stage belongs to.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
model_changes object All changes made in the details of the default and custom fields.
system_changes string Changes performed by the system.
misc_changes string Miscellaneous changes made.

The following table lists the attributes of the source object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
id number ID of the source.
name string Name of the source.
position number Position of the source.
onSalesAccountCreate

When a new sales account is created, the onSalesAccountCreate event is invoked and the registered callback method is executed.

Use the following format in the server.js file to listen for the event.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onSalesAccountCreate", callback: "onSalesAccountCreateCallback" } ], onSalesAccountCreateCallback: function(payload) { console.log("Logging arguments from onSalesAccountCreate 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
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
{ "iparams": {}, "region": "US", "data": { "sales_account": { "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "business_type_id": { "label": "Business type", "type": "dropdown", "value": null }, "website": { "label": "Website", "type": "url", "value": null }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "type": "text", "value": "rachel" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-08-13T14:37:59Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "parent_territory_id": null, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 15379 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-13T14:37:59Z" }, "annual_revenue": { "label": "Annual revenue", "type": "decimal", "value": null }, "country": { "label": "Country", "type": "text", "value": null }, "id": 424906, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "number_of_employees": { "label": "Number of employees", "type": "dropdown", "value": null }, "industry_type_id": { "label": "Industry type", "type": "dropdown", "value": null }, "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-08-13T14:37:58Z" }, "import_id": null, "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "merged_to": 0, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-13T14:37:58Z" }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "phone": { "label": "Phone", "type": "phone_number", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": null }, "parent_sales_account_id": { "label": "Parent account", "type": "auto_complete", "value": null }, "parent_owner_id": null }, "associations": { "creator": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "business_type": null, "parent_sales_account": null, "owner": { "deal_pipeline_id": 1316, "name": "one_account_user K", "is_active": true, "email": "vktest9876@gmail.com", "job_title": null, "id": 15379, "created_at": "2019-08-02T07:01:49Z", "type": "user", "updated_at": "2019-08-02T07:02:39Z", "work_number": "+1 (866) 832-3090", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": null, "industry_type": null } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onSalesAccountCreate", "timestamp": 1565707078.3001003, "version": "2.0" }
EXPAND ↓

The following table lists the attributes of the sales_account object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
open_deals_amount number Sum of all the open deals associated with the account.
business_type_id number ID of the business type that the account belongs to.
website string URL of the account website.
city string City where the account was created.
zipcode string Zipcode.
name string Name of the account.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the account was created.
parent_territory_id number ID of the territory of the parent account.
tags array of strings Tags associated with this account.
linkedin string Linkedin address of the account owner.
import_csv_id string Reference of all imports that this account was part of.
creator_id number ID of the user who created the account.
won_deals_amount string Sum of all won deals associated with the account.
active_sales_sequences array of numbers Active sales campaigns that this account is part of.
owner_id Number ID of the user who owns the record.
is_deleted boolean Set to 'true' if account is deleted.
last_assigned_at datetime Last assigned timestamp.
annual_revenue number Annual revenue of the account.
country string Country where the account was created.
id number ID of the account.
territory_id number ID of the territory.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
number_of_employees number Number of employees associated with this account.
industry_type_id number ID of the industry type that the account belongs to.
address string Address associated with the account.
created_at datetime Account creation timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
twitter string Twitter handle of the account owner.
recent_note string Recently added note against the account.
merged_to array of numbers Reference of secondary accounts merged to the primary account.
updated_at datetime Updated timestamp.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered.
completed_sales_sequences array of numbers Completed sales sequences that this account was part of.
phone number Phone number associated with this account.
updater_id number ID of the user who updated the account.
parent_sales_account_id number ID of parent account.
parent_owner_id number ID of the owner of the parent account.
associations object Associations of the account.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
creator object Details of the account creator.
territory string Territory associated with the account.
business_type string Business type associated with this account.
parent_sales_account string Parent account.
owner object Details of the account owner.
updater object Details of the account updater.
industry_type string Industry type that the account belongs to.

The following table lists the attributes of the user object. Here, the user can be the owner or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.
onSalesAccountUpdate

When a sales account is updated, the onSalesAccountUpdate event is invoked and the registered callback method is executed.

Use the following format in the server.js file to listen for the event.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onSalesAccountUpdate", callback: "onSalesAccountUpdateCallback" } ], onSalesAccountUpdateCallback: function(payload) { console.log("Logging arguments from onSalesAccountUpdate 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
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
{ "iparams": {}, "region": "US", "data": { "sales_account": { "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "business_type_id": { "label": "Business type", "type": "dropdown", "value": null }, "website": { "label": "Website", "type": "url", "value": null }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "type": "text", "value": "rachel john" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2019-08-13T14:37:59Z" }, "avatar": null, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "parent_territory_id": null, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "import_csv_id": { "label": "Import label", "dom_type": "text", "value": null }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 14266 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales campaigns", "type": "multi_select_dropdown", "value": null }, "owner_id": { "label": "Owner", "type": "dropdown", "value": 15379 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2019-08-13T14:37:59Z" }, "annual_revenue": { "label": "Annual revenue", "type": "decimal", "value": null }, "country": { "label": "Country", "type": "text", "value": null }, "id": 424906, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "number_of_employees": { "label": "Number of employees", "type": "dropdown", "value": null }, "industry_type_id": { "label": "Industry type", "type": "dropdown", "value": null }, "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-08-13T14:37:58Z" }, "import_id": null, "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "merged_to": 0, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-19T09:33:31Z" }, "last_contacted_via_chat": { "label": "Last contacted via chat", "type": "date_time", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales campaigns", "type": "multi_select_dropdown", "value": null }, "phone": { "label": "Phone", "type": "phone_number", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 14266 }, "parent_sales_account_id": { "label": "Parent account", "type": "auto_complete", "value": null }, "parent_owner_id": null }, "associations": { "creator": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "business_type": null, "parent_sales_account": null, "owner": { "deal_pipeline_id": 1316, "name": "one_account_user K", "is_active": true, "email": "vktest9876@gmail.com", "job_title": null, "id": 15379, "created_at": "2019-08-02T07:01:49Z", "type": "user", "updated_at": "2019-08-02T07:02:39Z", "work_number": "+1 (866) 832-3090", "time_zone": "UTC", "mobile_number": "+1 (866) 832-3090" }, "updater": { "deal_pipeline_id": 1316, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": null, "id": 14266, "created_at": "2019-07-24T09:05:22Z", "type": "user", "updated_at": "2019-07-24T09:59:48Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "industry_type": null }, "changes": { "model_changes": { "name": ["rachel", "rachel john"], "updater_id": [null, 14266], "updated_at": ["2019-08-13T14:37:58Z", "2019-08-19T09:33:31Z"] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "1549604389", "domain": "rachel.fsales.io", "event": "onSalesAccountUpdate", "timestamp": 1566207211.3498828, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When a sales account is deleted, the is_deleted field is set to 'true'.

The following table lists the attributes of the sales_account object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
open_deals_amount number Sum of all the open deals associated with the account.
business_type_id number ID of the business type that the account belongs to.
website string URL of the account website.
city string City where the account was created.
zipcode string Zipcode.
name string Name of the account.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
first_assigned_at datetime First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode string Last mode of contact. The values are: Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity.
state string State where the account was created.
parent_territory_id number ID of the territory of the parent account.
tags array of strings Tags associated with this account.
linkedin string Linkedin address of the account owner.
import_csv_id string Reference of all imports that this account was part of.
creator_id number ID of the user who created the account.
won_deals_amount string Sum of all won deals associated with the account.
active_sales_sequences array of numbers Active sales campaigns that this account is part of.
owner_id Number ID of the user who owns the record.
is_deleted boolean Set to 'true' if account is deleted.
last_assigned_at datetime Last assigned timestamp.
annual_revenue number Annual revenue of the account.
country string Country where the account was created.
id number ID of the account.
territory_id number ID of the territory.
facebook string Facebook ID.
last_contacted datetime Last contacted timestamp.
last_contacted_via_sales_activity datetime Last contacted timestamp (through sales activity).
number_of_employees number Number of employees associated with this account.
industry_type_id number ID of the industry type that the account belongs to.
address string Address associated with the account.
created_at datetime Account creation timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
twitter string Twitter handle of the account owner.
recent_note string Recently added note against the account.
merged_to array of numbers Reference of secondary accounts merged to the primary account.
updated_at datetime Updated timestamp.
last_contacted_via_chat datetime Last contacted via chat timestamp.
first_contacted datetime First contacted timestamp.
last_contacted_sales_activity_mode string Last mode of sales activity rendered.
completed_sales_sequences array of numbers Completed sales sequences that this account was part of.
phone number Phone number associated with this account.
updater_id number ID of the user who updated the account.
parent_sales_account_id number ID of parent account.
parent_owner_id number ID of the owner of the parent account.
associations object Associations of the account.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
creator object Details of the account creator.
territory string Territory associated with the account.
business_type string Business type associated with this account.
parent_sales_account string Parent account.
owner object Details of the account owner.
updater object Details of the account updater.
industry_type string Industry type that the account belongs to.

The following table lists the attributes of the user object. Here, the user can be the owner or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
model_changes object All changes made in the details of the default and custom fields.
system_changes string Changes performed by the system.
misc_changes string Miscellaneous changes made.
onCustomModuleCreate

When a new record is created in the custom module, the onCustomModuleCreate 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: "onCustomModuleCreate", callback: "onCustomModuleCreateCallback" } ], onCustomModuleCreateCallback: function(payload) { console.log("Logging arguments from onCustomModuleCreate 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
{ "iparams": {}, "region": "US", "data": { "custom_module_record": { "name": { "label": "Name", "type": "text", "value": "Tyler Durden" }, "custom_fields": [ { "name": "cf_client", "label": "Client", "column": "cf_bigint02", "type": "auto_complete", "value": { "id": 5001983111, "model": "contact" } }, { "choice_id": "190409103238030989", "name": "cf_role", "label": "Role", "column": "cf_str02", "type": "dropdown", "value": "Business Contact" }, { "name": "cf_notes", "label": "Notes", "column": "cf_text01", "type": "paragraph", "value": null } ], "creator_id": { "label": "Created by", "type": "auto_complete", "value": { "id": 5000020438, "model": "user" } }, "owner_id": { "label": "Owner", "type": "auto_complete", "value": { "id": null, "model": "user" } }, "is_deleted": false, "id": 5000000728, "status": 1, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-08-19T06:38:03Z" }, "import_id": null, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-19T06:38:03Z" }, "updater_id": { "label": "Updated by", "type": "auto_complete", "value": { "id": null, "model": "user" } }, "module_name": "cm_sales_team_member" }, "associations": { "custom_module": [ { "id": 5000000089, "name": "Mr Jake Stevie Martin" } ], "contact": [ { "id": 5001983111, "name": "Rachel John" } ], "creator": { "deal_pipeline_id": 5000009323, "name": "Rachel John", "is_active": true, "email": "rachel.john@freshworks.com", "job_title": "Product Consultant", "id": 5000020438, "created_at": "2019-02-21T19:11:28Z", "type": "user", "updated_at": "2019-07-25T11:23:16Z", "work_number": null, "time_zone": "Arizona", "mobile_number": "+16910371201" }, "owner": null, "updater": null } }, "account_id": "108150", "domain": "domain.freshsales.io", "event": "onCustomModuleCreate", "timestamp": 1566196683.9704256, "version": "2.0" }
EXPAND ↓

The following table lists the attributes of the custom_module_record object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
name string Name in the record.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
creator_id object Details of the user who created the record.
owner_id object Details of the user who owns the record.
is_deleted boolean Set to 'true' if record is deleted.
id number ID of the record.
status string Status of the record.
created_at datetime Record creation timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
updated_at datetime Updated timestamp.
updater_id object Details of the user who updated the record.
module_name string Name of the module.
associations object Associations of the record.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
custom_module array of objects Type of module associated with the record.
contact array of objects Contact details associated with the record.
creator object Details of record creator.
owner object Details of the record owner.
updater object Details of the record updater.

The following table lists the attributes of the creator object.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this creator is part of.
name string Name of the creator.
is_active boolean Set to 'true' of the creator is verfied.
email string Primary email of the creator.
job_title string Job title of the creator.
id number ID of the creator.
created_at datetime Creation timestamp.
type string Helps categorize a creator.
updated_at datetime Updated timestamp.
work_number string Phone number of the creator.
time_zone string Time zone of the creator in UTC format.
mobile_number string Mobile number of the creator.
onCustomModuleUpdate

When a record is updated in the custom module, the onCustomModuleUpdate event is invoked and the registered callback method is executed.

Use the following format in the server.js file to listen for the event.

Copied Copy
1
2
3
4
5
6
7
8
exports = { events: [ { event: "onCustomModuleUpdate", callback: "onCustomModuleUpdateCallback" } ], onCustomModuleUpdateCallback: function(payload) { console.log("Logging arguments from onCustomModuleUpdate 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
{ "iparams": {}, "region": "US", "data": { "custom_module_record": { "name": { "label": "Name", "type": "text", "value": "John Doe" }, "custom_fields": [ { "name": "cf_last_name", "label": "Last Name", "column": "cf_str01", "type": "text", "value": "Doe" }, { "name": "cf_first_name", "label": "First Name", "column": "cf_str02", "type": "text", "value": "Jonathan" }, { "name": "cf_email", "label": "Email", "column": "cf_str03", "type": "text", "value": "john.doe@smapleemail.com" }, { "choice_id": null, "name": "cf_role", "label": "role", "column": "cf_str04", "type": "dropdown", "value": null }, { "choice_id": null, "name": "cf_status", "label": "Status", "column": "cf_str05", "type": "dropdown", "value": null } ], "creator_id": { "label": "Created by", "type": "auto_complete", "value": { "id": 5000020438, "model": "user" } }, "owner_id": { "label": "Owner", "type": "auto_complete", "value": { "id": 5000016047, "model": "user" } }, "is_deleted": false, "id": 5000000083, "status": 1, "created_at": { "label": "Created at", "type": "date_time", "value": "2019-07-23T22:45:54Z" }, "import_id": null, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2019-08-19T06:27:23Z" }, "updater_id": { "label": "Updated by", "type": "auto_complete", "value": { "id": 5000016047, "model": "user" } }, "module_name": "cm_custom_module_1" }, "associations": { "owner": { "deal_pipeline_id": 5000011458, "name": "Frank Sinatra", "is_active": true, "email": "frank.sinatra@sampleemail.com", "job_title": null, "id": 5000016047, "created_at": "2019-02-06T21:41:26Z", "type": "user", "updated_at": "2019-03-22T13:37:20Z", "work_number": null, "time_zone": "Eastern Time (US & Canada)", "mobile_number": "+18361828392" }, "updater": { "deal_pipeline_id": 5000011458, "name": "Nancy Sinatra", "is_active": true, "email": "nancy.sinatra@sampleemail.com", "job_title": null, "id": 5000016047, "created_at": "2019-02-06T21:41:26Z", "type": "user", "updated_at": "2019-03-22T13:37:20Z", "work_number": null, "time_zone": "Eastern Time (US & Canada)", "mobile_number": "+19479193712" }, "creator": { "deal_pipeline_id": 5000009323, "name": "Anthony Quinn", "is_active": true, "email": "anthony.quinn@sampleemail.com", "job_title": "Product Consultant", "id": 5000020438, "created_at": "2019-02-21T19:11:28Z", "type": "user", "updated_at": "2019-07-25T11:23:16Z", "work_number": null, "time_zone": "Arizona", "mobile_number": "+19299194920" } }, "changes": { "model_changes": { "name": [ "Sample name", "John Doe" ], "custom_fields": { "cf_last_name": [ null, "Doe" ], "cf_first_name": [ null, "Jonathan" ], "cf_email": [ null, "john.doe@smapleemail.com" ] }, "owner_id": [ null, 5000016047 ], "updated_at": [ "2019-07-23T22:45:54Z", "2019-08-19T06:27:23Z" ], "updater_id": [ null, 5000016047 ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "108150", "domain": "domain.freshsales.io", "event": "onCustomModuleUpdate", "timestamp": 1566196043.823529, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When a record is deleted, the is_deleted field is set to 'true'.

The following table lists the attributes of the custom_module_record object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
name string Name in the record.
custom_fields array of strings Key value pairs containing the names and values of custom fields.
creator_id object Details of the user who created the record.
owner_id object Details of the user who owns the record.
is_deleted boolean Set to 'true' if record is deleted.
id number ID of the record.
status string Status of the record.
created_at datetime Record creation timestamp.
import_id string ID of the equivalent record in the external system from which it was imported.
updated_at datetime Updated timestamp.
updater_id object Details of the user who updated the record.
module_name string Name of the module.
associations object Associations of the record.
changes object Details of changes made.

The following table lists the attributes of the associations object.

ATTRIBUTE TYPE DESCRIPTION
owner object Details of record owner.
updater object Details of the record updater.
creator object Details of record creator.
owner object Details of the record owner.
updater object Details of the record updater.

The following table lists the attributes of the user object. Here, the user can be the owner, updater, or creator.

ATTRIBUTE TYPE DESCRIPTION
deal_pipeline_id number ID of deal pipelines that this user is part of.
name string Name of the user.
is_active boolean Set to 'true' of the user is verfied.
email string Primary email of the user.
job_title string Job title of the user.
id number ID of the user.
created_at datetime Creation timestamp.
type string Helps categorize a user.
updated_at datetime Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user in UTC format.
mobile_number string Mobile number of the user.

The following table lists the attributes of the changes object.

ATTRIBUTE TYPE of VALUE DESCRIPTION
model_changes object All changes made in the details of the default and custom fields.
system_changes string Changes performed by the system.
misc_changes string Miscellaneous changes made.
Testing

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

You can easily test your app in your machine by simulating events. Also, 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 ticket/contact 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 procedure.

  1. In your console, navigate to your project directory, and execute the following command. $ fdk run
  2. Open your browser and enter the following URL to start testing your 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.
  5. If the event is successfully simulated, Success is displayed.
  6. If there is a problem, Failed is displayed. Check if the payload is valid and then resume testing.