{"action":"created","issue":{"url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/11","repository_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot","labels_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/11/comments","events_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/11/events","html_url":"https://github.com/guidone/node-red-contrib-chatbot/issues/11","id":174825615,"number":11,"title":"Cannot access chat object in subflow","user":{"login":"BrandonSmith","id":10338,"avatar_url":"https://avatars.githubusercontent.com/u/10338?v=3","gravatar_id":"","url":"https://api.github.com/users/BrandonSmith","html_url":"https://github.com/BrandonSmith","followers_url":"https://api.github.com/users/BrandonSmith/followers","following_url":"https://api.github.com/users/BrandonSmith/following{/other_user}","gists_url":"https://api.github.com/users/BrandonSmith/gists{/gist_id}","starred_url":"https://api.github.com/users/BrandonSmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrandonSmith/subscriptions","organizations_url":"https://api.github.com/users/BrandonSmith/orgs","repos_url":"https://api.github.com/users/BrandonSmith/repos","events_url":"https://api.github.com/users/BrandonSmith/events{/privacy}","received_events_url":"https://api.github.com/users/BrandonSmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/labels/bug","name":"bug","color":"ee0701"}],"state":"open","locked":false,"assignee":{"login":"guidone","id":502519,"avatar_url":"https://avatars.githubusercontent.com/u/502519?v=3","gravatar_id":"","url":"https://api.github.com/users/guidone","html_url":"https://github.com/guidone","followers_url":"https://api.github.com/users/guidone/followers","following_url":"https://api.github.com/users/guidone/following{/other_user}","gists_url":"https://api.github.com/users/guidone/gists{/gist_id}","starred_url":"https://api.github.com/users/guidone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidone/subscriptions","organizations_url":"https://api.github.com/users/guidone/orgs","repos_url":"https://api.github.com/users/guidone/repos","events_url":"https://api.github.com/users/guidone/events{/privacy}","received_events_url":"https://api.github.com/users/guidone/received_events","type":"User","site_admin":false},"assignees":[{"login":"guidone","id":502519,"avatar_url":"https://avatars.githubusercontent.com/u/502519?v=3","gravatar_id":"","url":"https://api.github.com/users/guidone","html_url":"https://github.com/guidone","followers_url":"https://api.github.com/users/guidone/followers","following_url":"https://api.github.com/users/guidone/following{/other_user}","gists_url":"https://api.github.com/users/guidone/gists{/gist_id}","starred_url":"https://api.github.com/users/guidone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidone/subscriptions","organizations_url":"https://api.github.com/users/guidone/orgs","repos_url":"https://api.github.com/users/guidone/repos","events_url":"https://api.github.com/users/guidone/events{/privacy}","received_events_url":"https://api.github.com/users/guidone/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/milestones/1","html_url":"https://github.com/guidone/node-red-contrib-chatbot/milestones/0.5.9","labels_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/milestones/1/labels","id":1983303,"number":1,"title":"0.5.9","description":null,"creator":{"login":"guidone","id":502519,"avatar_url":"https://avatars.githubusercontent.com/u/502519?v=3","gravatar_id":"","url":"https://api.github.com/users/guidone","html_url":"https://github.com/guidone","followers_url":"https://api.github.com/users/guidone/followers","following_url":"https://api.github.com/users/guidone/following{/other_user}","gists_url":"https://api.github.com/users/guidone/gists{/gist_id}","starred_url":"https://api.github.com/users/guidone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidone/subscriptions","organizations_url":"https://api.github.com/users/guidone/orgs","repos_url":"https://api.github.com/users/guidone/repos","events_url":"https://api.github.com/users/guidone/events{/privacy}","received_events_url":"https://api.github.com/users/guidone/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-09-05T08:07:38Z","updated_at":"2016-09-05T08:07:38Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-09-02T18:52:57Z","updated_at":"2016-09-05T15:05:07Z","closed_at":null,"body":"I attempting to access the chat object that should be available in the flow context from within a subflow. Being a node-red newbie, I'm not even sure a subflow can access the flow context. My function node starts with the following:\r\n```\r\nvar chatId = msg.originalMessage.chat.id // chatId exists\r\nvar chat = flow.get('chat:'+chatId) // chat is undefined\r\n```\r\nA chatbot listen node is the first node in the subflow and seems to access the flow context just fine. The listen properly responds to the configured tokens.\r\n\r\nWhat am I missing?"},"comment":{"url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/comments/244767293","html_url":"https://github.com/guidone/node-red-contrib-chatbot/issues/11#issuecomment-244767293","issue_url":"https://api.github.com/repos/guidone/node-red-contrib-chatbot/issues/11","id":244767293,"user":{"login":"guidone","id":502519,"avatar_url":"https://avatars.githubusercontent.com/u/502519?v=3","gravatar_id":"","url":"https://api.github.com/users/guidone","html_url":"https://github.com/guidone","followers_url":"https://api.github.com/users/guidone/followers","following_url":"https://api.github.com/users/guidone/following{/other_user}","gists_url":"https://api.github.com/users/guidone/gists{/gist_id}","starred_url":"https://api.github.com/users/guidone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidone/subscriptions","organizations_url":"https://api.github.com/users/guidone/orgs","repos_url":"https://api.github.com/users/guidone/repos","events_url":"https://api.github.com/users/guidone/events{/privacy}","received_events_url":"https://api.github.com/users/guidone/received_events","type":"User","site_admin":false},"created_at":"2016-09-05T15:05:07Z","updated_at":"2016-09-05T15:05:07Z","body":"The node context is available just in the node, and is cleared every time the node is redeployed.\r\nFlow context is available for all nodes of the flow but not subflow, it's cleared when the flow is redeployed.\r\nGlobal is available for every flow.\r\n\r\nI'm not sure about what is the idiomatic way but \r\n- it's ok to store chat data in the global context, generally in hosted environment like FRED, they run multiple instance of Node-Red for different customers, so any sensitivie information that might be stored in global context is not exposed\r\n- it's better to store in chat context the results of parsing, etc in order to not mix informations of concurrent users of the chat bot\r\n\r\nI've a branch ready for that, it moves the chat context under the global context, so it's available via script in subflows\r\n\r\n```\r\n// get the chat context\r\nvar chatId = msg.originalMessage.chat.id\r\nvar chat = context.global.get('chat:' + chatId);\r\n```\r\n\r\nUnfortunately it's a breaking change, I'll push in a while with a beta release tag, I'll keep you posted.\r\n"}}
{"actor":{"display_login":"guidone"}}