{"action":"created","issue":{"url":"https://api.github.com/repos/rapidpro/rapidpro/issues/1023","repository_url":"https://api.github.com/repos/rapidpro/rapidpro","labels_url":"https://api.github.com/repos/rapidpro/rapidpro/issues/1023/labels{/name}","comments_url":"https://api.github.com/repos/rapidpro/rapidpro/issues/1023/comments","events_url":"https://api.github.com/repos/rapidpro/rapidpro/issues/1023/events","html_url":"https://github.com/rapidpro/rapidpro/issues/1023","id":483064003,"node_id":"MDU6SXNzdWU0ODMwNjQwMDM=","number":1023,"title":"Triggers are flows","user":{"login":"nicpottier","id":168067,"node_id":"MDQ6VXNlcjE2ODA2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/168067?v=4","gravatar_id":"","url":"https://api.github.com/users/nicpottier","html_url":"https://github.com/nicpottier","followers_url":"https://api.github.com/users/nicpottier/followers","following_url":"https://api.github.com/users/nicpottier/following{/other_user}","gists_url":"https://api.github.com/users/nicpottier/gists{/gist_id}","starred_url":"https://api.github.com/users/nicpottier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicpottier/subscriptions","organizations_url":"https://api.github.com/users/nicpottier/orgs","repos_url":"https://api.github.com/users/nicpottier/repos","events_url":"https://api.github.com/users/nicpottier/events{/privacy}","received_events_url":"https://api.github.com/users/nicpottier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-08-20T20:22:53Z","updated_at":"2019-08-20T21:54:43Z","closed_at":null,"author_association":"MEMBER","body":"Recent ticket by Leah by someone who wanted a trigger keyword for people that weren't in a group, as well as any number of permutations of triggers around channels, words, group memberships and soon to be NLP classifiers had me wondering whether we could take a totally different approach.\r\n\r\nWhat if we had two system flows that represented triggers for contacts active in flows and not active in flows?\r\n\r\nThe flow would have to have restrictions on it, basically couldn't send messages but could have a \"start_session\" action.\r\n\r\nMailroom would run the appropriate flow before handling any message and if the events that came back included a start_session event, then interrupt any other runs and start the contact in that session. We wouldn't necessarily record or start the sessions and runs created by these in the same way so as not to confuse things.\r\n\r\nI think we would keep a similar UI as we have today for managing things for basic users but could let them opt in to instead having this kind of \"trigger flow\". Once they opt in then they are in charge of managing that flow, etc..\r\n\r\nAdvantages:\r\n\r\nAllows for any kind of logic you want around interrupting a user out of a flow based on something they send. You can use NLP, webhooks, group or channel memberships etc..\r\nAs we add more things to flows triggers get more powerful too\r\nLess logic, everything is a flow\r\nDisadvantages:\r\n\r\nPerformance? I think if we limit the writing of these results then I'm not sure there's much of a performance hit, running a flow is very fast when you don't hit the DB\r\nIf we don't log due to performance, then figuring out why someone did something could get complicated. Perhaps we only log when we DO trigger which should be fewer times."},"comment":{"url":"https://api.github.com/repos/rapidpro/rapidpro/issues/comments/523210322","html_url":"https://github.com/rapidpro/rapidpro/issues/1023#issuecomment-523210322","issue_url":"https://api.github.com/repos/rapidpro/rapidpro/issues/1023","id":523210322,"node_id":"MDEyOklzc3VlQ29tbWVudDUyMzIxMDMyMg==","user":{"login":"ericnewcomer","id":211652,"node_id":"MDQ6VXNlcjIxMTY1Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/211652?v=4","gravatar_id":"","url":"https://api.github.com/users/ericnewcomer","html_url":"https://github.com/ericnewcomer","followers_url":"https://api.github.com/users/ericnewcomer/followers","following_url":"https://api.github.com/users/ericnewcomer/following{/other_user}","gists_url":"https://api.github.com/users/ericnewcomer/gists{/gist_id}","starred_url":"https://api.github.com/users/ericnewcomer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericnewcomer/subscriptions","organizations_url":"https://api.github.com/users/ericnewcomer/orgs","repos_url":"https://api.github.com/users/ericnewcomer/repos","events_url":"https://api.github.com/users/ericnewcomer/events{/privacy}","received_events_url":"https://api.github.com/users/ericnewcomer/received_events","type":"User","site_admin":false},"created_at":"2019-08-20T21:54:43Z","updated_at":"2019-08-20T21:54:43Z","author_association":"MEMBER","body":"Really like the idea of everything is a flow! From a UI perspective, as @nicpottier said we can actually keep the same UI but with an escape hatch to edit the flow directly. We actually sort of already do that with the group join trigger. Abstracting triggers to a pre-flight flow feels pretty powerful and even jives with ideas around pre-flight flows for simulation."}}
{"actor":{"display_login":"ericnewcomer"}}