How to make an extension to save all messages in a conversation of Circuit Unify?

536 views Asked by At

I am using Circuit Unify to work. However, I would like to save or export messages in a conversation into a file to save for better documentation. Currently it seems impossible on Web App as well as Desktop App. Thus, I want to make an extension (or app?) to do the work.

My question is: Where is the best place I should start with? How can I make an extension to Circuit? Is it possible to make such extension (or app)?

Your comments and suggestions will be greatly appreciated

1

There are 1 answers

0
Roger Urscheler On BEST ANSWER

Your best option is to use the Circuit JavaScript API to retrieve the messages using the API getConversationItems for example. Each item (aka message) contains the url(s) to download its attachments.

Now there are a few different ways this could be done.

Option 1: Using a bot

Create a bot (client credentials grant) that can be added to a conversation by a member of this conversation using the regular "Add participant" button on the Circuit client. This bot then has access to all messages of this conversation and can listen for new messages being posted. The bot can listen for a specific message (command) being sent, such as /export. When this command is sent, the bot retrieves all the data of this conversation to be exported, creates a pdf (or what ever format is required) and attaches this to the conversation. Alternatively the bot could also save that pdf in some other location, but that may pose a security issue.

Option 2: Using a separate web app

Create a web app on which users login using their Circuit credentials via OAuth (implicit or authorization code grant type). The app then acts on behalf of the logged on user. The app can list the conversations the user has access to (getConversations API) and show a button to export the selected conversation. The app then does the same as the bot in option 1 to create the pdf, but instead of posting the pdf to the conversation, the web app will download the pdf.

Option 3: Create a chrome extension

I do not encourage this option as there is no official way yet to extend the Circuit webclient. This means a new Circuit webclient version may break the extension. Using the chrome extension it would be possible to add an "Export" button in the UI and using some internal APIs get the data to be exported. There is a plan to create official extension points to allow the developer to extend some part of the Circuit webclient and also use the JS SDK in a Chrome extension.

Note: You could also use the Circuit REST API instead of the JS SDK to retrieve the messages.