twilio / twilio-taskrouter.js Goto Github PK
View Code? Open in Web Editor NEWJS SDK v2 for Twilio's TaskRouter skills based routing system.
Home Page: https://www.twilio.com/docs/taskrouter
License: Other
JS SDK v2 for Twilio's TaskRouter skills based routing system.
Home Page: https://www.twilio.com/docs/taskrouter
License: Other
I'm experiencing conflicts in some tasks due to concurrent updates. So I'm tracking down all the places performing any updates to tasks: Backend systems, functions, and Flex plugins. I hope a can apply the conflict resolution suggested in the documentation. When investigating one of my plugins I realized this method doesn't handle the task version when setting the attributes. This could lead to the kind of conflict I'm trying to mitigate.
Is the version handling in the roadmap for this lib? In the meanwhile, there's a suggested way to handle the task update differently in Flex plugins?
twilio-taskrouter.js/lib/Task.js
Lines 183 to 194 in 8587e0a
Can't make it work with React Native. Is it even possible?
05-16 23:10:04.746 13860 14128 E ReactNativeJS: TypeError: this.methodFactory is not a function. (In 'this.methodFactory(o,e,n)', 'this.methodFactory' is undefined)
05-16 23:10:04.751 13860 14128 E ReactNativeJS: Invariant Violation: "main" has not been registered. This can happen if:
05-16 23:10:04.751 13860 14128 E ReactNativeJS: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
05-16 23:10:04.751 13860 14128 E ReactNativeJS: * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
The taskQueue only has "ready" and "tokenExpired".
We need to know when tasks have been added to a queue or any tasks in the queue have been updated.
https://www.twilio.com/docs/taskrouter/js-sdk/workspace/worker#update
this method does not exist in source and produce error
https://github.com/twilio/twilio-taskrouter.js/blob/0.5.1/lib/Worker.js
Hello,
I wasn't able to find reason for the following in TaskRouter release notes, but:
@twilio/[email protected]
comes with twilio-taskrouter@^0.7.1
@twilio/[email protected]
comes with twilio-taskrouter@^0.5.9
(which is a lower version)Prior to Flex UI 1.34.0 we relied on some Worker
attributes and methods, part of which existed in TR 0.7.x
but didn't exist in TR 0.5.x
. As a result, when upgrading our custom plugin to [email protected]
we're facing with compatibility issues. For example we used Worker.fetchLatestVersion
method which we now cannot use with [email protected]
.
First of all.. how/where can we track such unexpected breaking changes when a part of dependencies is downgraded whereas with the Flex UI package version is upgraded?
What would be an alternative to this Worker.fetchLatestVersion
method in TR 0.5.x
?
We're also aiming to have our code compatible with Flex UI 2.x as much as possible, and that is one of the issues which 'caused a negative effect on this goal.
On rare occasion, I am getting a network timeout uncaught exception being thrown from axios.
"level":"error","message":"uncaughtException: timeout of 5000ms exceeded\nError: timeout of 5000ms exceeded\n at e.exports (/mytestproject/node_modules/twilio-taskrouter/dist/index.commonjs2.js:10:83369)\n at Timeout._onTimeout (/mytestproject/node_modules/twilio-taskrouter/dist/index.commonjs2.js:10:186399)\n at listOnTimeout (node:internal/timers:556:17)\n at processTimers (node:internal/timers:499:7)","stack":"Error: timeout of 5000ms exceeded\n at e.exports (/mytestproject/node_modules/twilio-taskrouter/dist/index.commonjs2.js:10:83369)\n at Timeout._onTimeout (/mytestproject/node_modules/twilio-taskrouter/dist/index.commonjs2.js:10:186399)\n at listOnTimeout (node:internal/timers:556:17)\n at processTimers (node:internal/timers:499:7)","exception":true,"date":"Wed Mar 24 2021 10:44:42 GMT-0400 (Eastern Daylight Time)"
Is there anyway to handle this in nodejs gracefully?
This error seems to happen occasionally. Here's the Sentry info:
https://sentry.io/share/issue/1a50917f3599473b9abfbfc4a4451d1b/
TypeError: Object.defineProperty called on non-object
at Function.defineProperty(<anonymous>)
at Object.setProperties(/js/taskrouter/v1.21/taskrouter.min.js:2:20376)
at Object.createEntity(/js/taskrouter/v1.21/taskrouter.min.js:2:13709)
at WorkerClient._emitMessage(/js/taskrouter/v1.21/taskrouter.min.js:1:17529)
at WebSocket.ws.onmessage(/js/taskrouter/v1.21/taskrouter.min.js:1:6896)
Two issues I would like to get resolved:
async
in front of the transfer
function (like the surrounding functions)Currently causing: TS1070: 'async' modifier cannot appear on a type member
int
to number
as there's no such primitive type in TSCurrently causing: TS2304: Cannot find name 'int'
Hi. I'm trying to experiment with this package in React.js. Following the docs from https://www.twilio.com/docs/taskrouter/js-sdk/workspace/worker#how-does-it-work I am successful in generating a capability token and then using it as the WORKER_TOKEN
variable that is passed in as an argument to TaskRouter.Worker
's constructor. In a vanilla HTML/JS file, I imported the url-hosted package for taskrouter
from here: https://sdk.twilio.com/js/taskrouter/v1.21/taskrouter.min.js. I can connect to the WebSocket server successfully and receive a ready
event when connected.
However, when trying to use twilio-taskrouter
package installed via npm
on a React project, I am not able to connect to the WebSocket server successfully despite generating the access token the same way it was instructed in the code here: https://www.twilio.com/docs/taskrouter/js-sdk/workspace/worker?code-sample=code-creating-a-taskrouter-worker-capability-token&code-language=Node.js&code-sdk-version=3.x
This leads me to wonder a few things:
signingKeySid
and signingKeySecret
which is very ambiguous and I was not able to find anything regarding these two terms in the docs or on Twilio Console.When using Flex and Taskrouter, we are running into an issue in our deployment pipeline where the release-tool dependency is being blocked from accessing that GitHub repo.
Could that dependency be made a dev dependency? I believe that would solve our issue of trying to download that behind our proxy.
WorkerClient.prototype.fetchReservations = function fetchReservations(completion, params) {
var request = {
url: this.workspaceUrl + "/Workers/" + this.workerSid + "/Reservations",
method: "GET",
token: this.token
};
if (params) {
request.params = params
}
var jsonParams = JSON.stringify(request);
var wrapperCompletionFunc = function (error, reservations) {
if (error) {
completion(error);
return
}
var data = reservations.data;
var promises = [];
var setTaskProperties = function (reservation) {
var promise = PropertyUtil.setTaskProperty(reservation);
promises.push(promise)
};
// Undeclared variable i
for (i = 0; i < data.length; i++) {
setTaskProperties(data[i])
}
Promise.all(promises).then(function (results) {
completion(null, reservations)
})
};
this.apiRequester._postMessage(jsonParams, wrapperCompletionFunc)
};
WorkerClient.prototype._emitPendingReservations = function _emitPendingReservations() {
var self = this;
this._fetchPendingReservations().then(function (reservations) {
if (reservations.length === 0 && self.connectActivitySid) {
self.update("ActivitySid", self.connectActivitySid)
}
// Undeclared variable i
for (i = 0; i < reservations.length; i++) {
self._emitMessage("reservation.pending", reservations[i])
}
}, function (error) {
self._log(error.code + " with " + error.message)
})
};
The documentation around task router V1 and V2 is very confusing. It would be helpful if this project started in the V2 semver range. Perhaps even a note in the readme to indicate there is an older version and main differences.
Hi there,
Firstly, i don't know if its a library error or my development mistake, then i'm opening this issue here anyway.
When i'm conferencing a reservation via reservation.conference command, it turns into a loop of "reservation.created -> reservation.canceled -> reservation.created" actions.
I noticed that it just occurs when Agent Conference is on in my Twilio dashboard.
Do you know what it may be?
I am seeing a TS compilation error whereby 'on' is not defined on type 'Worker'. I think this is because the Worker class which is extending NodeJS.EventEmitter
should be an interface as opposed to a class.
So instead of export class Worker extends NodeJS.EventEmitter {
it should be export interface Worker extends NodeJS.EventEmitter {
.
This may be since the release of Node > 14, see here for a similar issue.
Why are the versions different? Are these two different products? The docs are ambiguous about this.
Cos like: https://www.twilio.com/docs/taskrouter/js-sdk/workspace/worker
Point towards the minfied script. Is this repo compatible with this? Are the docs out of date?
In my project I am using typescript and require Twilio types. Inside this repository I can see a types.d.ts file which is exporting all the different types. However when attempting to import these types they can not be found.
Looking in node modules at was is installed for the package and it appears the types file or an equivalent is not included.
Could this be an issue with the package itself or the way in which I am trying to import the type?
In the original JS SDK there's a parameter in the Worker constructor for an activity to place the worker in upon disconnect. Is it possible to add that in this version? Thank you.
https://www.twilio.com/docs/taskrouter/js-sdk/worker#parameters
If the user sets the computer on sleep for long interval then on reconnection it starts giving error
Websocket closed
Websocket has disconnected
Received a message of type [disconnected]
Websocket had an error.
Even though I tried creating new worker with existing token (i.e. new Twilio.TaskRouter.Worker(workerToken, true, null, null, true), or with new token, or with worker.updateToken still the worker does not establishes connection again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.