Skip to content

Commit

Permalink
Add work id to the ticket report
Browse files Browse the repository at this point in the history
  • Loading branch information
oanguenot committed Jan 10, 2018
1 parent 0157265 commit 0481083
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ nodeSDK.start().then( () => {
done();
}, this);

chatbot.onTicket((tag, history, from, start, end, state) => {
chatbot.onTicket((tag, history, from, start, end, state, id) => {
// Do something when a user has completed a scenario
...
}, this);
Expand Down Expand Up @@ -289,7 +289,7 @@ If you want to listen to tickets generated, you have to add the following code:

```js

chatbot.onTicket((tag, history, from, startdate, enddate, state) => {
chatbot.onTicket((tag, history, from, startdate, enddate, state, id) => {
// Do something with the ticket
...
}, this);
Expand All @@ -310,6 +310,9 @@ This callback will receive:

- `state`: The state of the ticket. The possible values are `CLOSED` when the scenario has been finished successfully or `ABORTED` if the scenario didn't reach the last step.

- `id`: The unique identifier of the ticket.


#### Tickets storage

It's up to your application to store tickets. Once generated, tickets are not saved by the chatbot. If you don't catch them and store them, tickets will be lost.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class RainbowAgent {
}

fireTicketEvent(work) {
this._callbackTicket.call(this._contextTicket, work.tag, work.history, work.from, work.createdOn, work.endedOn, work.state);
this._callbackTicket.call(this._contextTicket, work.tag, work.history, work.from, work.createdOn, work.endedOn, work.state, work.id);
}

addPostListener() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rainbow-chatbot",
"version": "1.34.4",
"version": "1.34.5",
"description": "Rainbow ChatBot library for the Rainbow SDK for Node.JS",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions samples/sample_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ nodeSDK.start().then( () => {
}
}, this);

chatbot.onTicket((tag, history, from, start, end, state) => {
console.log("::: On ticket>", tag, history, from, start, end, state);
chatbot.onTicket((tag, history, from, start, end, state, id) => {
console.log("::: On ticket>", tag, history, from, start, end, state, id);
}, this);
});

Expand Down

0 comments on commit 0481083

Please sign in to comment.