In a Freshworks app, if you want to perform an HTTP request, you must add the domain of the URL or API endpoint in the “whitelisted-domains” section of the manifest.json file.
You can do this in two ways.
- Add the domain of the URLs manually by hard-coding them
- Add the URL dynamically from the Installation page
Firstly, this is how you can hard-code the domains in the Manifest.json.
The blob/wild-card (*) as a subdomain allows any sub-domain for a given domain in the URL.
Secondly, you can dynamically add the URL from the Installation page.
Here’s how you can do this
Add an additional field for the URL/endpoint in the iparams.json
"domain_url": {
"display_name": "Domain to allow list",
"description": "Please enter the URL to allow list",
"type": "url",
"required": true,
}
Notice the field type is set to
url
which means it’s not allowed to use blob/wild-card*
in the URL. If you want to use the (*), set the field type totext
and continue.
Use the iparam template with the appropriate field name to dynamically fetch the URL from the installation page. So, add the following JSON in the Manifest.json
"whitelisted-domains": [
"https://<%= iparam.domain_url %>"
]