Cannot read properties of undefined (reading 'deskToken')

We are encountering this “Cannot read properties of undefined (reading ‘deskToken’)” when trying to create a ticket using SendBirdDesk javascript with node.js after trying like below
SendBirdDesk.Ticket.create(TICKET_TITLE, USER_NAME, (ticket, error) => {
if (error) {
// Handle error.

// The ticket is created.
// The customer and agent can chat with each other by sending a message through the or sendFileMessage().
// The property indicates the group channel object within the ticket.


Hello @fresh

Welcome to the Sendbird community!

Can you please check if you have properly authenticated the customer from Sendbird Chat with the Desk SDK before creating a ticket. You can use the SendBirdDesk.authenticate() method to authenticate the customer and retrieve the ‘deskToken’ value.

Reference: Authentication | Desk JavaScript SDK | Sendbird Docs

Once the SendBirdDesk instance is connected, you can create a ticket: Ticket | Desk JavaScript SDK | Sendbird Docs

Let me know if this helps.

Hello @Chinmaya_Gupta and thank you very much for the welcome. Yeah!!! it always great to be acknowledged the first time. I believe all that is set correctly. The user is getting authenticated correctly. below are the steps i took

const SendBird = require(‘sendbird’)
const SendBirdDesk = require(‘sendbird-desk’)

const sb = new SendBird({ appId: process.env.SENDBIRD_APP_ID })

await sb.connect(userId, accessToken)

// Initialize SendBirdDesk

await SendBirdDesk.authenticate(userId, accessToken)

and the user is authenticated with accessToken but when i call SendBirdDest.Ticket.create(…) it throws the desktoken error. But you mentioned that i can use the SendBirdDesk.authenticate() method to also retrieve the “deskToken” , How where do i use the deskToken? In the docs i couldn’t find anything to do with deskToken or showing providing one in order to create a ticket nowhere.