Skip to content

Commit

Permalink
First changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Urscheler committed Dec 7, 2017
1 parent ef3a6b9 commit 717502a
Show file tree
Hide file tree
Showing 1,049 changed files with 301,294 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/server.js",
"protocol": "inspector"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"address": "localhost",
"port": 5858
}
]
}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# customer-support2
# customer-support

## Future enhancements
* Add topic dropdown in form with predefined topics in config
* Allow customer to upload files/images and post them to conversation
* Set conversation avatar (missing in SDK)
* Set a 'complaints' label on conversation

## Run
```bash
npm start
```
80 changes: 80 additions & 0 deletions circuit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Copyright (c) 2017 Unify Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/* jslint node: true */
'use strict';

const Circuit = require('circuit-sdk');
const config = require('./config.json');

let client;
let emitter;

//Circuit.setLogger(console);
//Circuit.logger.setLevel(Circuit.Enums.LogLevel.Debug);

/**
* Initialize
* @param {Object} events Event emitter
*/
function init (events) {
return Promise.resolve();

emitter = events;
client = new Circuit.Client(config.bot);
return client.logon()
.then(setupListeners);
}

/**
* Create a conversation
* @param {Object}
*/
function createConversation() {
return Promise.resolve({convId: '3452354235'})
}

function getUsersByEmail(emails) {
return Promise.resolve(['213421342134']);
return client.getUsersByEmail(emails)
}

function sendMessage(obj) {
return Promise.resolve({});
return client.addTextItem(obj)
}

/**
* Setup the listeners
*/
function setupListeners() {
client.addEventListener('itemAdded', evt => {
console.log(evt);
});
}

module.exports = {
init,
createConversation,
sendMessage,
getUsersByEmail
}
11 changes: 11 additions & 0 deletions complaints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"convId": "0b978e53-cf46-43d6-b2a1-3789d057e49e",
"complaintId": 100,
"customer": {
"name": "Peter",
"email": "[email protected]",
"topic": "Fridge"
}
}
]
18 changes: 18 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"bot": {
"domain": "circuitsandbox.net",
"client_id": "851763b2fe7a4aaaa33a2de397d92170",
"client_secret": "97cedbbf3954434d99ef0acf54bf6df9"
},
"supportUsers": [
"[email protected]",
"[email protected]"
],
"topics": [
"Washer",
"Dryer",
"Fridge",
"Dishwasher"
],
"complaintIdStart": 100
}
7 changes: 7 additions & 0 deletions config.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bot": {
"domain": "circuitsandbox.net",
"client_id": "<client_id>",
"client_secret": "<client_secret>"
}
}
1 change: 1 addition & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

218 changes: 218 additions & 0 deletions node_modules/accepts/HISTORY.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 717502a

Please sign in to comment.