0

I am polling a url for notifications in gupshup, and after i got a notification,i am doing context.sendResponse to display it on bot.But after context.sendResponse, further notifications are listened and i can see those notifications in logs but they are not displayed into bot eventhough context.sendResponse is provided.How can we resolve this or how we can do polling effectively using gupshup

    function pollForNotifications(context, XMLHttpRequest, to_json) {
        timer = setInterval(function() {
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function() {
                if (this.readyState === 4) {
                    to_json(this.responseText, function(error, data) {
                        var json = data.rss.channel.item;
                        if (lastRecievedData == null) {
                            //some logic 
                            context.sendResponse(info); 
                        } else {
                            //some logic 
                            context.sendResponse(info);
                        }
                    });
                }
            };
            xhr.open("GET", "rally1.rallydev.com/slm/rss/notifications/All.rss");
            xhr.send();
        }, 5000);
    }

I am polling rally for notifications and after i get a response i am displaying it on bot. When a bot is started, it listens to notifications and notifications are displayed on bot. Further notifications are recieved and i can check those recieved notifications in log and log says response has been sent to bot and still bot doesnt displays any response

0 Answers0