Open brianehlert opened 8 years ago
In order to preserve backwards compatibility for triggers, we can also put the params in payload, that should keep it working for everyone else and be better moving forward.
Eventually we can deprecate and eventually remove the params
.
Deployed, triggers should now have payload
as well as params
.
Yeah, we have talked about this a lot. I wish there was a way to do it in general that wouldn't break backwards compatibility.
Give me a legacy option on triggers. Everything that already exists, gets it. Everything new, doesn't.
But, it is my option. So it is not automatically breaking.
We talked about that, too. But it might be jarring if, when working on an old flow, you add a new trigger and suddenly it works wildly differently than the others.
I've been working with flow-in-flow communication, which uses triggers to talk to each other. When a flow talks to another flow, the message comes in under the "payload" key! Now at least webhook triggers and device-to-flow trigger messages look similar.
@redaphid That is Great! That is a different bug that I put in a while back.
The following is interesting after a Trigger Node. Any idea how long this will go on? Or if I need to move from expecting Params to expecting Payload after a Trigger?
{ "msg": { "params": { "action": "exit", "device": "4865B07F-22A4-45E2-8820-364ADEA94F29", "lastname": "Ehlert", "twittername": "@brianehlert", "email": "brian.ehlert@citrix.com", "firstname": "Brian" }, "payload": { "action": "exit", "device": "4865B07F-22A4-45E2-8820-364ADEA94F29", "lastname": "Ehlert", "twittername": "@brianehlert", "email": "brian.ehlert@citrix.com", "firstname": "Brian" } }, "node": "1e30aed0-8a4d-11e5-9499-87ba5e9696de" }
There should be a standard message format for all messages that pass through. The annoyance is working with the key 'params' when following a trigger or working with 'payload' following a device. Not to mention that if you are building a device you can have all of your keys at the root of the message.
It would be more straightforward to simply drop the use of the 'params' and 'payload' keys and only have one message to work with. then there would not have to be additional discovery of keys, nested keys, a dot source path that works after a trigger but not after another node type, and so on.