Newbie help - If/Then

Wondering if I can simplify my project just a bit. Right now, I have two different flows that take HTTP IN and then execute a shell script on the server:
image

image

I'm wondering if it would instead be possible to have a single HTTP in, then something that does an if/then evaluation of the payload, then depending on the contents of the payload, execute different shell scripts.

For example, I send HTTP POST to my HTTP IN with either Driveway, Porch, or Garage.

A middle step parses the message and then passes it along to the final step, the appropriate exec step:
If Driveway, exec driveway.sh
Else If Porch, exec porch.sh
Else If Garage, exec garage.sh.

Does that make sense? Currently I'm able to accomplish what I want with multiple flows, but I'd love to be able to just have it on one.

There are two ways I can see.

I've posted an example of both.

You use the switch node.

To help keep things separate I used the msg.topic for identifying from where the message comes.
That way the payload can be used for things like pictures.

[{"id":"1c6296dd.e816d1","type":"inject","z":"8ca77c0a.a59f98","name":"Garage","topic":"Garage","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1650,"wires":[["372f17e.e70cd68"]]},{"id":"af33861a.38d88","type":"inject","z":"8ca77c0a.a59f98","name":"Driveway","topic":"Driveway","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":1690,"wires":[["372f17e.e70cd68"]]},{"id":"295831cb.18de26","type":"inject","z":"8ca77c0a.a59f98","name":"Porch","topic":"Porch","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1730,"wires":[["372f17e.e70cd68"]]},{"id":"372f17e.e70cd68","type":"switch","z":"8ca77c0a.a59f98","name":"Garage?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Garage","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":1650,"wires":[["89e29418.88e7c8"],["4773d6f6.2604b8"]]},{"id":"4773d6f6.2604b8","type":"switch","z":"8ca77c0a.a59f98","name":"Driveway?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Driveway","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":1650,"wires":[["269dc0c4.414e2"],["bd098880.5fb478"]]},{"id":"89e29418.88e7c8","type":"function","z":"8ca77c0a.a59f98","name":"Garage stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":1570,"wires":[[]]},{"id":"269dc0c4.414e2","type":"function","z":"8ca77c0a.a59f98","name":"Driveway stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":860,"y":1570,"wires":[[]]},{"id":"bd098880.5fb478","type":"function","z":"8ca77c0a.a59f98","name":"Porch stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":1710,"wires":[[]]},{"id":"a82bdecf.74f0f","type":"inject","z":"8ca77c0a.a59f98","name":"Garage","topic":"Garage","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1820,"wires":[["faa38409.885988"]]},{"id":"a8c82b.7bb3a7d8","type":"inject","z":"8ca77c0a.a59f98","name":"Driveway","topic":"Driveway","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":1860,"wires":[["faa38409.885988"]]},{"id":"f08bd293.a43538","type":"inject","z":"8ca77c0a.a59f98","name":"Porch","topic":"Porch","payload":"message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1900,"wires":[["faa38409.885988"]]},{"id":"faa38409.885988","type":"switch","z":"8ca77c0a.a59f98","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Driveway","vt":"str"},{"t":"eq","v":"Garage","vt":"str"},{"t":"eq","v":"Porch","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":460,"y":1860,"wires":[["7b129912.03926"],["5ed848ad.2d684"],["8d58275c.ddae98"]]},{"id":"7b129912.03926","type":"function","z":"8ca77c0a.a59f98","name":"Garage stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":1810,"wires":[[]]},{"id":"5ed848ad.2d684","type":"function","z":"8ca77c0a.a59f98","name":"Driveway stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1860,"wires":[[]]},{"id":"8d58275c.ddae98","type":"function","z":"8ca77c0a.a59f98","name":"Porch stuff","func":"\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":1920,"wires":[[]]}]

That is a basic idea.
Option 1 you only look for one match in the switch node.
Option 2 you split/search for all three and route the message as needed.

Hope that helps.