Call log is not getting created for customer's acccount

Hi,
cti_phone_calls api is working for our account https://knowlaritycommunicationspvtltd.myfreshworks.com/crm/sales/
but it is throwing 422 error for customer’s account. Below is api signature and response
{ method: ‘POST’,
url:
https://sulekhae-learn.myfreshworks.com/crm/sales/api/cti_phone_calls’,
headers:
{ authorization: ‘Token token=apikey’,
‘content-type’: ‘multipart/form-data;’ },
formData:
{ phone_call:
‘{“call_direction”:true,“note”:{“description”:“Details of the call:\n Time: 2021-07-20 12:23:23.980091+00:00\n Customer: +918130900734\n Business Number: +914446383047\n Action: Phone\n Call Status: Answered\n Agent: \n Call ID: d34339f3-2b5a-4acb-bb6f-d02ea5167b2d\nYou can download the call recording here”},“targetable_type”:“contact”,“number”:"+918130900734",“targetable”:{“last_name”:"+918130900734",“mobile_number”:"+918130900734"}}’ },
json: true }
response - { error_code: 422 }

Please check and update.

1 Like

Hey @gourav.kumar,

422 usually means, the payload is not in the desired format or the content-type is not supported by the API,
Could you please check the payload structure and format?

Stay Safe :slight_smile:

Hi @velmurugan

payload is in desired format. content-type is correct because the api in same format is working for my internal account but the same api on replacing url and apikey of customer’s account it is not working. Below is proof. In both request only url,authorization and callID differs which should not impact api’s functionality.

Please check and update. This is impacting integration for customer.

Aoi call for our internal account
{ method: ‘POST’,
url:
https://knowlaritycommunicationspvtltd.myfreshworks.com/crm/sales/api/cti_phone_calls’,
headers:
{ authorization: ‘Token token=apikey’,
‘content-type’: ‘multipart/form-data;’ },
formData:
{ phone_call:
‘{“call_direction”:true,“note”:{“description”:“Details of the call:\n Time: 2021-05-31 12:39:42.932414+00:00\n Customer: +919030311320\n Business Number: +917669635593\n Action: Call Group\n Call Status: +918657488843\n Agent: +918657488843\n Call ID: 204ccb33-e260-454c-adb4-f4d8a4155816”},“targetable_type”:“contact”,“number”:"+919030311320",“targetable”:{“last_name”:"+919030311320",“mobile_number”:"+919030311320"}}’ },
json: true }
api response - { contacts:
[ { partial: true,
id: 70004343460,
first_name: null,
last_name: ‘+919030311320’,
display_name: ‘+919030311320’,
avatar: null,
email: null,
work_number: null,
mobile_number: ‘+919030311320’,
job_title: null,
last_seen: null,
has_access: true,
lead_score: 0,
sales_accounts: ,
owner_id: null,
deal_ids: } ],
phone_numbers: ,
phone_callers:
[ { id: 70000034105,
number: ‘+919030311320’,
country: ‘IN’,
state: null,
city: null } ],
notes:
[ { id: 70000429490,
description:
‘Details of the call:\n Time: 2021-05-31 12:39:42.932414+00:00\n Customer: +919030311320\n Business Number: +917669635593\n Action: Call Group\n Call Status: +918657488843\n Agent: +918657488843\n Call ID: 204ccb33-e260-454c-adb4-f4d8a4155816’,
created_at: ‘2021-07-22T13:44:52+05:30’,
updated_at: ‘2021-07-22T13:44:52+05:30’,
url: null,
duration: null,
creater_id: 70000010327,
has_access: true,
collab_context: [Object],
targetable: [Object] } ],
user:
[ { id: 70000010327,
display_name: ‘Gourav Kumar’,
email: ‘konnect.developer@knowlarity.com’,
is_active: true,
work_number: ‘+918130900734’,
mobile_number: ‘+918130900734’ } ],
users: ,
outcomes: ,
phone_calls:
[ { id: 70000183257,
call_duration: null,
call_direction: true,
recording_duration: null,
status: ‘incoming’,
recording: null,
conversation_time: ‘2021-07-22T13:44:52+05:30’,
cost: 0,
is_manual: true,
root_phone_call_id: 70000183257,
child_phone_calls: null,
outcome_id: null,
source: null,
freshcaller_id: null,
freshcaller_number: null,
freshcaller_number_country: null,
targetable: [Object],
phone_number_id: null,
phone_caller_id: 70000034105,
note_id: 70000429490,
user_id: null } ],
deals: }
Api response code - 201

Api call for customer’s account
{ method: ‘POST’,
url:
https://sulekhae-learn.myfreshworks.com/crm/sales/api/cti_phone_calls’,
headers:
{ authorization: ‘Token token=apikey’,
‘content-type’: ‘multipart/form-data;’ },
formData:
{ phone_call:
‘{“call_direction”:true,“note”:{“description”:“Details of the call:\n Time: 2021-05-31 12:39:42.932414+00:00\n Customer: +919030311320\n Business Number: +919311583196\n Action: Call Group\n Call Status: +918657488843\n Agent: +918657488843\n Call ID: 204ccb33-e260-454c-adb4-f4d8a4155816”},“targetable_type”:“contact”,“number”:"+919030311320",“targetable”:{“last_name”:"+919030311320",“mobile_number”:"+919030311320"}}’ },
json: true }
Api response - { error_code: 422 }
Api response code - 422

1 Like

Please make sure to pass values for Mandatory/any one unique field in the customer account. For example if Email and External ID fields are unique then we need to pass details related to any one of those fields otherwise the Contact creation will fail and you will get 422 error for Call log. Or since you are passing Mobile number value, you can mark Mobile field as a unique field and this should work.

1 Like

@Pulkit_Chowdry Thanks for the update

1 Like