Legacy Dev Forum Posts

 View Only

Sign Up

Conversation Notifications Help

  • 1.  Conversation Notifications Help

    Posted 06-05-2025 18:04

    canderson | 2016-08-31 20:28:04 UTC | #1

    I'm trying to get some notifications configured in the C# SDK using the new NotificationHelper and I'm having some problems. Perhaps somebody can help me nail down the issue I'm having. Here's my setup:

    • A queue was created in PureCloud with a single user in the queue (me).
    • I have a console app running which uses Client Credentials and the NotificationHelper to subscribe to the following topics (where {id} is my user id):
    • v2.users.{id}.presence
    • v2.users.{id}.conversations
    • I have another application running that lets me put in a phone number and it inserts a callback into the queue.

    When I manually change my presence, the notification fires successfully and everything works.

    When I place the callback into the queue, it works. It calls my cell phone (which is the one connected to my user in PureCloud) and it calls my work phone (which is the "customer", in this case). It connects successfully. But no notifications are received. I don't get any notifications for a presence change (though I don't know if I should, since I'm still marked as "On Queue", but I also don't get any notifications for the incoming call even though it's my user who answers the call and my user that is subscribed in the topic.

    Am I missing any steps here or misunderstanding how queues and user notifications work together?


    vrvoice1 | 2016-09-01 07:53:19 UTC | #3

    Are you getting any Exception?


    canderson | 2016-09-01 14:10:40 UTC | #4

    I believe I tracked down the issue. When I watch the actual WebSocket.OnMessage event in the NotificationHandler I do see that a notification comes through. It's failing when deserializing the object and does throw an exception. Unfortunately, because that happens in the NotificationHandler, the exception is caught and the "NotificationReceived" event is never fired so it's silent on the other end.

    The problem is related to deserializing the any number of time stamp properties. The exception is:

    {"Could not convert string to integer: 2016-09-01T13:43:42+0000. Path 'eventBody.participants[0].connectedTime', line 1, position 249."}

    This is happening all over the place. Many of the notifications models have "ConnectedTime", "EndTime", "DisconnectTime", and other time related properties set to the type of int?. The data being sent back in the notification is a full timestamp, which is what I would expect. The deserialization is breaking on all of these fields. I changed some of the types for some of the classes and it fixed those, so I'm pretty sure that's the problem, but further investigation shows that there are many ConversationNotification types and they all have time stamp fields that are typed as int?.

    I don't want to just fix them all myself and reference a local copy of the code because the API and this SDK are rapidly evolving and I fear I would just be introducing new issues or make it more difficult to keep up to date with newest features.


    tim.smith | 2016-09-01 14:20:55 UTC | #5

    That appears to be API-1831. The schemas that describe the notification topics are wrong. They define dates as integers, but they are sent as ISO-8601 timestamps, hence being unable to be deserialized. I've pinged the dev team about fixing the schema. If it can't be prioritized soon, I can manually fix it in the SDK.

    To work around this now, you can create your own classes for deserialization and use them instead (i.e. copy the existing classes you need, fix them, and rename them for your use).


    tim.smith | 2016-09-01 14:55:46 UTC | #6

    The fix for API-1831 should make it to production next week.


    system | 2017-08-28 19:26:53 UTC | #7


    This post was migrated from the old Developer Forum.

    ref: 348