A discord.js (v14.*+) bot to seamlessly integrate zendesk in your server
- Fetches latest 50 tickets having new/open status.
- every ticket has its own channel within a new category
zendesk
( customizable ).
- deletes all active ticket channles within
zendesk
category. archived tickets are not deleted.
- A channel having format
{zen-prefix}-{..params}-{id}
withinzendesk
category is considered a ticket channel. - By default
zen-prefix
isticket
so the default channel name isticket-{id}
but its fully customisable. - A ticket channel fetches all history for that ticket id from zendesk in the form of embeds.
- Conversation inside the channel is happening in real time with the requester and updates the zendesk comments as well.
- Once done , you can close a ticket from the
Close
button. - This will set
close
status to zendesk ticket as well. - The channel name will be updated to
{zen-close-prefix}-{...params}-{id}
wherezen-close-prefix
is customizable.
- Archived channels will be put in different category.
- They will not be deleted in
/reset-zen
. - Reopeaning a ticket will send it back to main channel and zendesk status will be set to
open
.
- Gives a downloadable html transcript of entire channel chat.
- Create a new bot from developer portal.
- copy the
TOKEN
andCLIENT_ID
in .env. - enable all gateway intents in Bot settings.
- Create an invite link using the Oauth2 URL generator
- select
application.commands
andbot
as scopes and set desired bot permissions. (admin
for full access )
- select
- Once bot is in your server set
GUILD_ID
as this server's id in .env.
- Update your .env
ZENDESK_EMAIL
: your zendesk emailZENDESK_PASSWORD
: your zendesk passwordAPI_BASE_URL
: you zendesk portal origin appended with /api iehttps://org.zendesk.com/api/v2
AGENT_EMAIL_SUFFIX
: if your zendesk email is[email protected]
then the suffix isorg
.
Build - Dev
yarn dev
Build - Prod
yarn start
deploy commands.
node ./deployment/deploy-commands.js
- by default the local PORT is
1234
. - serve that port through ngrok to expose your local server globally.
- copy the ngrok https url.
- Go to
/admin/apps-integrations/webhooks/webhooks/
- Create a new webhook
- Select a way to connect : Trigger or automation
- Add the details
- Name : give any name
- Endpoint URL :
{your-ngrok-url}/webhook
- Request method : POST
- Request format : JSON
- Authentication : NONE ( you can add auth if u want to )
- test the webhook out , it should hit the /webhook route handler.
- connect the webhook.
- Now we have the webhook, lets add triggers to trigger it.
- Go to
/admin/objects-rules/rules/triggers
and click create trigger - Create 2 new triggers
Once the webhooks are set , you can run /zen
in your server and start using the bot.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.