Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  unable to receive event notification

    Posted 05-22-2025 15:39
    Edited by Rajeev Gupta 05-22-2025 15:40

    I have subscribed the event topics using NotificationHandler(dotnet/C#) which is not working, but other notification topics working fine like agent activity, queue observations 
    see the below code for event subscriptions & receive response :

    var handler = new NotificationHandler();
    Console.WriteLine("Challnel Id : " + handler.Channel.Id);
    var IdList = new List<string>();
    // Agent ID
    IdList.Add("fdsafdsafdsafdsafdsafdsafdsafdsafdasfdsafd");
    IdList.Add("fdsafdsafdsafdsafdsafdsafdsafdsafdasfdsafd");
    AddRemoveTopics.SubscribeAgentActivityTopics(handler, IdList);
    // Queue subscription
    IdList = new List<string>();
    IdList.Add("dsafdsafdsafdsafdsafdsafdsafdsafdasfdsafd");
    IdList.Add("dsafdsafdsafdsafdsafdsafdsafdsafdasfdsafd");
    IdList.Add("dsafdsafdsafdsafdsafdsafdsafdsafdasfdsafd");
    AddRemoveTopics.SubscribeQueueConversationsCallTopics(handler, IdList); //Conversation call topics subscription  eg:  handler.AddSubscription($"v2.routing.queues.{queueid}.conversations.calls", typeof(QueueConversationCallEventTopicCallConversation));
    AddRemoveTopics.SubscribeQueueObservation(handler, IdList); // Queue observations subscription eg handler.AddSubscription($"v2.analytics.queues.{queueid}.observations", typeof(StatEventQueueTopicStatsNotification)); 

    // Handling the response 

    handler.NotificationReceived+= (data) =>
    {

    if (data.GetType() == typeof(NotificationData<AgentActivityChangedTopicAgentActivity>)

    {

    // working fine 

    }

    else if (data.GetType() == typeof(NotificationData<QueueConversationCallEventTopicCallConversation>))
    {
                    var conversation = (NotificationData<QueueConversationCallEventTopicCallConversation>)data;

                     // Realtime notification topics subscriptions using conversation id 

                      if (convID != ConversationId)
                      {
                          convID = ConversationId;
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.acw", typeof(AcwDetailEventTopicAfterCallWorkEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.acd.start", typeof(AcdStartDetailEventTopicAcdStartEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.acd.end", typeof(AcdEndDetailEventTopicAcdEndEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.user.end", typeof(UserEndDetailEventTopicUserEndEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.user.start", typeof(UserStartDetailEventTopicUserStartEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.customer.end", typeof(CustomerEndDetailEventTopicCustomerEndEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.customer.start", typeof(CustomerStartDetailEventTopicCustomerStartEvent));
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.wrapup", typeof(WrapupDetailEventTopicWrapupEvent));
                         }
                    Console.WriteLine($"Conversation ConversationCallEventTopicCallConversation call: {conversation.EventBody}");
                 
    // No issue with the real time subscription & queue conversation call topic also working fine 

    }

    else if (data.GetType() == typeof(NotificationData<AcwDetailEventTopicAfterCallWorkEvent>))
    {
                   // Not working
    }
    else if (data.GetType() == typeof(NotificationData<AcdStartDetailEventTopicAcdStartEvent>))
    {
                   // not working
    }
    else if (data.GetType() == typeof(NotificationData<AcdEndDetailEventTopicAcdEndEvent>))
    {
                  // not working
    }
    else if (data.GetType() == typeof(NotificationData<UserEndDetailEventTopicUserEndEvent>))
    {
                   //not working
    }
    else if (data.GetType() == typeof(NotificationData<UserStartDetailEventTopicUserStartEvent>))
    {
                    // Not working
    }
    else if (data.GetType() == typeof(NotificationData<CustomerEndDetailEventTopicCustomerEndEvent>))
    {
              // Not working
    }
    else if (data.GetType() == typeof(NotificationData<CustomerStartDetailEventTopicCustomerStartEvent>))
    {
                  // Not working 
    }

    else if (data.GetType() == typeof(NotificationData<WrapupDetailEventTopicWrapupEvent>))
    {
                    // Not working
    }

    };

    Apricate you help: 


    #PlatformAPI
    #PlatformSDK

    ------------------------------
    Rajeev Gupta
    ------------------------------



  • 2.  RE: unable to receive event notification

    Posted 05-28-2025 09:23

    Hi Rajeev,

    Did you try the API explorers' online event listening to see if the event itself is getting generated?   If you do not see an event there, then the event is never generated.  I doubt it is the SDK if you are getting other events and processing them successfully, as it is all the same code being used for event processing.


    Thanks,
         John



    ------------------------------
    John Carnell
    Director, Developer Engagement
    ------------------------------



  • 3.  RE: unable to receive event notification

    Posted 05-30-2025 10:47

    Hi John, 

    thanks for your reply, yes, I have tried with API explorers, getting the event notification in real time, but when my application not receiving, issue with event related topic notification other topic notification works fine. working on the customer requirement, raised the support ticket too.  

    referring Genesys document:  

    Using API Explorer



    ------------------------------
    Rajeev Gupta
    ------------------------------



  • 4.  RE: unable to receive event notification

    Posted 06-02-2025 03:29

    Hi Rajeev,
                  Which token is being used to recieve these notifications? are you using same user credentials that is used in api explorer or you are using  client credentials to generate the token?

    Thanks,
    Thirumurugan



    ------------------------------
    Thirumurugan Balamurugan
    Senior PS Consultant
    ------------------------------



  • 5.  RE: unable to receive event notification

    Posted 06-02-2025 14:22

    Hi Thirumurugan,


    I am using client credentials to generate the token.



    ------------------------------
    Rajeev Gupta
    ------------------------------



  • 6.  RE: unable to receive event notification

    Posted 06-03-2025 11:29

    There you go. The token which you in api explorer is different from token you used in your code. So mostly if you assign appropriate roles and permission to the client credentials, then it should work

    Thanks,
    Thirumurugan



    ------------------------------
    Thirumurugan Balamurugan
    Senior PS Consultant
    ------------------------------



  • 7.  RE: unable to receive event notification

    Posted 06-09-2025 09:32

    Hello Thirumurugan,

    I have verified i, suggested permission as per Genesys document already have, please see the attached image. 



    ------------------------------
    Rajeev Gupta
    ------------------------------



  • 8.  RE: unable to receive event notification

    Posted 06-18-2025 08:42

    Hello Thirumurugan,

    please guide, how can proceed, already verified the client have necessary permission.



    ------------------------------
    Rajeev Gupta
    ------------------------------



  • 9.  RE: unable to receive event notification

    Posted 07-03-2025 02:16

    Hello Rajeev,

    I replicated your scenario and I was able to obtain notifications from the event topics having a similar scenario as yours.

    What I detected in your code is that the ConversationId is not correctly obtained.

    In your code:

    else if (data.GetType() == typeof(NotificationData<QueueConversationCallEventTopicCallConversation>))
    {
                    var conversation = (NotificationData<QueueConversationCallEventTopicCallConversation>)data;

     
    You are not extracting the conversationId from the event body, you will need to extract the conversationId as follows:
       var ConversationId = conversation.EventBody.Id;

    Your code should look like:

    else if (data.GetType() == typeof(NotificationData<QueueConversationCallEventTopicCallConversation>))
    {
                    var conversation = (NotificationData<QueueConversationCallEventTopicCallConversation>)data;

                     var ConversationId = conversation.EventBody.Id;

                     // Realtime notification topics subscriptions using conversation id 

                      if (convID != ConversationId)
                      {
                          convID = ConversationId;
                          handler.AddSubscription($"v2.detail.events.conversation.{ConversationId}.acw", typeof(AcwDetailEventTopicAfterCallWorkEvent));

    Hopefully this works for you.



    ------------------------------
    Jose Manuel Millan
    Technical Support Engineer
    ------------------------------