My FreshChat app collects the user’s API key during installation, and uses it to make API calls on their behalf. I recently discovered, however, that now FreshChat accounts hosted in different data centres require different API endpoints to be used. For example, for the Indian data centre the endpoint is https://api.in.freshchat.com/v2/ and for the US it’s https://api.freshchat.com/v2/
Is there a best practice for how to identify the proper data centre for the user so that we can make API calls on their behalf to the correct API endpoint? Or should we just attempt each of the endpoints until one of them works, then use that one going forward for that user?
You could ask the customer to provide their domain as well, in addition to the API Token that you are requesting.
In this example, I’m asking for the Freshchat Domain and the API Token.
I use the domain name to construct the endpoint https://jaya.freshchat.com/v2/agents to verify the token.