Change external events response

Hello everyone.

I’m using external events in my app and when I make a request to app’s generated URL (for example: hooks.freshworks.com/123) I receive the following response:
{
“success”: true
}

I would like to change it. For example: if I create a new ticket on external events method, I would like to send the ticket object as a response.

Do you guys know if it’s possible to do it?

Thank you!

3 Likes

Hello @omarcelo,

Can you please explain where you want to send data of ticket response?

Hello @yusrakhatri.

I’m working with external events, so I need to create a URL first (using generateTargetUrl function). So after that I make a request to that URL. So my onExternalEvent function will be called. At this moment I would like to return another data. The FDK only returns the following JSON:

{
“success”: true
}

And I would like to return another information on it.

Please let me know if you need more information about it.

Thank you.

1 Like

Hey @yusrakhatri.

I’ve just made a test here and I found a solution.

It’s only necessary to put “renderData” function at the end of onExternalEvent function. Example:

onExternalEventHandler: async function(args) {
renderData(null, {field_one: 1, field_two: 2});
}

And it returns my custom object on response:

{
“requestID”: “1cfb25d0-3761-4e04-a910-67b65b877ee8”,
“response”: {
“field_one”: 1,
“field_two”: 2
}
}

Thank you!

5 Likes