Closed nicpottier closed 6 years ago
For reference this is what that looks like in the current expression engine https://github.com/rapidpro/expressions/blob/master/python/temba_expressions/evaluator.py#L307
Ya, that's one approach is to try to evaluate everything you can then return a new template. I haven't convinced myself that that is always right given that what a variable evaluates to is context dependent. (say based on what function it is being used with)
Need to think through some of the weirder edge cases.
So here's a bold thought - what if interacting with (e.g. messaging) other contacts (besides the contact) within a flow has always been a bit of a hack, and a better solution would be say that you can only trigger new flow sessions for other contacts?
Otherwise I can't think of any mechanism that avoids sending a template back to the container and saying you need to evaluate this... which really is the job of the flow engine.
If you want to message a group from a flow - then start that group in a new flow which sends that message.
That's not a bad idea, fits the everything is a flow model, though with that comes all the baggage of interrupting people in flows which we still (STILL) don't have a good story for. If we could solve that then I could see that being a reasonable strategy. Would have to glance at current usage to see how popular group messaging really is.
We just chatted about this and current preferred solution is to allow messages to be sent to other contacts, but @contact
is still the flow contact and we'd get rid of @step.contact
. This would make it behave similarly to the send_email.
No group messages, only flow starts.
Likely solution is something where we return a context of the flow at that place and it is up to container to deal with substituting contact vars