When you create a Liveagent Deployment in the UI, you are presented with a script snippet to paste into the page where you will deploy Liveagent; the first line includes a reference to the liveagent endpoint host, for example:

<script type='text/javascript' src='https://c.la6cs.salesforceliveagent.com/content/g/js/29.0/deployment.js'></script>

Is there a way to determine the liveagent hostname (c.la6cs.salesforceliveagent.com in the code above) programmatically? I can query for all of the other key values - org id, deployment id, even the id of my chat buttons.

I am aware that I could store the endpoint URL in a custom setting, however, this requires maintenance any time the code is deployed to a new org. Is there any way to determine the correct url on the fly?


Unfortunately, no there is not a way to do it. The recommended approach is to use what you are already aware of -- Custom Settings. See this #askforce tweet responded to by the product manager at Salesforce.

Is there a way to determine LiveAgent API Endpoint from Apex or JS? liveagent.init(endpoint,chakey,org)


Unfortunately, no, not today. Best practice is to store these in a custom setting in the org.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.