wechaty-freshdesk

Wechaty Freshdesk Plugin helps Freshdesk unifies conversations from WeChat, and helps you resolve issues across channels effortlessly!

Usage no npm install needed!

<script type="module">
  import wechatyFreshdesk from 'https://cdn.skypack.dev/wechaty-freshdesk';
</script>

README

wechaty-freshdesk

NPM Version NPM

Freshdesk is a cloud-based helpdesk system that offers powerful solutions for customer service.

Wechaty Freshdesk Plugin helps Freshdesk unifies conversations from WeChat, and helps you resolve issues across channels effortlessly!

Wechaty Plugin Freshdesk

Wechaty Plugin Freshdesk Powered by Wechaty TypeScript

Introduction

Wechaty Freshdesk Plugin helps you to manage your customers/leads/users in the WeChat Room, with the power of the Freshdesk service.

Requirements

  1. Wechaty v0.40+
  2. Freshdesk Garden Plan+ (for Assuming identities support)
  3. Freshdesk config
    1. Create two custom ticket fields
    2. Create Webhook

Usage

import { WechatyFreshdesk } from 'wechaty-freshdesk'

const config = {
  contact: true,              // enable direct message.
  room: 'room_id@chatroom',   // enable a specific room. `true` for enable all room

  mention         : true,
  webhookProxyUrl : 'https://smee.io/your_smee_io_proxy_url',
  apiKey          : 'your_freshdesk_api_key',
  portalUrl       : 'https://your_portal_name.freshdesk.com',
}

const FreshdeskPlugin = WechatyFreshdesk(config)

const wechaty = new Wechaty()
wechaty.use(FreshdeskPlugin)
  1. config.contact: Whether to allow direct message to be sync with ticket reply. false to deny all, true for allow all; Supports contact id(string) and contact name(RegExp). You can also mix them in array.
  2. config.room: The room id of your service WeChat room.
  3. config.mention: If set to true, customers need to use @ to mention the bot when they want to ask questions.
  4. config.webhookProxyUrl: A smee.io link that you need to set it to receive the Freshdesk Webhook events.
    1. smee.io - Webhook payload delivery service - Receives payloads then sends them to your locally running application.
  5. config.apiKey: The API Key for your Freshdesk account.
    1. Freshdesk API - How to find your API key

Configure Freshdesk Webhooks

In order to receive the reply and close events from Freshdesk, we need to configure the Freshdesk platform:

  1. Add two custom ticket fields
  2. Add a automation rule for Webhook

Note: Freshdesk Garden Plan (or above) is required, because we need Assuming identities feature.

1 Add Two Custom Ticket Field

  1. Login to your Freshdesk agent account, from the menu on the left, select Admin, then select Ticket Fields under the General Settings.
  2. Create two Single-line text fields:
    1. Wechaty Room
    2. Wechaty Contact

Freshdesk Ticket Fields

Doc: Creating custom fields in your ticket form

2 Go to Automation Setting Page

  1. Login to your Freshdesk agent account, from the menu on the left, select Admin, then select Automations.
  2. Below the Rules that run on, there will be three selections: Ticket Creation, Time Triggers, and Ticket Updates.

3 Create a Ticket Updates Rule

Freshdesk Automation Rule

  1. Select Ticket Updates, click the New rule button.
  2. Configure the rule as the following summary:
    1. When Ticket is updated
    2. When an action performed by Agent
    3. When public Note is Added
      OR
      When Reply is Sent
    4. Trigger Webhook Method - POST Url: https://smee.io/your_smee_io_proxy_url

And make sure you have configured the Webhook Content as the following:

Freshdesk Automation Rule

  1. Ticket ID {{ticket.id}}
  2. Last Public Comment {{ticket.latest_public_comment}}
  3. Wechaty Room {{ticket.cf_wechaty_room}}
  4. Wechaty Contact {{ticket.cf_wechaty_contact}}

Then click Preview and save.

Note: the POST Url must be as same as the webhookProxyUrl setting in the config.

See:

  1. Using Webhooks in automation rules that run on ticket updates
  2. Setting up automation rules to run on 'Ticket Updates'
  3. Assuming identities (Garden+)

Environment Variables

The following two environment variables will be used if the required information is not provided by the config.

1 WECHATY_PLUGIN_FRESHDESK_PORTAL_URL

process.env.WECHATY_PLUGIN_FRESHDESK_PORTAL_URL will be used if the config.portalUrl is not provided.

2 WECHATY_PLUGIN_FRESHDESK_API_KEY

process.env.WECHATY_PLUGIN_FRESHDESK_API_KEY will be used if the config.apiKey is not provided.

Learn more about the authorization token of freshdesk: Freshdesk API - How to find your API key

3 WECHATY_PLUGIN_FRESHDESK_WEBHOOK_PROXY_URL

We receive webhook payloads with the help from <smee.io>, by proxy them to our locally running Wechaty Plugin application.

process.env.WECHATY_PLUGIN_FRESHDESK_WEBHOOK_PROXY_URL will be used if the config.webhookProxyUrl is not provided.

See:

  1. smee.io - Webhook payload delivery service - Receives payloads then sends them to your locally running application.

Screenshot

Wechaty Freshdesk Conversation

Example

Our Friday BOT are using wechaty-freshdesk to connect our WeChat customers to Freshdesk.

You can read the source code from: https://github.com/wechaty/friday/blob/master/src/plugins/freshdesk.ts

See Also

  1. WhatsApp Integration in Freshdesk
  2. Freshdesk Integration in Freshdesk

History

master 1.0 (Oct 23, 2021)

Release 1.0 of Wechaty Freshdesk Plugin.

v0.6 Renamed from wechaty-plugin-freshdesk to wechaty-freshdesk

After the Freshdesk trail was end, we found that the following features are belonging to different plans:

  1. Identifying contacts with an external ID requires Estate Plan

  2. Assuming identities requires Garden Plan

  3. Supported both direct message and room messages to be managed by freshdesk via tickets

  4. use twitter_id as a workaround of unique_external_id

  5. Change custom ticket fields on Freshdesk to store roomId and contactId from Wechaty

  6. Change webhook setting on Freshdesk

v0.4 (July 21, 2020)

  1. Rename at to mention in config
  2. Support managing tickets from different WeChat rooms

v0.2 (June 26, 2020)

  1. Init code base
  2. Room message to Freshdesk
  3. Freshdesk message to Room (Powered by Smee.io)

Contributors

contributor contributor contributor contributor contributor contributor contributor contributor

Author

Huan LI (李卓桓), Tencent TVP of Chatbot, <zixia@zixia.net>

Profile of Huan LI (李卓桓) on StackOverflow

Copyright & License

  • Code & Docs © 2020 Huan LI <zixia@zixia.net>
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons