Git Product home page Git Product logo

zen-bot's Introduction

ZenBot

A discord.js (v14.*+) bot to seamlessly integrate zendesk in your server

Flow

Commands

/zen

  • Fetches latest 50 tickets having new/open status.
  • every ticket has its own channel within a new category zendesk ( customizable ).

/reset-zen

  • deletes all active ticket channles within zendesk category. archived tickets are not deleted.

Features

Channel

  • A channel having format {zen-prefix}-{..params}-{id} within zendesk category is considered a ticket channel.
  • By default zen-prefix is ticket so the default channel name is ticket-{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.

Close Ticket

  • 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} where zen-close-prefix is customizable.

Archive

  • 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.

Transcript

  • Gives a downloadable html transcript of entire channel chat.

Setup

Discord.js

  • Create a new bot from developer portal.
  • copy the TOKEN and CLIENT_ID in .env.
  • enable all gateway intents in Bot settings.
  • Create an invite link using the Oauth2 URL generator
    • select application.commands and bot as scopes and set desired bot permissions. ( admin for full access )
  • Once bot is in your server set GUILD_ID as this server's id in .env.

Zendesk Portal

  • Update your .env
    • ZENDESK_EMAIL : your zendesk email
    • ZENDESK_PASSWORD : your zendesk password
    • API_BASE_URL : you zendesk portal origin appended with /api ie https://org.zendesk.com/api/v2
    • AGENT_EMAIL_SUFFIX : if your zendesk email is [email protected] then the suffix is org.

Project

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.

Zendesk Webhooks

  • 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

Ticket commented

  • Name : Ticket commented
  • Meet ANY of the following conditions :
    • Comment is Public
  • Actions Screenshot

Ticket created

  • Name : Ticket created
  • Meet ALL of the following conditions :
    • Ticket is Created
  • Actions Screenshot

Enjoy !!

Once the webhooks are set , you can run /zen in your server and start using the bot.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GNU General Public License v3.0

zen-bot's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.