@@ -34,9 +34,10 @@ module.exports = function(RED) {
34
34
35
35
RED . httpNode . post ( `/nr-component-chatbot/${ uniqueID } ` , function ( req , res ) {
36
36
37
+ debug ( `Path ${ req . originalUrl } hit.` ) ;
37
38
node . updateWires ( wires [ node . id ] ) ;
38
39
39
- if ( process . env . ADDITIONAL_DEBUG === true ) {
40
+ if ( process . env . ADDITIONAL_DEBUG ) {
40
41
debug ( "REQUEST:" , req ) ;
41
42
debug ( "REQUEST_BODY:" , req . body ) ;
42
43
}
@@ -73,6 +74,8 @@ module.exports = function(RED) {
73
74
74
75
node . on ( 'input' , function ( msg ) {
75
76
77
+ debug ( 'Reply node recieved input:' , JSON . stringify ( msg ) ) ;
78
+
76
79
if ( msg [ 'nr-component-chatbot-id' ] ) {
77
80
connectionQueue [ msg [ 'nr-component-chatbot-id' ] ] . messages . push ( msg . payload ) ;
78
81
}
@@ -82,6 +85,7 @@ module.exports = function(RED) {
82
85
RED . httpNode . get ( "/nr-component-chatbot/get-id" , function ( req , res ) {
83
86
84
87
const queueUUID = uuid ( ) ;
88
+ debug ( 'New UUID for chatbot requested and created:' , queueUUID ) ;
85
89
86
90
connectionQueue [ queueUUID ] = {
87
91
messages : [ ]
@@ -94,7 +98,9 @@ module.exports = function(RED) {
94
98
95
99
} ) ;
96
100
97
- RED . httpNode . get ( `/nr-component-chatbot/:queueUUID` , function ( req , res ) {
101
+ RED . httpNode . get ( `/nr-component-chatbot/check-messages/:queueUUID` , function ( req , res ) {
102
+
103
+ debug ( `Checking messages at ${ req . originalUrl } ` ) ;
98
104
99
105
node . updateWires ( wires [ node . id ] ) ;
100
106
@@ -107,6 +113,8 @@ module.exports = function(RED) {
107
113
108
114
} else {
109
115
116
+ debug ( `Request tried to check for message queue that doesn't exist: ${ req . params . queueUUID } ` ) ;
117
+
110
118
res . status ( 404 ) ;
111
119
res . json ( {
112
120
status : 'err' ,
0 commit comments