Product Events

Events that occur in the Freshsales product, such as creating a contact, updating a deal, creating a task, and so on are termed as product events. You can enable product events to trigger apps. To do this, configure event listeners in the manifest.json file. When a product event occurs, the corresponding event listener invokes a callback method defined in server.js. The app logic in the callback method runs with the help of the event-specific payload passed to the callback method.

Configure Events

To register a product event and the corresponding callback:

  1. From your app’s root directory, navigate to the manifest.json file.
  2. Include the events attribute, specifying the product event and the corresponding callback methods as follows:
    Copied Copy
    1
    2
    3
    4
    5
    "events": { "<eventName>": { "handler": "<eventCallbackMethod>" } }
    Notes:
    • Include only one callback method for an event. Multiple events can access the same callback method.
    • Events of the different products can access the same callback method. For omni apps, ensure to register the product event name in both freshsales and freshworks_crm.
  3. Navigate to the server.js file.
  4. In the exports block, enter the callback function definition as follows:
    Copied Copy
    1
    2
    3
    4
    5
    6
    7
    exports = { // args is a JSON block containing the payload information // args["iparam"] will contain the installation parameter values //eventCallbackMethod is the call-back function name specified in manifest.json eventCallbackMethod: function(args) { console.log("Logging arguments from the event: " + JSON.stringify(payload)); }};
    EXPAND ↓

Payload Attributes

When a product event occurs, an event-specific payload is passed to the callback method.

Copied Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ "account_id" : "value", "domain" : "value", "event" : "value", "region" : "value", "timestamp" : "value", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data" : { //Contains the list of objects related to the event. }, "iparams" : { "Param1" : "value", "Param2" : "value" } }
EXPAND ↓

The payload is a JSON object with the following attributes.

Attribute Type Description
account_id string Identifier of the Freshsales account, auto-generated when the account is configured for a business.
domain string Domain name for the Freshsales account.
event string Identifier of the product event.
region string Region where the app is installed.
Possible values: US, EU, EUC, AUS, and IND
timestamp number Timestamp of when the product event occurs, specified in the epoch format.
productContext object Product context of the product for which the app is installed.
Attributes:
url (string): Complete web-address (protocol, sub-domain name, domain name, and relative path) of the product instance. Possible values: https://.myfreshworks.com/crm, https://.freshworks.com/crm, https://.freshsales.io
name (string): Name of the product. Possible values: freshworks_crm, freshsales
iparams object Installation parameters specified as a JSON object of <parameter name>: <parameter value> pairs.
data object Event-specific Freshsales data, specified as a JSON object of key:value pairs.
onContactCreate

When a contact is created, the onContactCreate event is invoked and the registered callback method is executed.
Register the onContactCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onContactCreate": { "handler": "onContactCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onContactCreateCallback: function(payload) { console.log("Logging arguments from onContactCreate 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
{ "timestamp": 1593015490.2012472, "account_id": "1967183444532229946", "domain": "sample.myfreshworks.com", "event": "onContactCreate", "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "id": 1437, "name": "John Doe", "email": "sample@xyz.com", "job_title": null, "work_number": null, "mobile_number": null, "language": "en", "time_zone": "UTC", "is_active": true, "deal_pipeline_id": 154, "is_forgotten": false, "created_at": "2020-06-09T12:21:48Z", "updated_at": "2020-06-09T12:21:48Z", "uuid": "190440313184929466", "type": "user" }, "contact": { "first_name": { "label": "First name", "type": "text", "value": "fff" }, "last_name": { "label": "Last name", "type": "text", "value": null }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 1437 }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "tags": { "label": "Tags", "type": "auto_complete", "value": [] }, "job_title": { "label": "Job title", "type": "text", "value": null }, "emails": { "label": "Emails", "type": "group_field", "value": [] }, "work_number": { "label": "Work", "type": "phone_number", "value": null }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": "9876543223456789" }, "contact_status_id": { "label": "Status", "type": "dropdown", "value": null }, "country": { "label": "Country", "type": "text", "value": null }, "time_zone": { "label": "Time zone", "type": "dropdown", "value": null }, "address": { "label": "Address", "type": "text", "value": null }, "city": { "label": "City", "type": "text", "value": null }, "state": { "label": "State", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "do_not_disturb": false, "linkedin": { "label": "LinkedIn", "type": "text", "value": null }, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "lead_source_id": { "label": "Source", "type": "dropdown", "value": null }, "facebook": { "label": "Facebook", "type": "text", "value": null }, "twitter": { "label": "Twitter", "type": "text", "value": null }, "campaign_id": { "label": "Campaign", "type": "dropdown", "value": null }, "medium": { "label": "Medium", "type": "text", "value": null }, "keyword": { "label": "Keyword", "type": "text", "value": null }, "last_contacted": { "label": "Last contacted time", "type": "date_time", "value": null }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": [] }, "last_contacted_mode": { "label": "Last contacted mode", "type": "dropdown", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2020-06-09T15:21:39Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "lead_score": { "label": "Score", "type": "number", "value": 0 }, "completed_sales_sequences": { "label": "Completed sales sequences", "type": "multi_select_dropdown", "value": [] }, "last_seen": { "label": "Last seen", "type": "date_time", "value": null }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 1437 }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-09T15:21:39Z" }, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-09T15:21:40Z" }, "external_id": { "label": "External ID", "type": "text", "value": null }, "work_email": { "label": "Work email", "type": "email", "value": null }, "subscription_status": { "label": "Subscription status", "type": "dropdown", "value": 1 }, "subscription_types": { "label": "Subscription types", "type": "multi_select_dropdown", "value": [ { "id": "1", "value": "Non-marketing emails from our company" } ] }, "id": 5510, "is_deleted": false, "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "name": { "label": "Name", "dom_type": "text", "value": "fff" }, "merged_to": 0, "status": "Active", "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2020-06-09T15:21:40Z" }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "import_csv_id": { "label": "Import label", "dom_type": "multi_select_dropdown", "value": [] }, "sales_account_ids": [], "import_id": null, "avatar": null, "team_user_ids": [], "email_status": { "label": "Email status", "dom_type": "text", "value": null }, "mcr_id": 1270375514142703600, "list_ids": [], "creator_id": { "label": "Created by", "type": "dropdown", "value": 1437 }, "custom_fields": [], "source_additional_info": {} }, "associations": { "owner": { "id": 1437, "name": "John Doe", "type": "user", "email": "sample@xyz.com", "is_active": true, "work_number": null, "mobile_number": null, "time_zone": "UTC", "created_at": "2020-06-09T12:21:48Z", "updated_at": "2020-06-09T12:21:48Z", "deal_pipeline_id": 154, "job_title": null, "uuid": "190440313184929466" }, "source": null, "contact_status": null, "campaign": null, "territory": null, "updater": { "id": 1437, "name": "John Doe", "type": "user", "email": "sample@xyz.com", "is_active": true, "work_number": null, "mobile_number": null, "time_zone": "UTC", "created_at": "2020-06-09T12:21:48Z", "updated_at": "2020-06-09T12:21:48Z", "deal_pipeline_id": 154, "job_title": null, "uuid": "190440313184929466" }, "team_users": [], "sales_accounts": [], "lists": [], "creator": { "id": 1437, "name": "John Doe", "type": "user", "email": "sample@xyz.com", "is_active": true, "work_number": null, "mobile_number": null, "time_zone": "UTC", "created_at": "2020-06-09T12:21:48Z", "updated_at": "2020-06-09T12:21:48Z", "deal_pipeline_id": 154, "job_title": null, "uuid": "190440313184929466" } } } }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onContactCreate event.
contact contact object Details of the contact object created when the onContactCreate event is triggered.
associations associations object Associated objects related to the contact object.

Attributes of the actor object

ATTRIBUTE DATA TYPE DESCRIPTION
id number Identifier associated with the actor.
name string Name of the actor.
email string Email address of the actor.
job_title string Designation of the actor.
work_number number Official phone number of the actor.
mobile_number number Phone number of the actor.
language string Language of the actor; by default, language is 'en'.
time_zone string Time zone of the actor, specified in the UTC format.
is_active boolean Set to 'true' if the actor is verified.
deal_pipeline_id number ID of deal pipelines that this actor is part of.
is_forgotten boolean If this attribute is ‘true’, specified data is permanently deleted.
created_at string Creation timestamp specified in the UTC format.
updated_at string Updation timestamp, specified in the UTC format. For onContactCreate, this value is the same as created_at.
uuid string Unique user identifier, this value is auto-generated.
type string Helps categorize a user.

Attributes of the contact object

ATTRIBUTE DATA TYPE DESCRIPTION
open_deals_amount number Sum of all the open deals associated with the contact.
source_additional_info object Meta information specified as a custom JSON object.
first_name object First name of the contact.
last_name object Last name of the contact.
city object City where the contact resides.
zipcode object Postal code of the region where the contact resides.
name object 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 object First assigned timestamp.
avatar string Avatar URL.
last_contacted_mode object Last mode of contact.
Possible value:
Email Incoming, Email Outgoing, Call Incoming, Call Outgoing, Email Opened, Chat, and Sales Activity
state object State where the contact resides.
lead_source_id number Identifier of the source of the deal.
job_title object Job title of the contact.
tags object Tags associated with this contact.
linkedin object Linkedin address of the contact.
import_csv_id object Reference of all imports that this contact was part of.
creator_id object Identifier of the user who created the contact.
won_deals_amount object Sum of all won deals associated with the contact.
active_sales_sequences object Active sales campaigns that this contact was part of.
owner_id object User who owns the record.
contact_status_id object Identifier of the contact status.
is_deleted boolean Specifies whether a contact is deleted. This value is set to ‘true’ if the contact is deleted.
last_assigned_at object Last assigned timestamp.
country object Country of the contact.
medium object Medium tracked in UTM.
keyword object Keyword tracked in UTM.
id number Identifier of the contact.
territory_id object Identifier of the territory.
team_user_ids array Identifiers of the collaborators associated with the contact.
facebook object Facebook ID.
last_contacted object Last contacted timestamp.
work_email object Official email address of the contact.
last_contacted_via_sales_activity object Last contacted timestamp (through sales activity).
status string Status of the contact.
Possible values:
active, merged, or deleted
mcr_id number Identifier of the master customer record to which the contact information belongs. This value is auto-generated.
external_id object Identifier of the external references from which the contact information is fetched.
address object Address of the contact.
created_at object 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 object Twitter handle of the contact.
recent_note object Recently added note against the contact.
merged_to number Reference of secondary contacts merged to the primary contact.
emails object Primary and secondary emails associated with this contact.
updated_at object Updated timestamp.
work_number object Telephone number of the contact.
first_contacted object First contacted timestamp.
list_ids array of numbers Identifiers of the marketing lists associated with the contact.
subscription_types object Subscription types available.
Possible values:
Promotional, Newsletter, Product updates, Conferences & Events, Non-marketing emails from our company
lead_score object Score to qualify a contact.
last_contacted_sales_activity_mode string Last mode of sales activity rendered to the contact.
completed_sales_sequences object Completed sales sequences that this contact was part of.
campaign_id object Identifier of the UTM campaign.
last_seen object Last seen timestamp.
time_zone object Time zone of the contact.
updater_id object Identifier of the user who updated the contact.
web_form_ids object Forms through which this record was captured.
mobile_number object Mobile number of the contact.

Attributes of the associations object

ATTRIBUTE DATA TYPE DESCRIPTION
lists array Marketing lists associated with the contact.
source string Source details of this contact.
campaign string UTM campaign.
creator user object Details of contact creator.
territory string Territory of the contact.
contact_status string Qualification status of the contact.
owner user object Details of the contact owner.
updater user object Details of the contact updater. For onContactCreate, this value is null.
team_users array Collaborators associated with the contact.
sales_accounts array of numbers Sales accounts of the contact.

Attributes of the user object. Here, the user can be the owner, updater, or creator.

ATTRIBUTE DATA 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.
uuid string Unique user identifier, this value is auto-generated.
id number Identifier of the user.
created_at string Creation timestamp.
type string Helps categorize a user.
updated_at string Updated timestamp.
work_number string Phone number of the user.
time_zone string Time zone of the user.
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.
Register the onContactUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onContactUpdate": { "handler": "onContactUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onContactUpdateCallback: function(payload) { console.log("Logging arguments from onContactUpdate 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "contact": { "open_deals_amount": { "label": "Open deals amount", "dom_type": "decimal", "value": "0.0" }, "source_additional_info": {}, "first_name": { "label": "First name", "type": "text", "value": "Test" }, "city": { "label": "City", "type": "text", "value": null }, "zipcode": { "label": "Zipcode", "type": "text", "value": null }, "name": { "label": "Name", "dom_type": "text", "value": "Test owner Update" }, "custom_fields": [], "subscription_status": { "label": "Subscription status", "type": "dropdown", "value": 0 }, "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2020-06-24T18:23:28Z" }, "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": "multi_select_dropdown", "value": [] }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 39897 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 39897 }, "contact_status_id": { "label": "Status", "type": "dropdown", "value": null }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-24T18:23:28Z" }, "country": { "label": "Country", "type": "text", "value": null }, "medium": { "label": "Medium", "type": "text", "value": null }, "keyword": { "label": "Keyword", "type": "text", "value": null }, "team_user_ids": [], "id": 1399554, "territory_id": { "label": "Territory", "type": "dropdown", "value": null }, "email_status": { "label": "Email status", "dom_type": "text", "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": "owner Update" }, "work_email": { "label": "Work email", "type": "email", "value": null }, "last_contacted_via_sales_activity": { "label": "Last activity date", "type": "date_time", "value": null }, "status": "Active", "mcr_id": 1275857082467778600, "phone_numbers": { "label": "Other phone numbers", "type": "group_field", "value": [] }, "external_id": { "label": "External ID", "type": "text", "value": null }, "address": { "label": "Address", "type": "text", "value": null }, "created_at": { "label": "Created at", "type": "date_time", "value": "2020-06-24T18:23:27Z" }, "do_not_disturb": true, "import_id": null, "sales_account_ids": [], "twitter": { "label": "Twitter", "type": "text", "value": null }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "merged_to": 0, "emails": { "label": "Emails", "type": "group_field", "value": [] }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-24T18:27:01Z" }, "work_number": { "label": "Work", "type": "phone_number", "value": null }, "first_contacted": { "label": "First contacted", "dom_type": "date_time", "value": null }, "list_ids": [], "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "subscription_types": { "label": "Subscription types", "type": "multi_select_dropdown", "value": [] }, "lead_score": { "label": "Score", "type": "number", "value": 0 }, "completed_sales_sequences": { "label": "Completed sales sequences", "type": "multi_select_dropdown", "value": [] }, "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": 39897 }, "web_form_ids": { "label": "Web forms", "type": "multi_select_dropdown", "value": [] }, "mobile_number": { "label": "Mobile", "type": "phone_number", "value": "1231231230" } }, "associations": { "lists": [], "source": null, "campaign": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@freshworks.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "contact_status": null, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "team_users": [], "sales_accounts": [] }, "changes": { "model_changes": { "last_name": [ "owner", "owner Update" ], "created_at": [ "2020-06-24T18:23:27Z", "2020-06-24T18:23:27Z" ], "updater_id": [ null, 39897 ], "updated_at": [ "2020-06-24T18:23:27Z", "2020-06-24T18:27:01Z" ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onContactUpdate", "timestamp": 1593023221.9586976, "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.

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onContactUpdate event.
contact contact object Details of the contact object.
associations associations object Associated objects related to the contact object.
changes object Updated field values.

onDealCreate

When a deal is created, the onDealCreate event is invoked and the registered callback method is executed.
Register the onDealCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onDealCreate": { "handler": "onDealCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "deal": { "deal_pipeline_id": { "label": "Deal pipeline", "type": "dropdown", "value": 27149 }, "source_additional_info": {}, "deal_product_id": { "label": "Product", "type": "dropdown", "value": null }, "name": { "label": "Name", "type": "text", "value": "Deal with owner" }, "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": "2020-06-24T18:30:55Z" }, "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": "multi_select_dropdown", "value": [] }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 39897 }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 39897 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-24T18:30:55Z" }, "expected_close": { "label": "Expected close date", "type": "date", "value": null }, "won_from": null, "age": { "label": "Age (in days)", "type": "number", "value": 0 }, "amount": { "label": "Deal value", "type": "decimal", "value": "123.0" }, "product_ids": [], "deal_stage_id": { "label": "Deal stage", "type": "dropdown", "value": 178962 }, "base_currency_amount": { "label": "Deal value in Base Currency", "type": "decimal", "value": "123.0" }, "team_user_ids": [], "id": 1357538, "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": "2020-06-24T18:30:54Z" }, "import_id": null, "expected_deal_value": { "label": "Expected deal value", "type": "decimal", "value": "123.0" }, "currency_id": { "label": "Currency", "type": "dropdown", "value": 6615 }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "stage_updated_time": { "label": "Deal stage updated at", "type": "date_time", "value": "2020-06-24T18:30:54Z" }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-24T18:30:54Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales sequences", "type": "multi_select_dropdown", "value": [] }, "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": 27149, "name": "Default Pipeline", "position": 1, "is_default": true }, "products": [], "contacts": [], "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "sales_account": null, "deal_stage": { "id": 178962, "name": "New", "position": 1, "forecast_type": "Open" }, "territory": null, "deal_product": null, "currency": { "id": 6615, "currency_code": "USD", "exchange_rate": "1.0" }, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": null, "deal_reason": null, "deal_type": null, "team_users": [] } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onDealCreate", "timestamp": 1593023454.5852625, "version": "2.0" }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onDealCreate event.
deal deal object Details of the deal object created when the onDealCreate event is triggered.
associations associations object Associated objects related to the deal object.

Attributes of the deal object

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

Attributes of the associations object

ATTRIBUTE DATA TYPE 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.
products array Products associated with this deal.
contacts array Contacts associated with this deal.
creator user object Details of the deal creator.
sales_accounts array of numbers Sales accounts of the contact.
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 user object Details of the deal owner.
updater user object Details of the deal updater. For the onDealCreate event, this value is null.
deal_reason string Reason why the deal was lost.
deal_type string Type of deal.
team_users array Collaborators who worked on a task related to the deal.
onDealUpdate

When a deal is updated, the onDealUpdate event is invoked and the registered callback method is executed.
Register the onDealUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onDealUpdate": { "handler": "onDealUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "deal": { "deal_pipeline_id": { "label": "Deal pipeline", "type": "dropdown", "value": 27149 }, "source_additional_info": {}, "deal_product_id": { "label": "Product", "type": "dropdown", "value": null }, "name": { "label": "Name", "type": "text", "value": "Deal update with owner" }, "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": "2020-06-24T18:30:55Z" }, "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": "multi_select_dropdown", "value": [] }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 39897 }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 39897 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-24T18:30:55Z" }, "expected_close": { "label": "Expected close date", "type": "date", "value": null }, "won_from": null, "age": { "label": "Age (in days)", "type": "number", "value": 0 }, "amount": { "label": "Deal value", "type": "decimal", "value": "1234.0" }, "product_ids": [], "deal_stage_id": { "label": "Deal stage", "type": "dropdown", "value": 178962 }, "base_currency_amount": { "label": "Deal value in Base Currency", "type": "decimal", "value": "1234.0" }, "team_user_ids": [], "id": 1357538, "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": "2020-06-24T18:30:54Z" }, "import_id": null, "expected_deal_value": { "label": "Expected deal value", "type": "decimal", "value": "1234.0" }, "currency_id": { "label": "Currency", "type": "dropdown", "value": 6615 }, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "stage_updated_time": { "label": "Deal stage updated at", "type": "date_time", "value": "2020-06-24T18:30:54Z" }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-24T18:31:09Z" }, "last_contacted_sales_activity_mode": { "label": "Last activity type", "type": "dropdown", "value": null }, "completed_sales_sequences": { "label": "Completed sales sequences", "type": "multi_select_dropdown", "value": [] }, "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": 39897 }, "probability": { "label": "Probability (%)", "type": "decimal", "value": 100 } }, "associations": { "source": null, "deal_payment_status": null, "campaign": null, "deal_pipeline": { "id": 27149, "name": "Default Pipeline", "position": 1, "is_default": true }, "products": [], "contacts": [], "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "sales_account": null, "deal_stage": { "id": 178962, "name": "New", "position": 1, "forecast_type": "Open" }, "territory": null, "deal_product": null, "currency": { "id": 6615, "currency_code": "USD", "exchange_rate": "1.0" }, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "deal_reason": null, "deal_type": null, "team_users": [] }, "changes": { "model_changes": { "name": [ "Deal with owner", "Deal update with owner" ], "amount": [ 123, 1234 ], "base_currency_amount": [ 123, 1234 ], "expected_deal_value": [ 123, 1234 ], "updated_at": [ "2020-06-24T18:30:54Z", "2020-06-24T18:31:09Z" ], "updater_id": [ null, 39897 ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onDealUpdate", "timestamp": 1593023469.8293262, "version": "2.0" }
EXPAND ↓

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

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onDealUpdate event.
deal deal object Details of the deal object.
associations associations object Associated objects related to the deal object.
changes object Updated field values.
onSalesAccountCreate

When a sales account is created, the onSalesAccountCreate event is invoked and the registered callback method is executed.
Register the onSalesAccountCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onSalesAccountCreate": { "handler": "onSalesAccountCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
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", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "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": "sales account with owner" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2020-06-24T18:31:38Z" }, "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": "multi_select_dropdown", "value": [] }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 39897 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 39897 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-24T18:31:38Z" }, "annual_revenue": { "label": "Annual revenue", "type": "decimal", "value": null }, "country": { "label": "Country", "type": "text", "value": null }, "team_user_ids": [], "id": 1100844, "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 }, "status": "Active", "number_of_employees": { "label": "Number of employees", "type": "dropdown", "value": null }, "mcr_id": 1275859140088463400, "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": "2020-06-24T18:31:37Z" }, "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": "2020-06-24T18:31:37Z" }, "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 sequences", "type": "multi_select_dropdown", "value": [] }, "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": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "business_type": null, "parent_sales_account": null, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": null, "industry_type": null, "team_users": [] } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onSalesAccountCreate", "timestamp": 1593023498.1006536, "version": "2.0" }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onSalesAccountCreate event.
sales_account sales_account object Details of the sales_account object created when the onSalesAccountCreate event is triggered.
associations associations object Associated objects related to the sales_account object.

Attributes of the actor object

ATTRIBUTE DATA TYPE DESCRIPTION
deal_pipeline_id number Identifier of deal pipelines that this actor is part of.
name
Mandatory
string Name of the actor.
is_active boolean Set to 'true' if the actor is verified.
email string Email address of the actor.
job_title string Designation of the actor.
uuid string Unique user identifier, this is auto-generated.
id number Identifier of the actor.
language string Language of the actor; by default, language is 'en'.
created_at string Creation timestamp, specified in the UTC format.
type string Helps categorize an actor.
updated_at string Updation timestamp, specified in the UTC format. For onSalesAccountCreate, this value is the same as created_at.
work_number number Official phone number of the actor.
time_zone string Time zone of the actor, specified in the UTC format.
is_forgotten boolean If this attribute is ‘true’, specified data is permanently deleted.
mobile_number string Mobile number of the user.

Attributes of the sales_account object

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

Attributes of the associations object

ATTRIBUTE DATA TYPE DESCRIPTION
creator user 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 user object Details of the account owner.
updater user object Details of the account updater.
industry_type string Industry type that the account belongs to.
team_users array Collaborators who work on a task associated with the sales account.
onSalesAccountUpdate

When a sales account is updated, the onSalesAccountUpdate event is is invoked and the registered callback method is executed.
Register the onSalesAccountUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onSalesAccountUpdate": { "handler": "onSalesAccountUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "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": "sales account update with owner" }, "custom_fields": [], "first_assigned_at": { "label": "First assigned at", "dom_type": "date_time", "value": "2020-06-24T18:31:38Z" }, "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": "multi_select_dropdown", "value": [] }, "creator_id": { "label": "Created by", "type": "dropdown", "value": 39897 }, "won_deals_amount": { "label": "Won deals amount", "dom_type": "decimal", "value": "0.0" }, "active_sales_sequences": { "label": "Active sales sequences", "type": "multi_select_dropdown", "value": [] }, "owner_id": { "label": "Sales owner", "type": "dropdown", "value": 39897 }, "is_deleted": false, "last_assigned_at": { "label": "Last assigned at", "type": "date_time", "value": "2020-06-24T18:31:38Z" }, "annual_revenue": { "label": "Annual revenue", "type": "decimal", "value": null }, "country": { "label": "Country", "type": "text", "value": null }, "team_user_ids": [], "id": 1100844, "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 }, "status": "Active", "number_of_employees": { "label": "Number of employees", "type": "dropdown", "value": null }, "mcr_id": 1275859140088463400, "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": "2020-06-24T18:31:37Z" }, "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": "2020-06-24T18:32:02Z" }, "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 sequences", "type": "multi_select_dropdown", "value": [] }, "phone": { "label": "Phone", "type": "phone_number", "value": "123123123" }, "updater_id": { "label": "Updated by", "type": "dropdown", "value": 39897 }, "parent_sales_account_id": { "label": "Parent account", "type": "auto_complete", "value": null }, "parent_owner_id": null }, "associations": { "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "territory": null, "business_type": null, "parent_sales_account": null, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "industry_type": null, "team_users": [] }, "changes": { "model_changes": { "name": [ "sales account with owner", "sales account update with owner" ], "created_at": [ "2020-06-24T18:31:37Z", "2020-06-24T18:31:37Z" ], "updated_at": [ "2020-06-24T18:31:37Z", "2020-06-24T18:32:02Z" ], "phone": [ null, "123123123" ], "updater_id": [ null, 39897 ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onSalesAccountUpdate", "timestamp": 1593023522.2470818, "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.

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onSalesAccountCreate event.
sales_account sales_account object Details of the sales_account object.
associations associations object Associated objects related to the sales_account object.
changes object Updated field values.
onCustomModuleCreate

When a custom module record is created, the onCustomModuleCreate event is invoked and the registered callback method is executed.
Register the onCustomModuleCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onCustomModuleCreate": { "handler": "onCustomModuleCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
116
117
118
119
120
121
122
123
124
125
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "custom_module_record": { "name": { "label": "Name", "type": "text", "value": "custom_create" }, "custom_fields": [ { "name": "cf_cm_edit", "label": "CM_edit", "column": "cf_str01", "type": "text", "value": null } ], "creator_id": { "label": "Created by", "type": "auto_complete", "value": { "id": 39897, "model": "user" } }, "owner_id": { "label": "Sales owner", "type": "auto_complete", "value": { "id": 39897, "model": "user" } }, "is_deleted": false, "id": 40764, "status": 1, "created_at": { "label": "Created at", "type": "date_time", "value": "2020-06-24T14:05:16Z" }, "import_id": null, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-24T14:05:16Z" }, "updater_id": { "label": "Updated by", "type": "auto_complete", "value": { "id": null, "model": "user" } }, "module_name": "cm_create" }, "associations": { "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null } } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onCustomModuleCreate", "timestamp": 1593007516.6833186, "version": "2.0" }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onCustomModuleCreate event.
custom_module_record custom_module_record object Details of the custom module record object created when the onCustomModuleCreate event is triggered.
associations associations object Associated objects related to the custom module record object.

Attributes of the custom_module_record object

ATTRIBUTE DATA TYPE DESCRIPTION
name object Name in the record.
custom_fields array 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 Identifier of the record.
status number Status of the record.
created_at object Record creation timestamp.
import_id string Identifier of the equivalent record in the external system from which it was imported.
recent_note object Recently added note against the record.
updated_at object Updated timestamp. For onCustomModuleCreate, updated_at is the same as created_at.
updater_id object Details of the user who updated the record.
module_name object Name of the module.

Attributes of the associations object

ATTRIBUTE TYPE DESCRIPTION
owner user object Details of custom module record creator.
updater user object Details of the custom module record updater.
creator user object Details of the custom module record creator.
onCustomModuleUpdate

When a custom module record is updated, the onCustomModuleUpdate event is invoked and the registered callback method is executed.
Register the onCustomModuleUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onCustomModuleUpdate": { "handler": "onCustomModuleUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "custom_module_record": { "name": { "label": "Name", "type": "text", "value": "custom_create_update" }, "custom_fields": [ { "name": "cf_cm_edit", "label": "CM_edit", "column": "cf_str01", "type": "text", "value": null } ], "creator_id": { "label": "Created by", "type": "auto_complete", "value": { "id": 39897, "model": "user" } }, "owner_id": { "label": "Sales owner", "type": "auto_complete", "value": { "id": 39897, "model": "user" } }, "is_deleted": false, "id": 40764, "status": 1, "created_at": { "label": "Created at", "type": "date_time", "value": "2020-06-24T14:05:16Z" }, "import_id": null, "recent_note": { "label": "Recent note", "type": "paragraph", "value": null }, "updated_at": { "label": "Updated at", "type": "date_time", "value": "2020-06-24T14:06:21Z" }, "updater_id": { "label": "Updated by", "type": "auto_complete", "value": { "id": 39897, "model": "user" } }, "module_name": "cm_create" }, "associations": { "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null } }, "changes": { "model_changes": { "name": [ "custom_create", "custom_create_update" ], "updater_id": [ null, 39897 ], "updated_at": [ "2020-06-24T14:05:16Z", "2020-06-24T14:06:21Z" ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onCustomModuleUpdate", "timestamp": 1593007581.9710617, "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.

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onCustomModuleUpdate event.
custom_module_record custom_module_record object Details of the custom module record object.
associations associations object Associated objects related to the custom module record object.
changes object Updated field values.
onAppointmentCreate

When an appointment is created, the onAppointmentCreate event is invoked and the registered callback method is executed.
Register the onAppointmentCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onAppointmentCreate": { "handler": "onAppointmentCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onAppointmentCreateCallback: function(payload) { console.log("Logging arguments from onAppointmentCreate 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "appointment": { "source_additional_info": {}, "targetable_id": null, "location": null, "latitude": null, "description": "asds", "creator_id": 39897, "targetable_type": null, "is_deleted": false, "longitude": null, "id": 283387, "is_allday": false, "end_date": "2020-06-24T17:00:45Z", "outcome_id": null, "created_at": "2020-06-24T16:18:10Z", "from_date": "2020-06-24T16:30:45Z", "title": "Test", "updated_at": "2020-06-24T16:18:10Z", "time_zone": "UTC", "checkedin_at": null, "updater_id": null }, "associations": { "targetable": null, "outcome": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "appointment_attendees": [ { "_association_id": 346754, "id": 39897, "_model": "FdMultitenant::User" }, { "_association_id": 346755, "id": 1399366, "_model": "Contact" } ], "updater": null } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onAppointmentCreate", "timestamp": 1593015490.2012472, "version": "2.0" }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onAppointmentCreate event.
appointment appointment object Details of the appointment object created when the onAppointmentCreate event is triggered.
associations associations object Associated objects related to the appointment object.

Attributes of the appointment object

ATTRIBUTE DATA TYPE DESCRIPTION
source_additional_info object Meta information specified as a custom JSON object.
targetable_id string Identifier of the contact/salesaccount/deal for whom appointment has been created.
location string Location where the appointment is scheduled.
latitude string Latitude of the location where the appointment is scheduled.
description string Description of the appointment.
creator_id number Identifier of the user who created the appointment.
targetable_type string Describes the entity value for whom the appointment was created.
Possible value: Contact
is_deleted boolean Set to 'true' if the appointment is deleted.
longitude string Longitude of the location where the appointment is scheduled.
id number Identifier of the appointment.
is_allday boolean Specifies if the appointment is an all-day appointment or not, the default value is false.
end_date
Mandatory
string Timestamp indicating the end of the appointment, or the end date, if this is an all-day appointment, specified in the UTC format.
outcome_id number Identifier of the appointment outcome.
created_at string Appointment creation timestamp, specified in the UTC format.
from_date
Mandatory
string Timestamp indicating the start of the appointment, or the start date if this is an all-day appointment, specified in the UTC format.
title
Mandatory
string Title of the appointment.
updated_at string Appointment updated timestamp, specified in the UTC format.
time_zone string Time zone of the region where the appointment is scheduled.
checkedin_at string Date and time of the scheduled appointment.
updater_id string Identifier of the user who created the appointment.

Attributes of the associations object

ATTRIBUTE DATA TYPE DESCRIPTION
targetable number Details of the contact/salesaccount/deal for whom the appointment has been created.
Attributes of the targetable object:
id (number): Identifier of the contact/salesaccount/deal.
_model (string): Description of the entity value.
Possible values : Contact, SalesAccount, Deal
outcome string Details of the user who updated the appointment.
creator user object Details of the user who updated the appointment.
appointment_attendees array Details of all the attendees associated with the appointment.
updater user object Details of the user who updated the appointment. For onAppointmentCreate, this value is null.
onAppointmentUpdate

When an appointment is updated, the onAppointmentUpdate event is invoked and the registered callback method is executed.
Register the onAppointmentUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onAppointmentUpdate": { "handler": "onAppointmentUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onAppointmentUpdateCallback: function(payload) { console.log("Logging arguments from onAppointmentUpdate 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "appointment": { "targetable_id": null, "location": null, "latitude": null, "description": "This is just an updated version of sample Appointment.", "creator_id": 39897, "targetable_type": null, "is_deleted": false, "longitude": null, "id": 283270, "is_allday": false, "end_date": "2016-06-20T06:00:00Z", "outcome_id": null, "created_at": "2020-06-24T14:03:26Z", "from_date": "2016-06-20T05:00:00Z", "title": "Updated Appointment", "updated_at": "2020-06-24T14:03:27Z", "time_zone": "UTC", "checkedin_at": null, "updater_id": 39897 }, "associations": { "targetable": null, "outcome": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "appointment_attendees": [ { "_association_id": 346754, "id": 39897, "_model": "FdMultitenant::User" }, { "_association_id": 346755, "id": 1399366, "_model": "Contact" } ], "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null } }, "changes": { "model_changes": { "title": [ "Sample Appointment", "Updated Appointment" ], "description": [ "This is just a sample Appointment.", "This is just an updated version of sample Appointment." ], "updater_id": [ null, 39897 ], "updated_at": [ "2020-06-24T14:03:26Z", "2020-06-24T14:03:27Z" ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onAppointmentUpdate", "timestamp": 1593007407.3063838, "version": "2.0" }
EXPAND ↓

The changes field is passed along with the payload. When an appointment is deleted, the is_deleted field is set to true.

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onAppointmentUpdate event.
appointment appointment object Details of the appointment object.
associations associations object Associated objects related to the appointment object.
changes object Updated field values.
onTaskCreate

When a task is created, the onTaskCreate event is invoked and the registered callback method is executed.
Register the onTaskCreate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onTaskCreate": { "handler": "onTaskCreateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onTaskCreateCallback: function(payload) { console.log("Logging arguments from onTaskCreate 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "task": { "source_additional_info": {}, "targetable_id": null, "description": "task create", "creator_id": 39897, "owner_id": 39897, "targetable_type": null, "is_deleted": false, "task_type_id": null, "id": 301943, "status": "Open", "outcome_id": null, "completed_date": null, "due_date": "2020-06-25T14:30:00Z", "created_at": "2020-06-24T14:18:23Z", "title": "task create", "updated_at": "2020-06-24T14:18:23Z", "updater_id": null }, "associations": { "targetable": null, "task_type": null, "outcome": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": null, "task_users": [ { "_association_id": 428048, "user_id": 39897 } ] } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onTaskCreate", "timestamp": 1593008303.3584583, "version": "2.0" }
EXPAND ↓

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onTaskCreate event.
task task object Details of the task object created when the onTaskCreate event is triggered.
associations associations object Associated objects related to the task object.

Attributes of the task object

ATTRIBUTE DATA TYPE DESCRIPTION
source_additional_info object Meta information specified as a custom JSON object.
targetable_id
Mandatory
number Identifier of the contact/salesaccount/deal for whom the task has been created.
description string Description of the task.
creator_id number Identifier of the user who created the task.
owner_id number ID of the user to whom the task has been assigned.
targetable_type
Mandatory
string Describes the entity value for whom the task was created.
Possible value:
Contact
is_deleted boolean Set to 'true' if the task has been deleted.
task_type_id number Identifier of task sales activity type
id number Identifier of the task.
status string Status of the task.
Possible values : Open (0), Completed (1)
outcome_id number Identifier of outcome of task sales activity type.
completed_date string Timestamp indicating when the task was completed, specified in the UTC format.
due_date
Mandatory
string Timestamp indicating when the task is to be completed, specified in the UTC format.
created_at string Task creation timestamp, specified in the UTC format.
title
Mandatory
string Title of the task.
updated_at string Task updated timestamp, specified in the UTC format. For onTaskCreate, this value is the same as created_at.
updater_id object Identifier of the user who updated the task.

Attributes of the associations object

ATTRIBUTE DATA TYPE DESCRIPTION
targetable targetable object Details of the contact/salesaccount/deal for whom the task has been created.
Attributes of the targetable object
id (number): ID of the contact/salesaccount/deal
_model (string): Description of the entity value.
Possible values:
Contact, SalesAccount, Deal
task_type task_type object Description of the task sales activity type.
Attributes of the task_type object
name (string): Name of the task.
sales_activity_type_id (number): Identifier of the sales activity type.
outcome outcome object Description of the task sales activity type outcome.
Attributes of the outcome object
id (number): Identifier of the task sales activity type outcome.
name (string): Description of the entity value.
creator user object Details of the user who created the task.
owner user object Details of the user to whom the task has been assigned.
updater user object Details of the user who updated the task
task_users array of objects Details (_association_id, user_id) of the task collaborators.

onTaskUpdate

When a task is updated, the onTaskUpdate event is invoked and the registered callback method is executed.
Register the onTaskUpdate event by using the following sample manifest.json content.

Copied Copy
1
2
3
4
5
"events": { "onTaskUpdate": { "handler": "onTaskUpdateCallback" } }

Define the corresponding callback by using the following sample server.js content:

Copied Copy
1
2
3
4
5
exports = { onTaskUpdateCallback: function(payload) { console.log("Logging arguments from onTaskUpdate 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
{ "iparams": {}, "region": "US", "productContext": { "url": "https://sample.myfreshworks.com/crm", "name": "freshworks_crm" }, "data": { "actor": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "language": "en", "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "is_forgotten": false, "mobile_number": null }, "task": { "source_additional_info": {}, "targetable_id": null, "description": "task update", "creator_id": 39897, "owner_id": 39897, "targetable_type": null, "is_deleted": false, "task_type_id": null, "id": 301943, "status": "Open", "outcome_id": null, "completed_date": null, "due_date": "2020-06-25T14:30:00Z", "created_at": "2020-06-24T14:18:23Z", "title": "task update", "updated_at": "2020-06-24T14:18:38Z", "updater_id": 39897 }, "associations": { "targetable": null, "task_type": null, "outcome": null, "creator": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "owner": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "updater": { "deal_pipeline_id": 27149, "name": "Jim Doe", "is_active": true, "email": "jim.doe@xyz.com", "job_title": "Engineer", "uuid": "195818342547907164", "id": 39897, "created_at": "2020-06-24T08:32:11Z", "type": "user", "updated_at": "2020-06-24T08:34:20Z", "work_number": null, "time_zone": "UTC", "mobile_number": null }, "task_users": [ { "_association_id": 428048, "user_id": 39897 } ] }, "changes": { "model_changes": { "title": [ "task create", "task update" ], "description": [ "task create", "task update" ], "updated_at": [ "2020-06-24T14:18:23Z", "2020-06-24T14:18:38Z" ], "updater_id": [ null, 39897 ] }, "system_changes": {}, "misc_changes": {} } }, "account_id": "195818342531129946", "domain": "sample.myfreshworks.com", "event": "onTaskUpdate", "timestamp": 1593008318.8261375, "version": "2.0" }
EXPAND ↓

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

Attributes of the data object

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onTaskUpdate event.
task task object Details of the task object.
associations associations object Associated objects related to the task object.
changes object Updated field values.
Test

For information on how to test external events, see Test the App.

Test an Omni App
Notes:
  • To test your serverless app, use the latest version of Chrome.
  • As testing is only a simulation of events, actual data or record associated with the event is not created in the back-end. To create actual data and then test the events, publish your app as a custom app and test the events manually.
  • Ensure that the JSON files that contain the sample payloads to test events, are available at <app's root directory>/server/test_data.
  • Ensure that you sign up for a Freshsales account.

To simulate an event and test your app:

  1. From the command line, navigate to the directory that contains the app related files and run the following command.$ fdk run

  2. In the address bar of the browser, enter https://localhost:10001/web/test. A dialog box is displayed.

  3. Select the product.

  4. Click Select an event. The list of all events configured in the manifest file is displayed.

  5. Select an event. The corresponding payload is displayed. To test a different scenario other than the default, edit the payload.

  6. Click Simulate. If the event is successfully simulated, the Simulate button changes to a Success button. If the event simulation fails because of invalid payload data, the Simulate button changes to a Failed button. Modify the payload appropriately and click Simulate.