Request Templates - error while substituting templates

Hello,

I am trying to get tickets from Freshdesk using the new fdk 9.0.0 request templates. I am receiving the error “error while substituting templates.” I have followed all of the documentation here and here.

Request.json file

{
  "getFreshdeskOpenTickets": {
    "schema": {
      "method": "GET",
      "host": "ipostal1.freshdesk.com",
      "path": "/api/v2/tickets",
      "headers": {
        "Authorization": "Basic <%= encode(iparam.apikey) %>",
        "Content-Type": "application/json"
      },
      "query": {
        "email": "<%= context.email %>"
      }
    }
  }
}

Manifest.json

{
  "platform-version": "2.3",
  "product": {
    "freshdesk": {
      "location": {
        "ticket_sidebar": {
          "url": "index.html",
          "icon": "styles/images/icon.svg"
        }
      },
      "requests": {
        "getFreshdeskOpenTickets": {}
      }
    }
  },
  "engines": {
    "node": "18.14.2",
    "fdk": "9.0.0"
  }
}

app.js – invoke template

const contactData = await client.data.get('contact');
const { contact: { email } } = contactData;
const response = await client.request.invokeTemplate("getFreshdeskOpenTickets", {
      context: {"email": email}
      // body: JSON.stringify(body)
 })

Hey @Luke_Padawer,

Welcome to Freshworks Developer Community. :tada:

I see you are using an iparam value in the authorizer Basic <%= encode(iparam.apikey) %> but not in host, is apikey defined in iparams.json or custom iparams page and when you are testing it locally, you are updating the iparams values in http://localhost:10001/custom_configs?

1 Like

Hi @Luke_Padawer

Can you check if the file name is requests.json and present inside the config folder?

1 Like

Thank you both for your replies. @zach_jones_noel was correct – my iparam value was set to ‘apiKey’ in iparams.json, but I used ‘apikey’ instead.

1 Like

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