Giter VIP home page Giter VIP logo

amazon-connect-taskjs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-connect-taskjs's Issues

'api_response' event handler failed - when using createTask

Hi

I have pasted my code below. I am able to "console.log(newTask);" and get a result, however I receive an API_response error when agent.createTask is invoked. Can you please advise where I am going wrong?

Thanks

	connect.agent(function(agent) {

	var queuesARNs = agent.getAllQueueARNs();
	agent.getEndpoints(
	   queuesARNs,
	   {
	      success: function(data) {
	         var endpoints = data.endpoints; // or data.addresses
	          console.log(endpoints[3]);

	          const newTask = {
	            name: "Test task from taskJS", //required, max len: 512
	            description: "N/A", //optional, max len: 4096
	            endpoint: endpoints[3], 
	            references: { //optional
	                  "reference name": { // string, max len: 4096
	                    type: "URL", //required, currently only "URL" is supported as a reference type,
	                    value: "https://www.amazon.com" //required, string, max len: 4096
	                  }
	                }
	        };//ends newTask
		console.log(newTask);
	        agent.createTask(newTask, {
	          success: function(data) { console.log("Created a task with contact id: ", data.contactId) },
	          failure: function(err) {console.log("error has occured");}
	        });//ends createTask

	      },//end success

	      failure: function(err) {
	      }

	   }//ends QueueARN
	);// ends agent.getEndpoints
});//ends connect.agent

Is it possible to set contact attributes for created tasks using streams API?

I'm aware with the https://docs.aws.amazon.com/connect/latest/APIReference/API_StartTaskContact.html API it's possible to set contact attributes, and I'm aware the streams library does not support setting contact attributes, but just wanted to confirm there's no way to set contact attributes alongside a agent.createTask operation?

Aside from contact attributes being useful for contact flow logic, they are also useful because when a telephone number is provided with a plus extension, they automatically format it as a click-to-dial, and as far as I can see that's not possible via agent.createTask references

- Event handler usage -

I'm trying to use the Event handler :
taskSession.onMessage((message) => console.log("The following event has occurred:", message.ContentType))

Could you please share with code snapshot to understand how it works ?

here is my code snapshot :
c.onConnecting(function (c) { if (c.getType() === "task") { const cnn = contact.getConnections().find(cnn => cnn.getType() === connect.ConnectionType.INBOUND); if (cnn.getMediaType() === "task") { console.warn("############ TASK "); } cnn.getMediaController().then((taskSession) => { taskSession.onMessage((message) => console.log("The following event has occurred:", message.ContentType)) });

This event is only sent when agent.createTask() is called ?

many thanks,
Alex

Syntax error - missing '}' when using createTask

Hi

Im trying to run the createTask API, and I kept hitting a syntax error (missing a closing bracket). I found that this issue was fixed when I added a ',' to the references section after the 'type'

Original Code

const newTask = {
	            name: "Test task from taskJS", //required, max len: 512
	            description: "N/A", //optional, max len: 4096
	            endpoint: endpoints, 
	            references: { //optional
	                  "reference name": { // string, max len: 4096
	                    type: "URL" //required, currently only "URL" is supported as a reference type,
	                    value: "https://www.amazon.com" //required, string, max len: 4096
	                  }
	                }
};

============================

Implemented change

const newTask = {
	            name: "Test task from taskJS", //required, max len: 512
	            description: "N/A", //optional, max len: 4096
	            endpoint: endpoints, 
	            references: { //optional
	                  "reference name": { // string, max len: 4096
	                    type: "URL", //required, currently only "URL" is supported as a reference type,
	                    value: "https://www.amazon.com" //required, string, max len: 4096
	                  }
	                }
};

============================
Please let me know if this correct solution, or if the original was correct and I possibly missed something else in my code.

Thanks

Unable to fetch list of task templates

I am using the following code to fetch the list of task templates

**const queryParams = {/
status: 'active'
maxResults: 50
};

agent.listTaskTemplates(queryParams, {
success: function(data) { console.log("List of task templates loaded successfully", data) },
failure: function(err) {
console.error(err);
}
});**

it returns token null and empty templates array, while I have one activeTaskTemplate. I have assigned the permissions to the security profile and the same task template is displaying correctly in the CCP task window.
I am using amazon-connect-taskjs 2.0 and amazon connect streams 2.4.5

createTask does not accept attributes

createTask does not accept an attributes parameter like the StartTaskContact API: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartTaskContact.html

Also the above API does not accept an Endpoint parameter to assign a task using that method.

My current use-case needs to create a task, attach attributes, and assign it to an agent, but this isn't currently possible through the API or amazon-connect-taskjs. Is this something that could be added in the future?

createTask types are not correct

createTask(taskContact: TaskContactDefinition, callbacks?: SuccessFailOptions): void;

The TypeScript typings for agent.createTask are wrong - the optional parameters for TaskContactDefinition are not optional in the type definitions but the readme says that these should be:

  interface TaskContactDefinition {
    /** The  endpoint to assign to */
    readonly endpoint: Endpoint;

    /** The linked contact id */
    readonly previousContactId?: string;

    /** The task name */
    readonly name: string;

    /** The task description */
    readonly description: string;

    /** The task references */
    readonly references: ReferenceDictionary;

    /** The task scheduled time */
    readonly scheduledTime: number;

    /** A random value */
    readonly idempotencyToken: string;

  }

Also the callback is:

interface SuccessFailOptions {
    /** A callback that starts when the operation completes successfully. */
    readonly success?: SuccessFailCallback;

    /** A callback that starts when the operation has an error. */
    readonly failure?: SuccessFailCallback<[string]>;
  }

But success should return a contact ID like {contactId: string}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.