We are loading yammer embedded feed on our page using an Open Graph snippet. We are attempting to load it on the window.onload event. Intermittently it seems to be throwing an HTTP 404. These are examples:

  1. "HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). POST - https://www.yammer.com/office365 "
  2. "HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR)GET - https://www.yammer.com/api/v1/open_graph_objects?url=myurl&properties%5Burl%5D=myurl&properties%5Btitle%5D=mytitle&properties%5Btype%5D=page&properties%5Bimage%5D=&properties%5Bdescription%5D=&properties%5Bsite_name%5D=&properties%5Bfetch%5D=true&properties%5Bignore_canonical_url%5D=false&properties%5Bprivate%5D=true&private=false&_=1556012959748 "

This is the snippet that we are using:

var attach = function () {
    var yammerGroupId = "";
    if (window.location.href.indexOf('mydomain.sharepoint.com') > 0) {
        yammerGroupId = 0000000;
    }
    else {
        yammerGroupId = 0000000;
    }
   
    myDescription = "";
    yam.connect.embedFeed({
        container: "#embedded-feed",
        feedType: "open-graph",
        config: {
            use_sso: true,
            header: false,
            footer: false,
            showOpenGraphPreview: false,
            defaultToCanonical: false,
            hideNetworkName: false,
            defaultGroupId: yammerGroupId,
            promptText: "Comment on this page..."
        },
        objectProperties: {
            type: "page",
            url:window.location.href,
            fetch: true,
            title:document.title,
            private: true,
            ignore_canonical_url: false,
            description: ""
        }
    });

}


if (window.addEventListener) {
    window.addEventListener('load', attach, false)
} else if (window.attachEvent) {
    window.attachEvent('onload', attach)
}

Please note that the Window onload is getting fired as expected. It works fine 7/10 times, but gives 404 error intermittently on Edge, IE, and Chrome.

1 Answers

0
Brian Lyttle On

It's expected that you get a 404 from /api/v1/open_graph_objects per the documentation when the URL passed as a parameter isn't an Open Graph Object (OGO) in the Yammer network. Check the URL parameter is actually valid.

For example, you set url: myUrl, but you are probably best to set this directly with "url": "window.location.href" since the value doesn't seem to be set right from your code. Use the configuration tool to work out better JavaScript to use since your code looks invalid.