You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-19Lines changed: 41 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,31 @@
4
4
5
5
This script was designed based on a need I had to provide a simple Slack support interface for end users of an application, but also as a challenge to myself to build a full JavaScript plugin without using JQuery (which I have become extremely comfortable using for everything).
6
6
7
+
----------
8
+
9
+
## How it works ##
10
+
11
+
When a user pulls up this support window, it will establish a websocket connection to the Slack API, pulling messages back in real time.
12
+
13
+
As more than one user could be in the support channel at a time, messages to users of this interface are filtered, requiring you to specify a unique id at the beginning of your message in Slack.
14
+
15
+
Not only will this allow you and your team to chat between each other about the question without it spamming the user, but it will also ensure that messages directed to that user don't show up in other user windows.
16
+
17
+
The first message from a user sent from this interface will include a message attachment that instructs how to reply to this user by using their unique id. The unique id will also show next to the user's name in each message they send.
18
+
19
+
----------
20
+
21
+
## What it looks like ##
22
+
This is the display for the default "float" configuration. If docking to the left/right side of the screen, you will instead get a narrow interface that extends from the top to the bottom of your page.
23
+
24
+
### The welcome screen (if you don't pass a name in the config) ###
@@ -14,7 +39,7 @@ This script was designed based on a need I had to provide a simple Slack support
14
39
15
40
----------
16
41
17
-
## How to setup ##
42
+
## How to install ##
18
43
Download a copy of the [latest release from the releases page](https://github.com/bradmb/sl.js/releases) and reference them in your code.
19
44
20
45
If you're using Visual Studio, simply grab the file off NuGet to ensure you have access to the latest package at all times:
@@ -23,19 +48,30 @@ If you're using Visual Studio, simply grab the file off NuGet to ensure you have
23
48
PM> Install-Package sl.js -Pre
24
49
```
25
50
26
-
Today, running the script will fully display the interface, but a button binding will be coming soon (see: to do list). Until then, you will need to setup your own binding on a button to initialize the code.
51
+
## How to setup##
27
52
28
-
To bring up the interface, simply call this:
53
+
Your basic configuration items are simple: Your Slack token, the Slack Channel ID, and the DIV where this will use as the spot where all the elements are rendered:
29
54
```javascript
30
55
var slConfig = {
31
56
token:'SLACK-TOKEN',
32
57
channel:'SLACK-CHANNEL',
33
58
element:'PAGE-DIV-ID'
34
59
};
60
+
```
61
+
62
+
63
+
To bind this interface to a button that will display on click, use this:
64
+
```javascript
65
+
var sl =newSLjs.Button('BUTTON-ID', slConfig);
66
+
```
35
67
36
-
var sl =newSLjs.Application(slConfig);
68
+
To bring up the interface immediately (no binding to a button), simply call this:
69
+
```javascript
70
+
var sl =newSLjs.Interface(slConfig);
37
71
```
38
72
73
+
## Extra configuration options ##
74
+
39
75
The configuration options listed above are the *minimum* options required. You are free to fill in additional parameters, including:
40
76
41
77
Parameter | Type | Description | Options
@@ -67,22 +103,8 @@ workDates: {
67
103
68
104
----------
69
105
70
-
## How it works ##
71
-
72
-
When a user pulls up this support window, it will establish a websocket connection to the Slack API, pulling messages back in real time.
73
-
74
-
As more than one user could be in the support channel at a time, messages to users of this interface are filtered, requiring you to specify a unique id at the beginning of your message in Slack.
75
-
76
-
Not only will this allow you and your team to chat between each other about the question without it spamming the user, but it will also ensure that messages directed to that user don't show up in other user windows.
77
-
78
-
The first message from a user sent from this interface will include a message attachment that instructs how to reply to this user by using their unique id. The unique id will also show next to the user's name in each message they send.
79
-
80
-
----------
81
-
82
106
## To do ##
83
-
- Add non-websocket backup feature
84
-
- Add server-side features (id generation, traffic routing)
85
107
-~~Add additional display methods (docking to left/right of page)~~
0 commit comments