Freshsales api configuration problem

Hi All,

I’m working on common app of FCSS (version 3), where my app will be displayed in freshdesk, freshsales, freshchat etc.

So, I’ve integrated apis for freshdesk and its working fine.

but when I started working on freshsales. its giving me this error.

 {
    "status": 400,
    "headers": {},
    "response": "runtime validation failed.",
    "errors": [
        {
            "message": "must be FQDN: app-test",
            "instancePath": "/schema/host"
        }
    ],
    "errorSource": "APP",
    "attempts": 1
}

so, our freshsales url is like this → “Freshworks

in my requests.json, I’ve this code

"fetchContactsByPhone": {
        "schema": {
            "method": "GET",
            "host": "<%= iparam.freshsales_subdomain %>",
            "path": "/api/lookup?q=<%= context.phone %>&f=mobile_number&entities=contact",
            "headers": {
                "Authorization": "Token token=<%= iparam.freshsales_api_key %>",
                "Content-Type": "application/json"
            }
        },
        "options": {
        }
    },

for iparams.freshsales_subdomain, I’ve tried these below values
app-test, Freshworks, app-test.myfreshworks.com

But still same response.

with freshdesk full domain is working fine. but here in freshsales, I don’t what is the problem.

Please let me know what I’m missing.

I’ve attached this iparams view.

Screenshot from 2024-07-09 10-22-56

Hey @Yash_Lekinwala,
The iparams defined is accepting the Freshsales subdomain and substituting the same in request template’s host

Change the above config to below -

"host": "<%= iparam.freshsales_subdomain %>.myfreshworks.com"

This should solve the error.

Hi @zach_jones_noel ,

Thanks for help.

I’ve tried it, and feels like api is responding, but the response i’m getting is in html.
like this in below image

where as in freshdesk api, i’m getting response as json.
like this in below image

still something is missing.
do i need to pass some more flag or something with api.

Hey @Yash_Lekinwala,
HTML response would be an error response - 404 / 403.

path for the Freshsales APIs should be -

"path": "/crm/sales/api/lookup?q=<%= context.phone %>&f=mobile_number&entities=contact",

This should resolve the error.

1 Like

Hey @zach_jones_noel
Thank for quick response.

Your answer is working fine.

here is my correct code. However, just a minor change needed in path that, it must start with “/”.

"fetchContactsByPhone": {
        "schema": { :smile:
            "method": "GET",
            "host": "<%= iparam.freshsales_subdomain %>.myfreshworks.com",
            "path": "/crm/sales/api/lookup?q=<%= context.phone %>&f=mobile_number&entities=contact",
            "headers": {
                "Authorization": "Token token=<%= iparam.freshsales_api_key %>",
                "Content-Type": "application/json"
            }
        },
        "options": {
        }
    },

I don’t why didn’t try this before. However I’ve tried adding this “crm/sales” in host but still I was getting same response.

Thank you once again. :smile: