Platform 2.3 migration, requests.json

Hello there! I was trying to migrate the app to the new Freshdesk platform which is 2.3 and I was stuck with the problem. I was trying to validate my config at Custom Config page and I can’t do this because Documentation says that Host in the requests.json in schema object could only could be taken form iParams:

But as long as I didn’t apply the config by pressing the Install button there’s no iparams values.

So here’s the question, how can I make the validation if there’s no iparam values yet, I tried to do it with the context, but it seems not working in Freshdesk, only locally.

Hi Fedor,
So for calls from the custom installation page, we do allow substitution of the host from the context as we won’t have iparams data yet, so can you help me understand the case better - context substitution is working when the app is published in the account and not locally, that too only for freshdesk?

1 Like

Hi Rahul, it still doesn’t work on Freshdesk platform, here’re some screenshots:

This is apiKey and Domain validation function

This is the validation request

This is the result on the Freshdesk platform

This is the result of local testing with fdk run

I don’t know why my message looks like that, but there was descriptions to the screenshots

401 error is for Freshdesk platform, status 200 is for local testing

Hi @FedorLyust,

The following code works fine for me. Could you try this out?

In the requests.json file:

  "getMe": {
    "schema": {
      "protocol": "https",
      "method": "GET",
      "host": "<%= context.domain %>",
      "path": "/api/v2/tickets",
      "headers": {
        "Authorization": "Basic <%= context.encodedApiKey %>",
        "Content-Type": "application/json"
        "retryDelay": 500,
        "maxAttempts": 3

In the iparams.js file:

    let result = await client.request.invokeTemplate("getMe", {
      context: {
        domain: domain,
        encodedApiKey: btoa(api_key)

Hi Raviraj, that was the solution indeed, thank you very much!

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.