App routing automation

Hi,

I have developed an app for doing a Routing Automation Rule, but it doesn’t work.

The call always enter in “IF APP DID NOT UNDERSTAND”:

In server.js finally my response is sended in this way:
‘’’
let data = {
response,
“app_variables”: {}
};

  console.log("data: ", data);

  return renderData(null, { data });

‘’’
In my actions.js I have the next:

‘’’
{
“onCallCreateHandler”: {
“display_name”: “Valida Números de teléfono en función del campo Region de la Empresa en Freshdesk”,
“parameters”: {
“$schema”: “http://json-schema.org/draft-07/schema#”,
“type”: “object”,
“properties”: {
“input”: {
“type”: “string”
}
},
“required”: [
“input”
]
},
“response”: {
“type”: “string”
},
“description”: “Valida Números de teléfono en función del campo Region de la Empresa en Freshdesk, en función de esto se derivará a una cola u otra en Freshcaller.”
}
}
‘’’
And in the logs I have the value of the response that I want:

As you can see, as response I have: “hubEuropa”, that is one of values on the Routing Automation Rule.

Please, can you help me?

Thanks in advance and greetings.

Hi there!

Do you have any news about this issue?

We have a customer waiting to solve this problem.

Thanks in advance and greetings.

Hi @llopez,

Greetings!

In call routing, the option “IF APP DID NOT UNDERSTAND” is likely routed by default to ensure that calls which cannot be effectively processed by the automated system are directed to a human agent or an appropriate escalation point for assistance. This feature is often implemented to improve customer experience by preventing callers from getting stuck in an endless loop of automated messages if the system cannot comprehend their request or command.

If you would like to expedite the process or need an immediate solution reach out to support@freshcaller.com

Thank you.

1 Like

Thank you very much Benny for your help and information.

Yes, I understand, but the problem is why the rule doesn’t understand the app response.

As you can see, the response theoretically is correct.

Thanks in advance and greetings.

Hi @llopez,

From your function name (onCallCreateHandler), I sense that the app listens to the “onCallCreate” event. It’s a product event, different from the Custom Actions for Routing Automation. So, the app should not listen to this product event unless required. Please write two separate functions for Custom Action and the onCallCreate product event if required.

In the app SDK documentation, one additional step is missing for building Custom Actions for Routing Automation in platform version 2.3. The custom action has to be defined as a function in the manifest.json file. Please define your function name used for custom action like the following,

{
  "platform-version": "2.3",
  "product": {
    "freshcaller": {
      "requests": {
        "myAPIrequest": {}
      },
      "functions": {
        "validateVIPPhoneNumber": {
          "timeout": 20
        }
      }
    }
  }
}

In the above code, “validateVIPPhoneNumber” is the custom action name. You can replace it with the actual function name from the server.js file of your app.

Please print the entire argument from the custom action function and check if it gets printed, and use the appropriate variable in the function by noticing the format from the logs. It would vary between local testing and production as the local simulation is done with a customized payload.

Hi Raviraj,

Thank you very much for your help.

Now I have manifest.json in this way:

{
  "platform-version": "2.3",
  "product": {
    "freshcaller": {
      "requests": {
        "getContactByPhone": {},
        "getCompanyByID": {}
      },
      "functions": {
        "validateVIPPhoneNumber": {
          "timeout": 20
        }
      }
    }
  },
  "engines": {
    "node": "18.19.1",
    "fdk": "9.0.8"
  }
}

actions.js in this way, and I have tried the type of response with “object” and “string”:

{
  "validateVIPPhoneNumber": {
    "display_name": "Valida Números de teléfono en función del campo Region de la Empresa en Freshdesk",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "input": {
          "type": "string"
        }
      },
      "required": [
        "input"
      ]
    },
    "response": {
      "type": "string"
    },
    "description": "Valida Números de teléfono en función del campo Region de la Empresa en Freshdesk, en función de esto se derivará a una cola u otra en Freshcaller."
  }
}

I have server.js in this way:

exports = {

  validateVIPPhoneNumber: async function (request) {
    try {
...
"Code for the logic of the app"
...

let data = {
        response,
        "app_variables": {}
      };

      console.log("data: ", data);

      return renderData(null, { data });

    } catch... etc.

Freshcaller flow in the Routing Automation always enters into “IF APP DID NOT UNDERSTAND”

Furthermore, the app doesn’t print any log.

Please, can you help me? Maybe it would be helpful if you can provide me an example app in 2.3 version of Routing Automation. The link of the example in Github is down (https://github.com/freshworks-developers/routing-automation-freshcaller).

Finally, if you want, I can provide you the whole app for revising.

Thanks in advance and greetings.

Hi,

Do you have any news about this?

Thanks in advance and greetings.

Hi,

It has been 7 days without response.

Please, can you help me?

Thanks in advance, greetings.

Hi @llopez,

I have now converted the sample app on Routing automation to platform version 2.3 and opened the link now. Please check if the current sample app works for you.

If the call gets “0” as an input from the caller, the “respondOrderStatus” function will return “Freshcaller” as a response. If the same word is handled, the workflow will be routed accordingly. Please check if you can test this as a new flow.

Have you already configured the respective workflow as a custom action in the phone number settings? If not, configure it like the below in the Phone numbers and edit it for the respective call center incoming number.

If it’s configured well, the app function will always get triggered, and any logs in the entry point of the function will get printed. Test it once if the function gets triggered properly.

Hi Raviraj,

Unfortunately, the link of the sample app on Routing automation doesn’t work:
the sample app on Routing automation

On the other hand, I have the link of the 2.2 version:

Also, I have looked for here, but there is not anything about Freshcaller Routing Automations:
https://github.com/orgs/freshworks-developers/repositories

Anyway, I attach you our app for reviewing.
Freshcaller_Routing_Atuomation.zip (7.5 KB)

Also, in particular, our app doesn’t use single digit input or “respondOrderStatus” function. Our app uses “validateVIPPhoneNumber” method. It takes the contact phone number to get a value from Freshdesk. Once it is got, the app responses with a string value to response.

For example, in testing mode, I get the string response: “Benelux”:

In Freshcaller I have configured the same response:

Finally, of course, we have our phone number linked to the Routing Automation Rule:

Please, if you can provide me a 2.3 version example and to review our app I would be very grateful.

Thanks in advance and greetings.

Sorry, I just noticed that the repository is in private visibility. It is now public.

Just in case, here’s the source code with the 2.3 version for the same sample app repo.
routing-automation-freshcaller.zip (2.8 KB)

I will review your app and confirm. The app code looks good, I will have to run and check.

Hi Raviraj,

Thank you very much!

As soon as I check it, I’ll tell you.

Thanks in advance and greetings.

Hi Raviraj,

Thank you very much for the app.

I have already has tried the app and it seems that works.

I’m doing some tests with it.

As soon as I can check it completely with our app, I’ll tell you with the results.

Thanks in advance and greetings.

Hi Raviraj,

Thank you very much for your help.

After doing some tests, the app seems that works.

Besides the previous fails, now what was failing was a console.log that crashed the app:

let data = {
        response,
        "app_variables": {}
      };

      console.log("data (main): ", data);

      return renderData(null, { data });

I have fixed it with the next:

console.log("data (main): ", JSON.stringify(data));

This was very difficult to find it out, because there wasn’t anything in the logs. No logs were printed.

That was all.

So by the moment, I think that this issue is solved.

I’ll tell you I have some any problem more.

Thanks for all and have a nice weekend.

1 Like

Thanks, @llopez, for the confirmation that the issue has been resolved.

I will check why the console log could’ve failed. Thanks for reporting and sharing the solution.

Hi Raviraj,

The problem with console.log is that it is not able to print an object directly.

The way to do it, is use jsonStringfy and print only a string and not an object.

But I think that any kind of error should be printed to notify to the user/devoloper.

Thanks in advance and greetings.

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