twilio-taskrouter 0.8.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2736,8 +2736,8 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2736
2736
 
2737
2737
 
2738
2738
  <hr>
2739
- <dt class="name" id="HoldOptions">
2740
- <h4 id="HoldOptions">HoldOptions</h4>
2739
+ <dt class="name" id="RedirectOptions">
2740
+ <h4 id="RedirectOptions">RedirectOptions</h4>
2741
2741
 
2742
2742
 
2743
2743
  </dt>
@@ -2775,8 +2775,12 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2775
2775
  <th>Type</th>
2776
2776
 
2777
2777
 
2778
+ <th>Argument</th>
2779
+
2778
2780
 
2779
2781
 
2782
+ <th>Default</th>
2783
+
2780
2784
 
2781
2785
  <th class="last">Description</th>
2782
2786
  </tr>
@@ -2787,13 +2791,13 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2787
2791
 
2788
2792
  <tr>
2789
2793
 
2790
- <td class="name"><code>holdUrl</code></td>
2794
+ <td class="name"><code>accept</code></td>
2791
2795
 
2792
2796
 
2793
2797
  <td class="type">
2794
2798
 
2795
2799
 
2796
- <span class="param-type">string</span>
2800
+ <span class="param-type">boolean</span>
2797
2801
 
2798
2802
 
2799
2803
 
@@ -2801,34 +2805,25 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2801
2805
  </td>
2802
2806
 
2803
2807
 
2804
-
2805
-
2806
-
2807
- <td class="description last"><p>The URL endpoint to play when participant is on hold.</p></td>
2808
- </tr>
2809
-
2810
-
2811
-
2812
- <tr>
2813
-
2814
- <td class="name"><code>holdMethod</code></td>
2815
-
2816
-
2817
- <td class="type">
2818
-
2808
+ <td class="attributes">
2809
+
2810
+ &lt;optional&gt;<br>
2819
2811
 
2820
- <span class="param-type">'GET'</span>
2821
-
2822
-
2823
2812
 
2813
+
2814
+ </td>
2824
2815
 
2825
- </td>
2826
2816
 
2827
2817
 
2828
-
2818
+ <td class="default">
2819
+
2820
+ false
2821
+
2822
+ </td>
2829
2823
 
2830
2824
 
2831
- <td class="description last"><p>The HTTP method for the hold URL.</p></td>
2825
+ <td class="description last"><p>Represents whether the <a href="Task.html">Task</a> should be
2826
+ accepted before initiating the call</p></td>
2832
2827
  </tr>
2833
2828
 
2834
2829
 
@@ -2880,8 +2875,8 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2880
2875
 
2881
2876
 
2882
2877
  <hr>
2883
- <dt class="name" id="RedirectOptions">
2884
- <h4 id="RedirectOptions">RedirectOptions</h4>
2878
+ <dt class="name" id="RejectOptions">
2879
+ <h4 id="RejectOptions">RejectOptions</h4>
2885
2880
 
2886
2881
 
2887
2882
  </dt>
@@ -2919,12 +2914,8 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2919
2914
  <th>Type</th>
2920
2915
 
2921
2916
 
2922
- <th>Argument</th>
2923
-
2924
2917
 
2925
2918
 
2926
- <th>Default</th>
2927
-
2928
2919
 
2929
2920
  <th class="last">Description</th>
2930
2921
  </tr>
@@ -2935,13 +2926,13 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2935
2926
 
2936
2927
  <tr>
2937
2928
 
2938
- <td class="name"><code>accept</code></td>
2929
+ <td class="name"><code>activitySid</code></td>
2939
2930
 
2940
2931
 
2941
2932
  <td class="type">
2942
2933
 
2943
2934
 
2944
- <span class="param-type">boolean</span>
2935
+ <span class="param-type">string</span>
2945
2936
 
2946
2937
 
2947
2938
 
@@ -2949,25 +2940,11 @@ asynchronous webhook this._request. to on a completed call event.</p></td>
2949
2940
  </td>
2950
2941
 
2951
2942
 
2952
- <td class="attributes">
2953
-
2954
- &lt;optional&gt;<br>
2955
-
2956
-
2957
-
2958
- </td>
2959
-
2960
2943
 
2961
2944
 
2962
- <td class="default">
2963
-
2964
- false
2965
-
2966
- </td>
2967
-
2968
2945
 
2969
- <td class="description last"><p>Represents whether the <a href="Task.html">Task</a> should be
2970
- accepted before initiating the call</p></td>
2946
+ <td class="description last"><p>The sid of the <a href="Activity.html">Activity</a> to update the worker to
2947
+ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
2971
2948
  </tr>
2972
2949
 
2973
2950
 
@@ -3019,8 +2996,8 @@ accepted before initiating the call</p></td>
3019
2996
 
3020
2997
 
3021
2998
  <hr>
3022
- <dt class="name" id="RejectOptions">
3023
- <h4 id="RejectOptions">RejectOptions</h4>
2999
+ <dt class="name" id="ReservationParticipantOptions">
3000
+ <h4 id="ReservationParticipantOptions">ReservationParticipantOptions</h4>
3024
3001
 
3025
3002
 
3026
3003
  </dt>
@@ -3070,13 +3047,13 @@ accepted before initiating the call</p></td>
3070
3047
 
3071
3048
  <tr>
3072
3049
 
3073
- <td class="name"><code>activitySid</code></td>
3050
+ <td class="name"><code>endConferenceOnExit</code></td>
3074
3051
 
3075
3052
 
3076
3053
  <td class="type">
3077
3054
 
3078
3055
 
3079
- <span class="param-type">string</span>
3056
+ <span class="param-type">boolean</span>
3080
3057
 
3081
3058
 
3082
3059
 
@@ -3087,8 +3064,55 @@ accepted before initiating the call</p></td>
3087
3064
 
3088
3065
 
3089
3066
 
3090
- <td class="description last"><p>The sid of the <a href="Activity.html">Activity</a> to update the worker to
3091
- upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3067
+ <td class="description last"><p>Whether the Conference should end when this <a href="Worker.html">Worker</a> participant leaves the Conference</p></td>
3068
+ </tr>
3069
+
3070
+
3071
+
3072
+ <tr>
3073
+
3074
+ <td class="name"><code>mute</code></td>
3075
+
3076
+
3077
+ <td class="type">
3078
+
3079
+
3080
+ <span class="param-type">boolean</span>
3081
+
3082
+
3083
+
3084
+
3085
+ </td>
3086
+
3087
+
3088
+
3089
+
3090
+
3091
+ <td class="description last"><p>Mute or unmute this <a href="Worker.html">Worker</a> participant</p></td>
3092
+ </tr>
3093
+
3094
+
3095
+
3096
+ <tr>
3097
+
3098
+ <td class="name"><code>beepOnExit</code></td>
3099
+
3100
+
3101
+ <td class="type">
3102
+
3103
+
3104
+ <span class="param-type">boolean</span>
3105
+
3106
+
3107
+
3108
+
3109
+ </td>
3110
+
3111
+
3112
+
3113
+
3114
+
3115
+ <td class="description last"><p>Whether there should be a beep sound when this <a href="Worker.html">Worker</a> participant leaves the Conference</p></td>
3092
3116
  </tr>
3093
3117
 
3094
3118
 
@@ -3140,8 +3164,8 @@ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3140
3164
 
3141
3165
 
3142
3166
  <hr>
3143
- <dt class="name" id="ReservationParticipantOptions">
3144
- <h4 id="ReservationParticipantOptions">ReservationParticipantOptions</h4>
3167
+ <dt class="name" id="TaskHoldOptions">
3168
+ <h4 id="TaskHoldOptions">TaskHoldOptions</h4>
3145
3169
 
3146
3170
 
3147
3171
  </dt>
@@ -3179,6 +3203,8 @@ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3179
3203
  <th>Type</th>
3180
3204
 
3181
3205
 
3206
+ <th>Argument</th>
3207
+
3182
3208
 
3183
3209
 
3184
3210
 
@@ -3191,13 +3217,13 @@ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3191
3217
 
3192
3218
  <tr>
3193
3219
 
3194
- <td class="name"><code>endConferenceOnExit</code></td>
3220
+ <td class="name"><code>holdUrl</code></td>
3195
3221
 
3196
3222
 
3197
3223
  <td class="type">
3198
3224
 
3199
3225
 
3200
- <span class="param-type">boolean</span>
3226
+ <span class="param-type">string</span>
3201
3227
 
3202
3228
 
3203
3229
 
@@ -3205,47 +3231,31 @@ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3205
3231
  </td>
3206
3232
 
3207
3233
 
3208
-
3209
-
3210
-
3211
- <td class="description last"><p>Whether the Conference should end when this <a href="Worker.html">Worker</a> participant leaves the Conference</p></td>
3212
- </tr>
3213
-
3214
-
3215
-
3216
- <tr>
3217
-
3218
- <td class="name"><code>mute</code></td>
3219
-
3220
-
3221
- <td class="type">
3222
-
3234
+ <td class="attributes">
3235
+
3236
+ &lt;optional&gt;<br>
3223
3237
 
3224
- <span class="param-type">boolean</span>
3225
-
3226
-
3227
-
3228
-
3229
- </td>
3230
3238
 
3239
+
3240
+ </td>
3231
3241
 
3232
3242
 
3233
3243
 
3234
3244
 
3235
- <td class="description last"><p>Mute or unmute this <a href="Worker.html">Worker</a> participant</p></td>
3245
+ <td class="description last"><p>The URL endpoint to play when participant is on hold.</p></td>
3236
3246
  </tr>
3237
3247
 
3238
3248
 
3239
3249
 
3240
3250
  <tr>
3241
3251
 
3242
- <td class="name"><code>beepOnExit</code></td>
3252
+ <td class="name"><code>holdMethod</code></td>
3243
3253
 
3244
3254
 
3245
3255
  <td class="type">
3246
3256
 
3247
3257
 
3248
- <span class="param-type">boolean</span>
3258
+ <span class="param-type">'GET'</span>
3249
3259
 
3250
3260
 
3251
3261
 
@@ -3253,10 +3263,18 @@ upon rejecting the <a href="Reservation.html">Reservation</a></p></td>
3253
3263
  </td>
3254
3264
 
3255
3265
 
3266
+ <td class="attributes">
3267
+
3268
+ &lt;optional&gt;<br>
3269
+
3256
3270
 
3271
+
3272
+ </td>
3257
3273
 
3258
3274
 
3259
- <td class="description last"><p>Whether there should be a beep sound when this <a href="Worker.html">Worker</a> participant leaves the Conference</p></td>
3275
+
3276
+
3277
+ <td class="description last"><p>The HTTP method for the hold URL.</p></td>
3260
3278
  </tr>
3261
3279
 
3262
3280
 
@@ -4661,7 +4679,7 @@ provided, defaults to 'default' channel.</p></td>
4661
4679
  <span class="jsdoc-message">
4662
4680
  Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a>
4663
4681
 
4664
- on 2023-08-01T08:45:21+00:00
4682
+ on 2023-09-28T07:41:55+00:00
4665
4683
 
4666
4684
  using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
4667
4685
  </span>
@@ -97,12 +97,13 @@
97
97
 
98
98
 
99
99
  <section class="readme-section">
100
- <article><p><a href="https://travis-ci.org/twilio/twilio-taskrouter.js"><img src="https://travis-ci.org/twilio/twilio-taskrouter.js.svg?branch=master" alt="Build Status"></a>
100
+ <article><p><a href="https://github.com/twilio/twilio-taskrouter.js/actions/workflows/build.yml"><img src="https://github.com/twilio/twilio-taskrouter.js/actions/workflows/build.yml/badge.svg" alt="build"></a>
101
+ <a href="https://github.com/twilio/twilio-taskrouter.js/actions/workflows/release.yml"><img src="https://github.com/twilio/twilio-taskrouter.js/actions/workflows/release.yml/badge.svg" alt="Release"></a>
101
102
  <a href="https://badge.fury.io/js/twilio-taskrouter"><img src="https://badge.fury.io/js/twilio-taskrouter.svg" alt="npm version"></a></p>
102
103
  <h1>twilio-taskrouter.js</h1>
104
+ <p><a href="https://badge.fury.io/js/twilio-taskrouter"><img src="https://badge.fury.io/js/twilio-taskrouter.svg" alt="npm version"></a></p>
103
105
  <p>TaskRouter is Twilio's skills based routing system. With this library, you can manage your Workers in the browser or view the state of your Workspace.</p>
104
- <p><strong>NOTE: This SDK is in a Developer Preview Release</strong>. This version of TaskRouter is intended for Twilio Flex. If you are using it outside of Twilio Flex, you may encounter bugs and instability, and
105
- the underlying APIs available in this release may change in subsequent releases.</p>
106
+ <p>This version of TaskRouter SDK can be used with Twilio Flex and TaskRouter standalone instances.</p>
106
107
  <h2>Installation</h2>
107
108
  <h3>NPM</h3>
108
109
  <pre class="prettyprint source"><code>npm install twilio-taskrouter
@@ -111,58 +112,78 @@ the underlying APIs available in this release may change in subsequent releases.
111
112
  <p>The following is a simple example showing a Worker waiting for Reservations.
112
113
  For more information, refer to the
113
114
  <a href="//twilio.github.io/twilio-taskrouter.js/index.html">API Docs</a>.</p>
114
- <pre class="prettyprint source lang-js"><code>const TaskRouter = require('twilio-taskrouter');
115
- const Twilio = require('twilio');
115
+ <pre class="prettyprint source lang-js"><code>const TaskRouter = require("twilio-taskrouter");
116
+ const Twilio = require("twilio");
116
117
  const AccessToken = Twilio.jwt.AccessToken;
117
118
  const TaskRouterGrant = AccessToken.TaskRouterGrant;
118
119
 
119
- const accountSid = '';
120
- const signingKeySid = '';
121
- const signingKeySecret = '';
122
- const workspaceSid = '';
123
- const workerSid = '';
124
-
125
- const token = createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid);
120
+ const accountSid = "";
121
+ const signingKeySid = "";
122
+ const signingKeySecret = "";
123
+ const workspaceSid = "";
124
+ const workerSid = "";
125
+
126
+ const token = createAccessToken(
127
+ accountSid,
128
+ signingKeySid,
129
+ signingKeySecret,
130
+ workspaceSid,
131
+ workerSid
132
+ );
126
133
  const alice = new TaskRouter.Worker(token);
127
134
 
128
- alice.on('ready', readyAlice =&gt; {
129
- console.log(`Worker ${readyAlice.sid} is now ready for work`);
135
+ alice.on("ready", (readyAlice) =&gt; {
136
+ console.log(`Worker ${readyAlice.sid} is now ready for work`);
130
137
  });
131
138
 
132
- alice.on('reservationCreated', reservation =&gt; {
133
- console.log(`Reservation ${reservation.sid} has been created for ${alice.sid}`);
134
- console.log(`Task attributes are: ${reservation.task.attributes}`);
139
+ alice.on("reservationCreated", (reservation) =&gt; {
140
+ console.log(
141
+ `Reservation ${reservation.sid} has been created for ${alice.sid}`
142
+ );
143
+ console.log(`Task attributes are: ${reservation.task.attributes}`);
135
144
 
136
- reservation.on('accepted', acceptedReservation =&gt; {
137
- console.log(`Reservation ${acceptedReservation.sid} was accepted.`);
138
- });
145
+ reservation.on("accepted", (acceptedReservation) =&gt; {
146
+ console.log(`Reservation ${acceptedReservation.sid} was accepted.`);
147
+ });
139
148
 
140
- reservation.accept().then(acceptedReservation =&gt; {
149
+ reservation
150
+ .accept()
151
+ .then((acceptedReservation) =&gt; {
141
152
  console.log(`Reservation status is ${acceptedReservation.status}`);
142
- }).catch((err) =&gt; {
153
+ })
154
+ .catch((err) =&gt; {
143
155
  console.log(`Error: ${err}`);
144
156
  });
145
157
  });
146
158
 
147
- function createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid) {
148
- const taskRouterGrant = new TaskRouterGrant({
149
- workerSid: workerSid,
150
- workspaceSid: workspaceSid,
151
- role: 'worker'
152
- });
153
-
154
- const accessToken = new AccessToken(accountSid, signingKeySid, signingKeySecret);
155
- accessToken.addGrant(taskRouterGrant);
156
- accessToken.identity = 'alice';
157
-
158
- return accessToken.toJwt();
159
+ function createAccessToken(
160
+ accountSid,
161
+ signingKeySid,
162
+ signingKeySecret,
163
+ workspaceSid,
164
+ workerSid
165
+ ) {
166
+ const taskRouterGrant = new TaskRouterGrant({
167
+ workerSid: workerSid,
168
+ workspaceSid: workspaceSid,
169
+ role: "worker",
170
+ });
171
+
172
+ const accessToken = new AccessToken(
173
+ accountSid,
174
+ signingKeySid,
175
+ signingKeySecret
176
+ );
177
+ accessToken.addGrant(taskRouterGrant);
178
+ accessToken.identity = "alice";
179
+
180
+ return accessToken.toJwt();
159
181
  }
160
-
161
182
  </code></pre>
162
183
  <h2>Changelog</h2>
163
- <p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/master/CHANGELOG.md">CHANGELOG.md</a>.</p>
184
+ <p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/main/CHANGELOG.md">CHANGELOG.md</a>.</p>
164
185
  <h2>License</h2>
165
- <p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/master/LICENSE.md">LICENSE.md</a>.</p>
186
+ <p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/main/LICENSE.md">LICENSE.md</a>.</p>
166
187
  <h2>Building</h2>
167
188
  <p>Fork and clone the repository. Use npm to install node 8 (other versions may run into problems).</p>
168
189
  <p>Then, install dependencies with:</p>
@@ -182,6 +203,10 @@ function createAccessToken(accountSid, signingKeySid, signingKeySecret, workspac
182
203
  <li>set ACCOUNT_SID, AUTH_TOKEN, SIGNING_KEY_SID, SIGNING_KEY_SECRET</li>
183
204
  <li>Run ./test/integration_test_setup/RunIntegrationTestLocal.sh this will create everything needed for running E2E tests and run the tests</li>
184
205
  </ul>
206
+ <h2>Test with Sample App</h2>
207
+ <ul>
208
+ <li>See <a href="sample-app/README.md">README.md</a></li>
209
+ </ul>
185
210
  <h2>Contributing</h2>
186
211
  <p>Bug fixes welcome! If you're not familiar with the GitHub pull
187
212
  request/contribution process, <a href="https://gun.io/blog/how-to-github-fork-branch-and-pull-request/">this is a nice tutorial</a>.</p></article>
@@ -230,7 +255,7 @@ request/contribution process, <a href="https://gun.io/blog/how-to-github-fork-br
230
255
  <span class="jsdoc-message">
231
256
  Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a>
232
257
 
233
- on 2023-08-01T08:45:21+00:00
258
+ on 2023-09-28T07:41:55+00:00
234
259
 
235
260
  using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
236
261
  </span>