{"action":"closed","issue":{"url":"https://api.github.com/repos/Schmavery/facebook-chat-api/issues/410","repository_url":"https://api.github.com/repos/Schmavery/facebook-chat-api","labels_url":"https://api.github.com/repos/Schmavery/facebook-chat-api/issues/410/labels{/name}","comments_url":"https://api.github.com/repos/Schmavery/facebook-chat-api/issues/410/comments","events_url":"https://api.github.com/repos/Schmavery/facebook-chat-api/issues/410/events","html_url":"https://github.com/Schmavery/facebook-chat-api/issues/410","id":211455696,"number":410,"title":"getThreadHistory into a file, load into socket","user":{"login":"troywingert21","id":16674013,"avatar_url":"https://avatars2.githubusercontent.com/u/16674013?v=3","gravatar_id":"","url":"https://api.github.com/users/troywingert21","html_url":"https://github.com/troywingert21","followers_url":"https://api.github.com/users/troywingert21/followers","following_url":"https://api.github.com/users/troywingert21/following{/other_user}","gists_url":"https://api.github.com/users/troywingert21/gists{/gist_id}","starred_url":"https://api.github.com/users/troywingert21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troywingert21/subscriptions","organizations_url":"https://api.github.com/users/troywingert21/orgs","repos_url":"https://api.github.com/users/troywingert21/repos","events_url":"https://api.github.com/users/troywingert21/events{/privacy}","received_events_url":"https://api.github.com/users/troywingert21/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-03-02T17:07:18Z","updated_at":"2017-03-02T19:59:14Z","closed_at":"2017-03-02T19:59:14Z","body":"I'm having difficulty loading the return of getThreadHistory into a file use fs.writeFile so that I can send it as a packet to my client. I understand that it returns an object with a bunch of information, I just don't know how to split it up. I just want the messages listed in a file. Here is my code:\r\n\r\n```javascript\r\napi.getThreadHistory(event.threadID, 0, 5, null, function(err, history){\r\n    if (err) throw err;\r\n\r\n    for (var j = history.length - 2; j >= 0; j--){\r\n        console.log(history[j]);\r\n        fs.writeFile(fileName, history[j] + \"\\r\\n\", (err) => { //Writes retieved data to a file\r\n            if(err) throw err;\r\n            console.log('It\\'s saved!');\r\n        });\r\n    }\r\n    //console.log(event.body);\r\n})\r\n```"}}
{"actor":{"display_login":"Schmavery"}}