"RequestAPI - Received unexpected response from Parent" Unable to get Toast Notifications to appear for ticket creation


I have created an application that allows for a new ticket to be created when certain fields are filled in. This application takes the values of those fields and send them in a post request for ticket creation. The issue I am facing is the toast notifications that I have set up do not appear for this function. And I get this response when I log the response of the post request


This response is logged even if the post request returns 201 and the ticket is created. Here is the code snippet for the ticket creation function. Hoping someone can help me identify the issue. All other notifications where the “showNotification” function is set to run work as intended.

function createFreshserviceTicket (email, subject, description, agent, group) {
		.post('https://<%=iparam.freshservice_subdomain%>.freshservice.com/api/v2/tickets', {
			headers : {
				Authorization  : 'Basic <%= encode(iparam.freshservice_api_key)%>',
				'Content-Type' : 'application/json;charset=utf-8'
			body    : JSON.stringify({
				description  : `${description}`,
				email        : `${email}`,
				priority     : 1,
				status       : 2,
				source       : 1002,
				group_id     : parseFloat(group),
				responder_id : parseFloat(agent),
				subject      : `${subject}`
		.then(function () {
			showNotification('success', 'Ticket is successfully created');
			//Clears user input after posting data
		.catch(function (error) {
			showNotification('error', 'Unable to create ticket');

Here is the function for showing notifications.

 function showNotification (status, message) {
	client.interface.trigger('showNotify', {
		type    : `${status}`,
		message : `${message}`

Thank you in advance for any help offered.


1 Like

Hiya @Zach, I’m new here, and taking my first stab at this forum. So, this may not work, but:

From the API docs on create ticket, I see there are limited number of values that you can put for source, and 1002 isn’t one of them. Could that be the cause of the validation error?


1 Like

Thank you @kaustavdm,

Actually the 1002 is the allocated value for a custom source we created specifically to identify tickets created by the app. This attribute does not prevent a ticket from being created it just can’t be null, it could however be the cause to the strangely labeled log error when the RequestAPI is called, that I am not sure of.

I am hoping that the DevRel team can offer some insight on what the error might indicate.

Glad to have you a part of the forum. This place has a ton of information and the people are awesome!

1 Like

Thanks for the explanation and encouragement :slight_smile: TIL, there can be custom sources. :smiley:

I’ve reached out to the team and will get some eyeballs on this tomorrow. I’ll also try reproducing the issue on my end.

Hey @Zach,

Could you please check the following and confirm?

  1. If the error is printed by the catch function, maybe add another log with a string before console.error and check if it gets printed,
  2. could you share the complete response string displayed in the screenshot?

Stay Safe :slight_smile:


I’m having the same issue. It only happens when I call the clent.requests API from a modal dialog. Here is my setup and what I am seeing:


app.html is main app
changeStart.html is modal dialog
I have function app.js that is read from both files above
app.js defines following two functions:

async function updateTraining(training_id, body) {
  var url='https://<%= (iparam.crm_domain) %>/crm/sales/api/custom_module/cm_training/' + training_id
  var headers={ "Content-Type": "application/json", "Authorization": "Token token=<%= (iparam.crm_api_key) %>" }
  try {
    var res = await _asyncRequest('put', url, headers, body )
  } catch(e) { console.log(e); throw(e) }
  if(debug) console.log(JSON.parse(res.response))
  // console.log(res)

const _asyncRequest = (method, url, headers, body={}) => {
  // Returns promise which can be held until complete with await (async/await model)
  return client.request[method](url, { body: JSON.stringify(body), headers: headers } )

Modal changeStart.html is launched from within app.js as follows:

async function changeStart(training_id) {
  console.log( "Training ID is", training_id )
    'showModal', useTemplate('Change start date', './views/changeStart.html', {training_id: training_id})

When submitted the changeStart.html modal runs following function:

  async function submitValues() {
    console.log("value", val)
    console.log("body", body, "training_id", training_id)
    res = await updateTraining(training_id, body)

This is where the problem occurs. updateTraining() catches error from request call bu the REALLY ODD thing is the response is 200 / ok.


I then ran the same function from app.js and it ran just fine.

The problem appears to be due to calling the method from the modal dialog. But I don’t know enough about javascript to know why.

I’ll just have to send the value from dialog back and run from there for now but any insight would be appreciated.

1 Like

Hey @stevemc,

Ideally, the main HTML and the modal HTML should have separate JS files, Here is a sample app for working with individual JS files,

Sample app

Once each HTML has it’s own js file, you can either replicate the updateTraining(training_id, body) function in the modal.js and use it directly
you can use instance method (Instance Method) to send just the data from modal to the parent and use the updateTraining(training_id, body) function in the app.js to make the call.

Hope this helps!

Stay Safe :slight_smile:


I’m also facing this “RequestAPI - Received unexpected response from Parent” issue.
I’ve started getting this yesterday evening after I’ve finished working on a marketplace app update and started to test the app in order to get the coverage > 80% for the submission.

In my case, the response seems to be successful (status: 200), but there is some error in the fresh_client.js.


Also, for some reason, once this error happens, the app is restarted, which results in some sort of an infinite loop.

I’ve tried the following and it didn’t help:

  1. Refreshing the web page.
  2. Cleaning cache/cookies.
  3. Running the app in an incognito tab.
  4. Running the app in a different web browser.

Here are the specs from the manifest.json:

    "platform-version": "2.2",
    "engines": {
        "node": "12.22.0",
        "fdk": "7.0.1"

The app is platform 2.2 compatible and all whitelisted-domains are specified in the manifest.json as well.

Everything used to work yesterday until evening.

Could you please help me with this?

Good Day!
Hope you are doing good!
Sorry for the inconvenience caused!

Possible can you please share with us the FDK logs and HRA logs to debug further?


@ilya.belyavskiy ,
Hope you are doing good!
can you please share the logs to proceed further!

or shall we assume that your error is fixed by default?


@Santhosh This error is happening when user is invoking request in the model’s js file. This works fine if executed from main.js file.
Do we have a resolution for this.
My app has:
“platform-version”: “2.2”,
“node”: “12.22.7”,
“fdk”: “7.4.0”

can you please check the freshclient is injected into the model, if so, can you please share the HAR logs and error screenshot to debug further


1 Like


I am getting this error in the Iparams page, Function is giving an error when we make api call after click event catched using Jquery or dom. if we use directly it is giving correct response.