crisp-im/node-crisp-api

Event not triggering: session:request:initiated

dgroechel opened this issue · 3 comments

I am working on an integration and session:request:initiated is not triggering when a new chat is started. I saw it was brought up in issue: #17 but no resolution. Other events such as message:send are working for me.

Steps done to troubleshoot:

  • Incognito window to start a new chat
  • Cleared out all crisp cookies and started a new chat
  • Looked at source and session:request:initiated is included in DEFAULT_RTM_EVENTS

Code example:

const Crisp = require('node-crisp-api')

const TOKEN_KEY = <'TOKEN'>
const TOKEN_IDENTIFIER = <'TOKEN'>

const CrispClient = new Crisp()

console.info('Authenticating...')

CrispClient.authenticateTier("plugin", TOKEN_IDENTIFIER, TOKEN_KEY);

console.info('Listening for events...')

CrispClient.on('session:request:initiated', (message) => {
  console.log("session started", message);
})

Thank you! Is there an event for chat started/initiated in the API? I am not seeing anything in the docs and want to double check

No, there’s no such event. You’d need to catch a message:send event from the user and distinguish which one is the first for the session.