Skip to content

Commit

Permalink
feature(integration): add track call support for freshmarketer and fr…
Browse files Browse the repository at this point in the history
…eshsales (#1467)

* add track call/marketing-list

* reformat code

* reformat group call

* added reference of api

* add track call for freshsales

* update track call

* add test cases for freshmarketer

* freshsales revamp code

* address comment

* add freshsales testcases

* update freshmarketer and  freshsales testcases

* update response.json

* remove dettion support

Co-authored-by: Utsab Chowdhury <[email protected]>
  • Loading branch information
sauravlal-rudderstack and utsabc authored Oct 13, 2022
1 parent c44dec2 commit bf0be4f
Show file tree
Hide file tree
Showing 16 changed files with 5,668 additions and 241 deletions.
20 changes: 19 additions & 1 deletion __mocks__/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ const {
const { userGetRequestHandler, userPutRequestHandler } = require("./user.mock");
const { mixpanelPostRequestHandler } = require("./mixpanel.mock");
const { clickUpGetRequestHandler } = require("./clickup.mock");
const freshmarketerPostRequestHandler = require("./freshmarketer.mock");
const {
freshmarketerPostRequestHandler,
freshmarketerGetRequestHandler
} = require("./freshmarketer.mock");
const { mondayPostRequestHandler } = require("./monday.mock");
const {
freshsalesGetRequestHandler,
freshsalesPostRequestHandler
} = require("./freshsales.mock");

const urlDirectoryMap = {
"api.hubapi.com": "hs",
Expand Down Expand Up @@ -128,6 +135,12 @@ function get(url, options) {
if (url.includes("https://api.clickup.com")) {
return Promise.resolve(clickUpGetRequestHandler(url));
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return Promise.resolve(freshmarketerGetRequestHandler(url));
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return Promise.resolve(freshsalesGetRequestHandler(url));
}
return new Promise((resolve, reject) => {
if (mockData) {
resolve({ data: mockData, status: 200 });
Expand Down Expand Up @@ -193,6 +206,11 @@ function post(url, payload) {
resolve(freshmarketerPostRequestHandler(url));
});
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return new Promise((resolve, reject) => {
resolve(freshsalesPostRequestHandler(url));
});
}
if (
url.includes("https://api.monday.com") &&
payload.query.includes("query")
Expand Down
285 changes: 285 additions & 0 deletions __mocks__/data/freshmarketer/response.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,290 @@
}
]
}
},
"https://domain-rudder.myfreshworks.com/crm/sales/api/selector/sales_activity_types": {
"sales_activity_types": [
{
"partial": true,
"id": 70000666879,
"name": "own-calender",
"internal_name": "cappointment",
"show_in_conversation": true,
"position": 1,
"is_default": false,
"is_checkedin": false
},
{
"partial": true,
"id": 70000663932,
"name": "fb-support",
"internal_name": "facebook",
"show_in_conversation": true,
"position": 2,
"is_default": false,
"is_checkedin": false
},
{
"partial": true,
"id": 70000663746,
"name": "twitter sales",
"internal_name": "twitter",
"show_in_conversation": true,
"position": 3,
"is_default": false,
"is_checkedin": false
},
{
"partial": true,
"id": 70000646396,
"name": "linked sales",
"internal_name": "linkedin",
"show_in_conversation": true,
"position": 4,
"is_default": false,
"is_checkedin": false
},
{
"partial": true,
"id": 70000642330,
"name": "facebook sales",
"internal_name": "facebook",
"show_in_conversation": true,
"position": 5,
"is_default": false,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612897,
"name": "Chat",
"internal_name": "chat",
"show_in_conversation": true,
"position": 6,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612898,
"name": "Phone",
"internal_name": "phone",
"show_in_conversation": true,
"position": 7,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612899,
"name": "Meeting",
"internal_name": "appointment",
"show_in_conversation": true,
"position": 8,
"is_default": true,
"is_checkedin": true
},
{
"partial": true,
"id": 70000612900,
"name": "Task",
"internal_name": "task",
"show_in_conversation": true,
"position": 9,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612901,
"name": "Email",
"internal_name": "email",
"show_in_conversation": true,
"position": 10,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612902,
"name": "SMS Outgoing",
"internal_name": "sms_outgoing",
"show_in_conversation": true,
"position": 11,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612903,
"name": "Reminder",
"internal_name": "reminder",
"show_in_conversation": false,
"position": 12,
"is_default": true,
"is_checkedin": false
},
{
"partial": true,
"id": 70000612904,
"name": "SMS Incoming",
"internal_name": "sms_incoming",
"show_in_conversation": true,
"position": 13,
"is_default": true,
"is_checkedin": false
}
]
},
"https://domain-rudder.myfreshworks.com/crm/sales/api/contacts/upsert": {
"contact": {
"id": 70054866612,
"first_name": null,
"last_name": null,
"display_name": "[email protected]",
"avatar": null,
"job_title": null,
"city": null,
"state": null,
"zipcode": null,
"country": null,
"email": "[email protected]",
"emails": [
{
"id": 70047409219,
"value": "[email protected]",
"is_primary": true,
"label": null,
"_destroy": false
}
],
"time_zone": null,
"work_number": null,
"mobile_number": null,
"address": null,
"last_seen": null,
"lead_score": 0,
"last_contacted": null,
"open_deals_amount": null,
"won_deals_amount": null,
"links": {
"conversations": "/crm/sales/contacts/70054866612/conversations/all?include=email_conversation_recipients%2Ctargetable%2Cphone_number%2Cphone_caller%2Cnote%2Cuser&per_page=3",
"timeline_feeds": "/crm/sales/contacts/70054866612/timeline_feeds",
"document_associations": "/crm/sales/contacts/70054866612/document_associations",
"notes": "/crm/sales/contacts/70054866612/notes?include=creater",
"tasks": "/crm/sales/contacts/70054866612/tasks?include=creater,owner,updater,targetable,users,task_type",
"appointments": "/crm/sales/contacts/70054866612/appointments?include=creater,owner,updater,targetable,appointment_attendees,conference,note",
"reminders": "/crm/sales/contacts/70054866612/reminders?include=creater,owner,updater,targetable",
"duplicates": "/crm/sales/contacts/70054866612/duplicates",
"connections": "/crm/sales/contacts/70054866612/connections"
},
"last_contacted_sales_activity_mode": null,
"custom_field": {},
"created_at": "2022-10-11T08:42:15-04:00",
"updated_at": "2022-10-11T08:42:15-04:00",
"keyword": null,
"medium": null,
"last_contacted_mode": null,
"recent_note": null,
"won_deals_count": null,
"last_contacted_via_sales_activity": null,
"completed_sales_sequences": null,
"active_sales_sequences": null,
"web_form_ids": null,
"open_deals_count": null,
"last_assigned_at": null,
"tags": [],
"facebook": null,
"twitter": null,
"linkedin": null,
"is_deleted": false,
"team_user_ids": null,
"external_id": null,
"work_email": null,
"subscription_status": 1,
"subscription_types": "2;3;4;5;1",
"customer_fit": 0,
"record_type_id": "71012139284",
"whatsapp_subscription_status": 2,
"sms_subscription_status": 2,
"last_seen_chat": null,
"first_seen_chat": null,
"locale": null,
"total_sessions": null,
"phone_numbers": []
}
},
"https://domain-rudder.myfreshworks.com/crm/sales/api/lists": {
"lists": [
{
"id": 70000053624,
"name": "Sample list"
},
{
"id": 70000056575,
"name": "list1-test"
},
{
"id": 70000058627,
"name": "Jio 5G Group"
},
{
"id": 70000058628,
"name": "Airtel 5G Group"
},
{
"id": 70000059716,
"name": "Voda 5G"
}
],
"meta": {
"total_pages": 1,
"total": 5
}
},
"https://domain-rudder.myfreshworks.com/crm/sales/api/selector/lifecycle_stages": {
"lifecycle_stages": [
{
"id": 71012139274,
"name": "Sales Qualified Lead start",
"position": 1,
"disabled": false,
"default": true,
"type": "Sales Qualified Lead",
"contact_status_ids": [70000697858, 70000697859, 70000697860]
},
{
"id": 71012139273,
"name": "Lead",
"position": 2,
"disabled": false,
"default": true,
"type": "Lead",
"contact_status_ids": [
70000697854,
70000697855,
70000697856,
70000697857
]
},
{
"id": 71012806409,
"name": "final Customer",
"position": 3,
"disabled": false,
"default": false,
"type": "Custom",
"contact_status_ids": [70000736543, 70000736544]
},
{
"id": 71012139275,
"name": "Customer",
"position": 4,
"disabled": false,
"default": true,
"type": "Customer",
"contact_status_ids": [70000697861, 70000697862]
}
]
}
}
Loading

0 comments on commit bf0be4f

Please sign in to comment.