Skip to content

Instantly share code, notes, and snippets.

@jobemakar
Created February 26, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobemakar/754ff7ee1dc206ce55f6f3c9365e913b to your computer and use it in GitHub Desktop.
Save jobemakar/754ff7ee1dc206ce55f6f3c9365e913b to your computer and use it in GitHub Desktop.
data OnMessagePayload {
requestId: '2a3658fe666772f75dfa265bebd69f58',
botId: 'st-b986c323-2e81-5910-bb6d-2b93d26bfa37',
componentId: 'default',
payloadClassName: 'OnMessagePayload',
_originalPayload:
{ channel:
{ type: 'rtm',
from: 'u-0061afda-50c5-59a1-81c9-5693a79d3918',
botInfo: [Object],
handle: [Object],
client: 'botbuilder',
body: 'talk to human',
message: 'The bot is not accessible via Web/Mobile Client.',
channelDelete: true,
tokens: [],
userId: 'u-0061afda-50c5-59a1-81c9-5693a79d3918',
requestId: 'ms-3733820d-d89e-5e22-be1a-7cf3f6a2dfc2',
botLanguage: 'en' },
message: 'talk to human',
context: { session: [Object] },
requestId: '2a3658fe666772f75dfa265bebd69f58',
agent_transfer: false,
baseUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37',
sendUserMessageUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/sendUserMessage/2a3658fe666772f75dfa265bebd69f58',
sendBotMessageUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/sendBotMessage/2a3658fe666772f75dfa265bebd69f58',
resetBotUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/resetbot/2a3658fe666772f75dfa265bebd69f58',
getBotVariableUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/getBotVariables',
sendBotEventUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/sendBotEvent/2a3658fe666772f75dfa265bebd69f58',
metaInfo: {} },
getBotVariableUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/getBotVariables',
sendUserMessageUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/sendUserMessage/2a3658fe666772f75dfa265bebd69f58',
sendBotMessageUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/sendBotMessage/2a3658fe666772f75dfa265bebd69f58',
resetBotUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37/resetbot/2a3658fe666772f75dfa265bebd69f58',
baseUrl:
'https://bots.kore.ai/api/botsdk/stream/st-b986c323-2e81-5910-bb6d-2b93d26bfa37',
metaInfo: {},
context:
{ session:
{ EnterpriseContext: {},
BotContext: {},
UserContext: [Object],
UserSession: {},
BotUserSession: [Object],
opts: [Object] } },
channel:
{ type: 'rtm',
from: 'u-0061afda-50c5-59a1-81c9-5693a79d3918',
botInfo:
{ chatBot: 'Travel Planning Sample_1582746230506',
taskBotId: 'st-b986c323-2e81-5910-bb6d-2b93d26bfa37' },
handle:
{ handleId: 'e4fca60f-47bf-4633-b1b3-778697ef21e0',
userId: 'u-0061afda-50c5-59a1-81c9-5693a79d3918',
clientId: '5a37bf24-fea0-4e6b-a816-f9602db08149',
taskBotId: 'st-b986c323-2e81-5910-bb6d-2b93d26bfa37',
traceId: '55e034376ac858e8',
spanId: '55e034376ac858e8',
trace: [Object] },
client: 'botbuilder',
body: 'talk to human',
message: 'The bot is not accessible via Web/Mobile Client.',
channelDelete: true,
tokens: [],
userId: 'u-0061afda-50c5-59a1-81c9-5693a79d3918',
requestId: 'ms-3733820d-d89e-5e22-be1a-7cf3f6a2dfc2',
botLanguage: 'en' },
message: 'talk to human',
agent_transfer: false,
ackMessage: true,
toJSON: [Function] }
{ StatusCodeError: 422 - "{\"error\":\"Unprocessable Entity\"}"
at new StatusCodeError (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request\request.js:186:22)
at Request.emit (events.js:198:13)
at Request.<anonymous> (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request\request.js:1081:10)
at Request.emit (events.js:198:13)
at IncomingMessage.<anonymous> (C:\Users\jmakar\Downloads\kore.ai\BotKit-master\node_modules\request\request.js:1001:12)
at Object.onceWrapper (events.js:286:20)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'StatusCodeError',
statusCode: 422,
message: '422 - "{\\"error\\":\\"Unprocessable Entity\\"}"',
error: '{"error":"Unprocessable Entity"}',
options:
{ method: 'GET',
uri:
'https://api.livechatinc.com/visitors/u-0061afda-50c5-59a1-81c9-5693a79d3918/chat/get_pending_messages?licence_id=11758215&secured_session_id=&last_message_id=0',
headers:
{ 'content-type': 'application/x-www-form-urlencoded',
'X-API-Version': 2 },
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response:
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null },
readable: false,
_events:
[Object: null prototype] {
end: [Array],
close: [Array],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.livechatinc.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 7,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.livechatinc.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: null,
[Symbol(asyncId)]: 988,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBytesRead)]: 597,
[Symbol(kBytesWritten)]: 262,
[Symbol(connect-options)]: [Object] },
connection:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.livechatinc.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 7,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.livechatinc.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: null,
[Symbol(asyncId)]: 988,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBytesRead)]: 597,
[Symbol(kBytesWritten)]: 262,
[Symbol(connect-options)]: [Object] },
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers:
{ 'cache-control': 'no-cache, no-store, must-revalidate',
pragma: 'no-cache',
'access-control-allow-origin': 'https://my.livechatinc.com',
'access-control-allow-methods': 'GET,PUT,POST,DELETE',
'access-control-allow-headers':
'Content-Type,X-API-Version,Authorization,X-API-Type,X-Application,X-Region',
'access-control-allow-credentials': 'true',
'x-content-type-options': 'nosniff',
'content-type': 'application/json; charset=utf-8',
'content-length': '32',
etag: 'W/"20-2342507927"',
vary: 'Accept-Encoding',
date: 'Wed, 26 Feb 2020 20:43:05 GMT',
connection: 'close' },
rawHeaders:
[ 'Cache-Control',
'no-cache, no-store, must-revalidate',
'Pragma',
'no-cache',
'Access-Control-Allow-Origin',
'https://my.livechatinc.com',
'Access-Control-Allow-Methods',
'GET,PUT,POST,DELETE',
'Access-Control-Allow-Headers',
'Content-Type,X-API-Version,Authorization,X-API-Type,X-Application,X-Region',
'Access-Control-Allow-Credentials',
'true',
'X-Content-Type-Options',
'nosniff',
'Content-Type',
'application/json; charset=utf-8',
'Content-Length',
'32',
'ETag',
'W/"20-2342507927"',
'Vary',
'Accept-Encoding',
'Date',
'Wed, 26 Feb 2020 20:43:05 GMT',
'Connection',
'close' ],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 422,
statusMessage: 'Unprocessable Entity',
client:
TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'api.livechatinc.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 7,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.livechatinc.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: null,
[Symbol(asyncId)]: 988,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBytesRead)]: 597,
[Symbol(kBytesWritten)]: 262,
[Symbol(connect-options)]: [Object] },
_consuming: false,
_dumped: false,
req:
ClientRequest {
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header:
'GET /visitors/u-0061afda-50c5-59a1-81c9-5693a79d3918/chat/get_pending_messages?licence_id=11758215&secured_session_id=&last_message_id=0 HTTP/1.1\r\ncontent-type: application/x-www
rm-urlencoded\r\nX-API-Version: 2\r\nhost: api.livechatinc.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path:
'/visitors/u-0061afda-50c5-59a1-81c9-5693a79d3918/chat/get_pending_messages?licence_id=11758215&secured_session_id=&last_message_id=0',
_ended: true,
res: [Circular],
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]: [Object] },
request:
Request {
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
method: 'GET',
uri: [Url],
headers: [Object],
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_disableCookies: true,
_jar: undefined,
port: 443,
host: 'api.livechatinc.com',
path:
'/visitors/u-0061afda-50c5-59a1-81c9-5693a79d3918/chat/get_pending_messages?licence_id=11758215&secured_session_id=&last_message_id=0',
httpModule: [Object],
agentClass: [Function],
agent: [Agent],
_started: true,
href:
'https://api.livechatinc.com/visitors/u-0061afda-50c5-59a1-81c9-5693a79d3918/chat/get_pending_messages?licence_id=11758215&secured_session_id=&last_message_id=0',
req: [ClientRequest],
ntick: true,
response: [Circular],
originalHost: 'api.livechatinc.com',
originalHostHeaderName: 'host',
responseContent: [Circular],
_destdata: true,
_ended: true,
_callbackCalled: true },
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: '{"error":"Unprocessable Entity"}' } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment