Skip to main content

 

 
8x8 Support

Fuze Chat Integrations

Objective

Create a custom webhook to integrate Fuze with other apps.

Applies To

  • Fuze Desktop
  • Fuze Web
  • Chat
  • Webhooks

Procedure

Fuze Chat webhooks allow you to integrate Fuze with other apps to receive automated messages directly in your Fuze chat conversations. You can use webhooks to receive notifications of software build events from Jenkins, receive data alerts from Splunk, get notified of upcoming project-related events in Asana, extend the reach of your customer support desk by connecting to Zendesk, and much more.

Fuze webhooks require a small amount of coding to set up, and out-of-the-box integrations with external systems will soon be available using third-party tools like Zapier.

Step 1: Add the integration in Fuze

You can generate a URL that can be integrated with a third party allowing it to publish a message to your conversation.

  1. Open the Profile (one-on-one conversation), or Group Details pane.
    Fuze Chat Integrations01.png
  2. At the bottom of the Profile or Group Details pane, click Add.
    Fuze Chat Integrations02.png
  3. In the pop-up that appears click Custom integration (Webhooks).
    Fuze Chat Integrations03.png
  4. In the Add Custom Integration webhook pop-up that appears enter a name for the integration, and click Create.
    Fuze Chat Integrations04.png
  5. In the webhook confirmation pop-up that appears click Copy, and then click Done. Your custom webhook URL is created and you are ready to proceed with creating your custom integration.
    Fuze Chat Integrations05.png

Step 2: Complete your custom integration

Once you have enabled the integration in Fuze and have retrieved the necessary URL, you can proceed with building the remainder of the integration using the URL.

Example URL: https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26

Your integration can be used to send as many messages as you want, without a limit of time. Integrations do not expire, and are enabled until one of the participants of the chat conversation disables and/or deletes the integration. 

The examples in the following sections use cURL, JavaScript, and TypeScript, and also describe how to apply formatting to your messages. 

Integration with your shell script

The simplest way to use your integration is with a simple cURL command.

The example below shows a command that writes the message “My message from shell” in plain text into the conversation. 

curl -H 'Content-Type: text/plain' \
     -d 'My message from shell' \
     https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26

The example below shows a command that writes the message “My message from shell” in json into the conversation. When using json, a custom integration requires a "message" attribute.

curl -H 'Content-Type: application/json' \
     -d '{message:"My message from shell"}' \
     https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26
Parsing the response

Using the jq command tool, you can easily parse the reply. 

For example, the following response: 

curl -H 'Content-Type: text/plain' \
     -d 'My message from shell' \
     https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26 \
     -s  \
  | jq '"Message: " + .data.content + " (id: " + .data.id + ") at " + .data.postedAt'

Would have the following output: 

"Message: Hello (id: -LsPMkMRDI3ZrR3Bk7bi) at 2018-06-23T05:54:25.372Z"

Integration with your JavaScript application

Fuze can also integrate with applications that use JavaScript.

The following example uses plain JavaScript (VanillaJS) to display the message “My message from javascript” in the conversation. 

<script>
function sendMessage() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      console.log(“Message sent”);
    }
  };
  xhttp.open("POST", "https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26"", true);
  xhttp.setRequestHeader("Content-type", "text/plain");
  xhttp.send("My message from javascript");
}
Using the “request” library in TypeScript

Additionally, you can use the “request” library in TypeScript to add the message “My message from typescript” into the conversation.

import * as request from “request”;
 
request.post(
  "https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26"",
  { headers: { "Content-Type": "text/plain" }, body: "My message from typescript" },
  (err, response, body) => {
    if (!err) {
      console.log(`Message ${body.data.id} sent`);
    }
  }
);

Sending a formatted message

Finally, Fuze supports formatting in messages that is very similar to Markdown.

Here is an example of a formatted message sent with Curl: 

curl -H 'Content-Type: text/plain' \
     -d '*Important* and _happy_ message :)
>We are releasing our chat integration API
>It can easily be used with `curl` commands
(visit <!https://fuze.com|Fuze Website> for more information)' \
     https://api.fuze.com/chat/v2/webhooks/incoming/27fJFLKbZcaRHuLiDvvQ26

The above example would display as follows:
Fuze Chat Integrations06.png

Text formatting

Use the characters described in the following table to format text in messages.

Character Usage Example Formatted Text Output
*This is bold text.*
This is bold text.
_This is italicized text._
This is italicized text.
~This is strikethrough text.~
This is strikethrough text.
>This is a single-line quote.
 
>This is the first line of a block quote.
>This is the second line of a block quote.
Fuze Chat Integrations07.png
```This is an example of preformatted text.
Preformatted text blocks preserve any spacing or line breaks exactly as entered.```
Fuze Chat Integrations08.png
`Code format allows you to send a block of code in plain text with an alternate font color and gray background.Similar to preformatted text, this format also preserves any spacing or line breaks exactly as entered.`
Fuze Chat Integrations09.png

Connect Your Apps and Automate Workflows with Zapier

Zapier moves info between your web apps automatically, so you can focus on your most important work. It allows you to automate notifications from any service, including Salesforce, Google Suite, Office 365 or 1500+ apps.

Ever wished you could get a notification in your team group when a new document is added to your drive, or when an opportunity meets certain criteria in Salesforce?

To get started with Fuze + Zapier, follow these steps:

  1. Get a Zapier account.
  2. Add Fuze through this link: https://zapier.com/developer/public-invite/69226/8df132dc815721b66abc89336feda782/
  3. Click Make a Zap!.
    Fuze Chat Integrations10.png
  4. Pick the service where your events come from and add filters (e.g. only cases containing “enhancement” or new files added to a specific folder in your drive).
    Fuze Chat Integrations11.png
  5. Complete your workflow with the Fuze send chat webhook action. Enter the Webhook URL copied from your Fuze group and format your message with integration variables, links and blocks.
    Fuze Chat Integrations12.png
Example formatting
Formatted Message
*{{AccountId}}* • New platform enhancement request: 

> *Title*: *<!https://fuze.my.salesforce.com/{{Id}}|{{Subject}}>*
> *Priority*: {{Priority}}
> *Account Type*: {{Account_Type}}
> *Internal Contacts*: `{{Account_Manager}}` _(Account Manager)_, `{{Account_PM}}` _(Project Manager)_
Fuze Preview
Fuze Chat Integrations13.png

Connect Your Apps and Automate Workflows with Zendesk

Zendesk doesn’t have a built-in Fuze target. In this example, we will show how to use an HTTP Target to send new cases directly into Fuze by integrating directly into a group using Fuze's chat integrations.

Setting up the HTTP Target

Start by creating a chat integration in Fuze. Click Add from the desired group and select Zendesk.

Fuze Chat Integrations14.png

To create your target in Zendesk support:

  1. As a Zendesk administrator, navigate to Settings > Extensions > Add target.
  2. Click HTTP Target.
  3. Configure your webhook to use this URL. Since Fuze does not require basic authentication, leave the username and password fields empty.
    Fuze Chat Integrations15.png
  4. Save the target.

You’re now ready to configure a trigger notification using this target.

Configuring the HTTP target as a trigger action

To set up your HTTP target as a trigger in Zendesk support:

  1. As a Zendesk administrator, navigate to Settings > Business Rules > Triggers.
    In this example, we’ll configure a trigger to send information about a new case into Fuze whenever a ticket matches your conditions.
  2. Configure your trigger conditions to notify your new Fuze target whenever a ticket is solved and satisfaction is rated with a comment.
    Fuze Chat Integrations16.png

The trigger action should contain JSON formatted content according to Fuze’s documentation:

{ "message": "*Request updated:*\n>*Title:* {{ticket.title}}\n>*Assignee:* {{ticket.assignee.name}}\n>*Link:* https://{{ticket.url}}" }
  1. Save your trigger.

Additional Information

Looking for information on creating a chat group? Refer to Creating a Group.

  • Was this article helpful?