Freshservice - Fuze Chat Integration

Hello,

I am trying to build an integration that will notify agents of major incident tickets that are created through a notification in our Fuze Chat application. I have the integration working through an app that runs in the ticket background but this will not work in production as it will run and send a notification every time someone loads the ticket. The perfect scenario would be to simply call the webhook url through the Freshservice Workflow Automator that causes the notification to happen when a ticket meeting the major incident criteria is raised, but Freshservice webhooks do not send data in plain text and our third party chat application expects it in that format (will not display a json object).

Do you have any suggestions on how to either get the webhook to function in the workflow automator, or how I can get the app to run only when the ticket is created?

Thank you,

Zach

1 Like

Hi @Zach,

Solution 1:
If you’re looking to trigger the webhook upon ticket create after formatting the data in a particular format, this onTicketCreate product event in the serverless component of the app would be a right fit.

Solution 2:
If you’re looking for the same solution to run via Workflow Automator in Freshservice, it is possible to write a function in the app serverless component and make it a Custom Action that will get triggered in a workflow from the Workflow Automator.

However, it has two constraints:

  1. Custom Actions in Workflow Automator is still in beta. So, it can only be activated to the customers upon requesting access for it through Freshservice support (support@freshservice.com). Only the customers for whom it is activated will get the app working.
  2. The app get tied with a dependency on Workflow Automator configuration. So, if it’s a public app, every customer installs the app has to configure it.

Refer to this guide to build a custom action and use it in Workflow Automator.

We recommend using the 1st solution if it satisfies your requirement as it does not have a dependency on the workflow Automator.

1 Like

Hello @Raviraj,

Thank you for your quick response. I appreciate that there are a number of options available that will help solve this issue for us. I will be sure to request beta access for Custom Actions in Workflow Automator, as there are number of things that this solution would fix for us. But also I will do my research and learn to build some serverless apps and see if this would further our customization capabilities. Appreciate your help.

-Zach

1 Like

Hello,

In regards to building the serverless app option, is there a way to gather the payload information that happens at ticket creation and ticket update from our sandbox environment as well as our production environment? When I built this app I was able to test the response but only with tailored payload information. I need to see how that information is sent from our production environment to identify how the custom field is presented so I can code for that specific field.

Thank you for your help.

-Zach

@Zach You can upload it as a custom app to test the product events payload in the real-time. The custom fields will also be a part of the payload.

A few custom fields can be added to your test account if your account does not have any custom fields.

Hi @Raviraj,

Could you provide a code snippet that I could use that would produce the payload information? I thought maybe this would work, but it doesn’t show any data in the console when I click save when creating a new ticket.

exports = {

  events: [

    { event: 'onTicketCreate', callback: 'onTicketCreateHandler' }

  ],

  // args is a JSON block containing the payload information.

  // args['iparam'] will contain the installation parameter values.

  onTicketCreateHandler: function (args) {

    console.log(args);

  }

};

@Zach The event, onTicketCreateHandler will get called when a ticket is created. As shown in the sample payload here, the args will have the payload information from the ticket created.

Since this is a serverless app, the logs will be generated in the backend and it will not be printed in the frontend browser console. These logs can be viewed from the app’s settings page in the “admin” configurations.

Please verify if you’re checking the logs in the right place or in the browser console where only frontend app component logs will be displayed.

In the production environment, sample payloads cannot be used. The payloads returned will be from the real-time entity that has been created/modified.

@Raviraj I was looking for the payload information in the console (frontend). Makes sense now that they would not be there, however, I am not familiar with where the “app’s settings page in the “admin” configurations” is located. How would I access these configurations?

Thank you for all your help.

-Zach

1 Like

@Zach You can view the serverless logs by the following steps,

  1. Go to Admin -> Apps -> Custom Apps
  2. Click on the gear icon to go to the settings page of the app that you want to fetch logs for. (This icon will be available only if the app has installation parameters)
  3. In the modal appears, click on the “Serverless logs” tab. It will load the app logs automatically. You can reload it again to get new logs.

Note: The events may get up to a minute to get triggered since the relevant action happened in the product.

1 Like

@Raviraj Thank you, I was able to see the payload information, however the custom fields object just shows as

custom_fields: [Array]

It doesn’t list the custom fields. How would I get that information to appear in the serverless logs? I need to identify one specific custom field so that I can run an IF Statement against it. Perhaps I could identify the index of that custom field but if we ever add any additional custom fields to a ticket I would be afraid it would break my app.

Look forward to hearing your suggestions.

-Zach

@Zach Just the custom_fields can be printed so that it is not wrapped into an object. Also, try to JSON.stringify() the custom_field’s value to see it completely.

You can perhaps post the specific query as a separate topic to attract more eyes in the community to get it resolved. :wink:

1 Like