# Ticket not updating after closed by agent

**URL:** <https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620>\
**Category:** JavaScript\
**Tags:** chatsdk\
**Created:** [July 10, 2020, 2:39pm UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620 "2020-07-10T14:39:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirui](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sirui](https://community.sendbird.com/u/sirui)\
**Post date:** [July 10, 2020, 2:39pm UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/1 "2020-07-10T14:39:55Z")

</div>

I’m using SendBird Desk’s JavaScript SDK and ran into a issue. `SendBirdDesk.Ticket.getByChannelUrl` doesn’t always return the latest status of the Ticket. It’s still returning the same data when the ticket has been closed by the agent.

Is there a way I could get a callback when a certain ticket is opened or closed? [The documentation](https://github.com/sendbird/SendBird-Desk-SDK-JavaScript#handling-ticket-event) says:

> Each event type is located in `message.data` which looks like below.
> 
> `{ "type": "TICKET_ASSIGN" // "TICKET_TRANSFER", "TICKET_CLOSE" }`
> 
> You can check out these messages in `ChannelHandler.onMessageReceived()` .

But I’ve never seen these `type` values in `message.data`. The closest things I got were `NOTIFICATION_MANUAL_CLOSED` and `SYSTEM_MESSAGE_TICKET_CLOSED_BY_AGENT`. Am I doing something wrong or the documentation is in inaccurate? Also is there a full list of `message.data.type` values?

Thanks!

---

<div class="post-metadata">

**Author:** ![Mike\_Oh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/mike_oh/32/53_2.png) [@Mike\_Oh](https://community.sendbird.com/u/Mike_Oh)\
**Post date:** [July 27, 2020, 12:28am UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/2 "2020-07-27T00:28:09Z")

</div>

It’s still returning the same data when the ticket has been closed by the agent.

> Generally, an agent can not close a ticket of the Sendbird channel without a customer’s confirmation. If you want to get the ticket close event, you can get by Sendbird Desk webhook.  
> [https://www.notion.so/sendbirddesk/Sendbird-Desk-Webhook-7c3aba331a3d449d9a0e6295fd2022a9#50b7a5cf3b2d45d4bf2b1bb95ce19200](https://www.notion.so/sendbirddesk/Sendbird-Desk-Webhook-7c3aba331a3d449d9a0e6295fd2022a9#50b7a5cf3b2d45d4bf2b1bb95ce19200)

But I’ve never seen these `type` values in `message.data` . The closest things I got were `NOTIFICATION_MANUAL_CLOSED` and `SYSTEM_MESSAGE_TICKET_CLOSED_BY_AGENT`

> Yes. You can get the event type from the json data in message.data. I will share all of the system message types on the above notion link later.  
> {  
> “custom\_type”: “”,  
> “mentioned\_users”: ,  
> “updated\_at”: 0,  
> “is\_removed”: false,  
> “type”: “ADMM”,  
> “message”: “Hi, how can I help you?”,  
> “data”: “{"type": "NOTIFICATION\_WELCOME"}”,  
> “mention\_type”: “users”,  
> “created\_at”: 1582181294246,  
> “channel\_url”: “sendbird\_group\_channel\_7444658\_46427cc7ff1f8ce0f82529b6de8072199c8562ff”,  
> “message\_id”: 15084827  
> },

---

<div class="post-metadata">

**Author:** ![sirui](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sirui](https://community.sendbird.com/u/sirui)\
**Post date:** [July 31, 2020, 8:50am UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/4 "2020-07-31T08:50:28Z")

</div>

I’m talking about the client-side JavaScript SDK ([https://github.com/sendbird/SendBird-Desk-SDK-JavaScript](https://github.com/sendbird/SendBird-Desk-SDK-JavaScript)) so we won’t be able to receive webhook events.

The client-side `type` doesn’t seem to match the documentation.

---

<div class="post-metadata">

**Author:** ![Mike\_Oh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/mike_oh/32/53_2.png) [@Mike\_Oh](https://community.sendbird.com/u/Mike_Oh)\
**Post date:** [August 4, 2020, 5:25am UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/5 "2020-08-04T05:25:01Z")

</div>

> **[Group Channel | JavaScript Chat SDK Documentation | Sendbird](https://docs.sendbird.com/javascript/group_channel#3_receive_messages_through_a_channel_event_handler)**
>
> A group channel is a chat that allows close interactions among a limited number of users. It can be private or public. A private group channel can let a user join the chat through an invitation by another user who is already a member of the chatroom....

  
You can get the above message information from this event handler.  

> **[Messages | Platform API Chat SDK Documentation | Sendbird](https://docs.sendbird.com/platform/messages#_4_resource_representation)**
>
> The following APIs can help you manage messages from your server-side. There are three types: Text message and file message are sent by users in a channel, while an admin message is sent only by an admin user through Chat Platform API or Sendbird...

  
Here is the definition of message data type.

---

<div class="post-metadata">

**Author:** ![sirui](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sirui](https://community.sendbird.com/u/sirui)\
**Post date:** [August 4, 2020, 10:26am UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/6 "2020-08-04T10:26:08Z")

</div>

I couldn’t find anything new in the links you’ve given. My problem is that `message.data.type` doesn’t match the [documentation of SendBird Desk SDK].

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/e9b34d0ca0de0d78eb5819947b1eb095a07b0599.png)

I wanted to know a list of possible values for `message.data.type`, not `message.type`.

---

<div class="post-metadata">

**Author:** ![Sandor\_Fulop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/sandor_fulop/32/1878_2.png) [@Sandor\_Fulop](https://community.sendbird.com/u/Sandor_Fulop)\
**Post date:** [January 4, 2022, 1:28pm UTC](https://community.sendbird.com/t/ticket-not-updating-after-closed-by-agent/620/7 "2022-01-04T13:28:38Z")

</div>

This topic is 1 and half year old, but I came to the same situation. I don’t understand how should I handle if a ticket is closed. Even the [Sendbird Desk for JavaScript sample](https://github.com/sendbird/quickstart-desk-javascript) doesn’t handle if an agent closes a ticket. But we need to delete a closed ticket from the opened ticket list.

As I “debugged” until now, I get 2 events in `onMessageReceived` (which relevant props are):

1. `message.customType: ''`  
`message.data.type: 'NOTIFICATION_MANUAL_CLOSED'`
2. `message.customType: 'SENDBIRD_DESK_ADMIN_MESSAGE_CUSTOM_TYPE'`  
`message.data.type: 'SYSTEM_MESSAGE_TICKET_CLOSED_BY_AGENT'`

So I guess I have to use the second one to update the list. Can someone confirm this? Can someone provide also a code sample how should we use this?
