
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
amazon-connect-taskjs
Advanced tools
The Amazon Connect Task javascript library (TaskJS) gives you the power to handle task contacts when used together with Amazon Connect Streams.
To learn more about Amazon Connect and its capabilities, please check out the Amazon Connect User Guide.
$ git clone https://github.com/amazon-connect/amazon-connect-taskjs
Amazon Connect Streams is required to use TaskJS. Ensure you import TaskJS after Streams.
TaskJs v2.0 requires Streams v2.2 or later.
npm installnpm run devo for a non-minified build.npm run release for a minified build.npm run testnpm run cleannpm run watchFind build artifacts in dist directory - This will generate a file called amazon-connect-task.js - this is the full Connect TaskJS API which you will want to include in your page.
TaskJS provides a taskSession instance for each task contact. You can access the taskSession by calling the getMediaController method on a taskConnection. getMediaController returns a promise that resolves with a taskSession instance.
For example:
taskConnection.getMediaController().then((taskSession) => { /* ... */ });
Each of the following event handlers will pass a message object to the callback function containing the following fields:
AbsoluteTime: UTC timestamp of when the event occurred.ContentType: One of the following strings depending on the event:
application/vnd.amazonaws.connect.event.transfer.initiatedapplication/vnd.amazonaws.connect.event.transfer.succeededapplication/vnd.amazonaws.connect.event.transfer.failed application/vnd.amazonaws.connect.event.expire.warningapplication/vnd.amazonaws.connect.event.expire.completeId: The contact IDInitialContactId: The initial contact id.taskSession.onTransferInitiatedSubscribe a method to be invoked when the server has initiated the task transfer.
taskSession.onTransferInitiated((message) => console.log("Transfer has initiated"))
taskSession.onTransferSucceededSubscribe a method to be invoked when the task transfer has succeeded.
taskSession.onTransferSucceeded((message) => console.log("Transfer has succeeded"))
taskSession.onTransferFailedSubscribe a method to be invoked when the task transfer has failed.
taskSession.onTransferFailed((message) => console.log("Transfer has failed"))
taskSession.onTaskExpiringSubscribe a method to be invoked two hours before the task expires.
taskSession.onTaskExpiring((message) => console.log("Task will expire in two hours"))
taskSession.onTaskExpiredSubscribe a method to be invoked when the task has expired.
taskSession.onTaskExpired((message) => console.log("Task has expired"))
taskSession.onMessageSubscribe a method to be invoked when any one of the above events has occurred.
taskSession.onMessage((message) => console.log("The following event has occurred:", message.ContentType))
agent.createTask()Create a new task.
const newTask = {
name: "string", //required, max len: 512
description: "string", //optional, max len: 4096
endpoint: endpointObject, //required for non templated tasks, can be retrieved via `agent.getEndpoints()`. Agent and queue endpoints supported.
taskTemplateId: "string", //required for templated tasks, ID of the template the task is created from. Template should belong to connect instance
previousContactId: "string", //optional, the previous contact ID for a linked task
references: { //optional. Only URL references are supported for non templated tasks
"reference name 1": { // string, max len: 4096
type: "URL" //required, string, one of connect.ReferenceType types,
value: "https://www.amazon.com" //required, string, max len: 4096
},
"reference name 2": { // string, max len: 4096
type: "EMAIL" //required, string, one of connect.ReferenceType types
value: "example@abc.com" //required, string, max len: 4096
},
"reference name 3": { // string, max len: 4096
type: "NUMBER" //required, one of connect.ReferenceType types
value: 1000 //required, number
},
"reference name 4": { // string, max len: 4096
type: "DATE", //required, string, one of connect.ReferenceType types
value: 1649961230 //required, number
},
"reference name 5": { // string, max len: 4096
type: "STRING" //required, string, one of connect.ReferenceType types
value: "example@abc.com" //required, string, max len: 4096
}
},
scheduledTime: "number" //optional, UTC timestamp in seconds when the task should be delivered.
};
agent.createTask(newTask, {
success: function(data) { console.log("Created a task with contact id: ", data.contactId) },
failure: function(err) { /* ... */ }
});
agent.updateContact()Update a task contact created from a template.
const updatedTaskData = {
contactId: "string", // required, task contact identifier
name: "string", // optional, task name
description: "string", // optional, task description
references: { //optional, used to specify updated template fields
"reference name": { // string
type: "NUMBER" //required, one of connect.ReferenceType types
value: 1001 //required, number
}
//see more examples in agent.createTask() description
}
};
agent.updateContact(updatedTaskData, {
success: function() { console.log("The task updated successfully") },
failure: function(err) { /* ... */ }
});
agent.listTaskTemplates()Load a list of task templates that belong to a connect instance
const queryParams = {// required
status: 'active', //optional, string, can be either 'active' or 'inactive'
maxResults: 50 //optional, number, max value of 100
};
agent.listTaskTemplates(queryParams, {
success: function(data) { console.log("List of task templates loaded successfully", data) },
failure: function(err) { /* ... */ }
});
agent.getTaskTemplate()Load a template data, including fields, default values and constraints
const templateParams = {// required
id: 'string', //required, string, template ID, template should belong to connect instance
version: 'string' //optional, string, task template version
};
agent.getTaskTemplate(templateParams, {
success: function(data) { console.log("Template data loaded successfully", templateParams.id, data) },
failure: function(err) { /* ... */ }
});
connect.ReferenceTypeThis enumeration lists the different reference types for a task. Currently supported types: URL, EMAIL, NUMBER, STRING, DATE.
ReferenceType.URL: A URL reference.See CONTRIBUTING for more information.
This project is licensed under the Apache-2.0 License.
FAQs
Provides task support to AmazonConnect customers
We found that amazon-connect-taskjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.