Awesome
wechaty-freshdesk
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!
Introduction
Wechaty Freshdesk Plugin helps you to manage your customers/leads/users in the WeChat Room, with the power of the Freshdesk service.
Requirements
- Wechaty v0.40+
- Freshdesk Garden Plan+ (for Assuming identities support)
- Freshdesk config
- Create two custom ticket fields
- 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)
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.config.room
: The room id of your service WeChat room.config.mention
: If set totrue
, customers need to use@
to mention the bot when they want to ask questions.config.webhookProxyUrl
: Asmee.io
link that you need to set it to receive the Freshdesk Webhook events.- smee.io - Webhook payload delivery service - Receives payloads then sends them to your locally running application.
config.apiKey
: The API Key for your Freshdesk account.
Configure Freshdesk Webhooks
In order to receive the reply and close events from Freshdesk, we need to configure the Freshdesk platform:
- Add two custom ticket fields
- 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
- Login to your Freshdesk agent account, from the menu on the left, select
Admin
, then selectTicket Fields
under theGeneral Settings
. - Create two
Single-line text
fields:Wechaty Room
Wechaty Contact
Doc: Creating custom fields in your ticket form
2 Go to Automation Setting Page
- Login to your Freshdesk agent account, from the menu on the left, select
Admin
, then selectAutomations
. - Below the
Rules that run on
, there will be three selections:Ticket Creation
,Time Triggers
, andTicket Updates
.
3 Create a Ticket Updates
Rule
- Select
Ticket Updates
, click theNew rule
button. - Configure the rule as the following summary:
- When
Ticket is updated
- When
an action performed by Agent
- When
public Note is Added
OR
When Reply is Sent
Trigger Webhook Method
- POST Url: https://smee.io/your_smee_io_proxy_url
- When
And make sure you have configured the Webhook Content as the following:
Ticket ID {{ticket.id}}
Last Public Comment {{ticket.latest_public_comment}}
Wechaty Room {{ticket.cf_wechaty_room}}
Wechaty Contact {{ticket.cf_wechaty_contact}}
Then click Preview and save
.
Note: the
POST Url
must be as same as thewebhookProxyUrl
setting in theconfig
.
See:
- Using Webhooks in automation rules that run on ticket updates
- Setting up automation rules to run on 'Ticket Updates'
- 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:
- smee.io - Webhook payload delivery service - Receives payloads then sends them to your locally running application.
Screenshot
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
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:
-
Identifying contacts with an external ID requires Estate Plan
-
Assuming identities requires Garden Plan
-
Supported both direct message and room messages to be managed by freshdesk via tickets
-
use
twitter_id
as a workaround ofunique_external_id
-
Change custom ticket fields on Freshdesk to store
roomId
andcontactId
from Wechaty -
Change webhook setting on Freshdesk
v0.4 (July 21, 2020)
- Rename
at
tomention
in config - Support managing tickets from different WeChat rooms
v0.2 (June 26, 2020)
- Init code base
- Room message to Freshdesk
- Freshdesk message to Room (Powered by Smee.io)
Contributors
Author
Huan LI (李卓桓), Tencent TVP of Chatbot, <zixia@zixia.net>
Copyright & License
- Code & Docs © 2020 Huan LI <zixia@zixia.net>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons