GithubHelp home page GithubHelp logo

bartbilliet / botframework-freshdeskchannel Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 74 KB

Custom channel for Bot Framework, connecting to FreshDesk ticket dialog

License: MIT License

C# 100.00%
bot-framework freshdesk freshdesk-api bot

botframework-freshdeskchannel's Introduction

Custom FreshDesk channel for the Bot Framework

Quick draft. Code can definitely still be optimized.

Goal

Solution

  • The FreshDesk custom channel for Bot Framework is implemented as an Azure function. When called, it checks for any new tickets or new ticket responses, and passes the ticket subject & description along to the Microsoft Bot Framework.
  • The custom FreshDesk channel can be invoked in two ways:
    • Via a Timer-based trigger, which will poll the FreshDesk API every x time to fetch new tickets/responses. This method works for most FreshDesk plans that supports API calls.
    • Via a HTTP trigger, which can be configured in specific FreshDesk plans as a webhook that is called when a ticket is updated.
  • The FreshDesk channel will use 2 containers on the same CosmosDB instance than the one used by Bot Framework:
    • Freshdesk-botstate-container: Link FreshDesk tickets to conversations happening in the Bot Framework
    • LastRun: Keep track of last execution (only processes differentials to save API limits)

How to set things up

  • Install your Bot logic (using BotFramework) on Azure. This should give you following components in Azure: App Service, CosmosDB, StorageAccount, Cognitive services (LUIS).
  • Add the Direct Line channel to your Bot in Azure. Copy the secret to DirectLineSecret and the name of the bot to BotId in the settings.json.
  • Add the CosmosDB CosmosDBEndpointUri, CosmosDBPrimaryKey, CosmosDBDatabaseId, CosmosDBContainerId connection information to the settings.json.
  • Add the FreshDesk FreshDeskClientUrl and FreshDeskAPIKey to the Settings.json.
  • Configure the number of days the channel will listen for proactive messages from the Bot (without new incoming messages on the ticket in FreshDesk) via MaxDaysToWaitForBotResponses in the settings.json. To always poll ALL conversations for possible proactive messages from the bot, set this value to 0. This will result in slower run cycles when the bot has processed many conversations.
  • Only newly updated tickets after the initial run will be processed, existing tickets will not be handled by the FreshDesk channel for Bot Framework.

Current features

  • Send bot responses back to customer as a ticket reply. This is the default bot response.

  • Add a private note for human engineer, instead of immediate responses to customer (via bot ChannelData). To send a private note, and optionally notify an engineer, send following in the ChannelData with the bot message. The email addresses used must be valid agents registered in FreshDesk, otherwise the message will fail.

      {
        "MessageType": "note",
        "Private": true,
        "NotifyEmails": ["[email protected]", "[email protected]"]
      }
  • Update the ticket status after bot reply. By default the bot will set the status to 'pending' after each reply. To set a different status after the bot response, use following JSON as ChannelData in your bot response. The values to be used correspond to the official FreshDesk API. Updating the ticket state is currently only possible on a 'reply' MessageType.

      {
        "Message": "YourMessage",
        "MessageType": "reply",
        "Status": 4
      }
  • The channel can continue listening for proactive bot messages for a configurable number of days after the last message on the FreshDesk ticket was received.

  • Extensibility for pre-processing of messages before they are sent to the Bot Framework, and post-processing on the bot responses. This allows for extensibility by sending messages through a Logic App connector, Azure Function, or other API integrations and can be used in scenarios such as for example translating bot messages. The extensibility is offered by setting the keys PreProcessingExtensibility and PostProcessingExtensibility in the settings.json to the URL of your API which should accept the POST method.

    The pre-processing extensibility API will receive following object as POST data:

    {
        "TicketId": int,
        "Subject": string,
        "Message": string,
        "Group_id": int,
        "Responder_id": int,
        "Source": int,
        "Company_id": int,
        "Status": int,
        "Product_id": int,
        "Due_by": string,
        "MessageType": string,
        "Private": boolean,
        "RequesterName": string,
        "FromEmail": string,
        "Mobile": string,
        "Phone": string
    }

    The post-processing extensibility API will receive the following object as POST data:

    {
      "MessageType": string,
      "Message": string,
      "Private": boolean,
      "NotifyEmails": array of strings,
      "Status": int
    }

Upcoming features

  • Send custom activities to the bot when the ticket assignment or ticket status is updated.

botframework-freshdeskchannel's People

Contributors

bartbilliet avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

curlybytes

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.