How can I send different messages depending on the button pressed in Zapier, without having to use Path (only available from Professional Plan)?
Path is perfect if you are afraid to write code. But you can spare a lot of steps in your zap using the "Run Javascript" Action in Zapier.
Let's take an example. The following code in the "Run Javacript" Action will change the message depending on a combination of buttons pressed:
if ((inputData.button1 == "1") && (inputData.button3 == "1")) {
output = {message: "Nettoyage demandé"};
} else if ((inputData.button2 == "1") && (inputData.button3 == "1")) {
output = {message: "Rangement demandé"};
} else if ((inputData.button4 == "1") && (inputData.button3 == "1")) {
output = {message: "Vider les poubelles"};
} else if ((inputData.button5 == "1") && (inputData.button3 == "1")) {
output = {message: "Urgence"};
} else if (inputData.badge == "1") {
output = {message: "Demande traitée"};
} else {
output = {message:"void"};
}
The following action (for instance a SMS with Twilio) will be able to use the new "message" variable generated by this script.
If you want to change the destination number for each device, you can use the Google Sheet lookup action, using a variable "Action" to retrieve the correct number.
if ((inputData.button1 == "1") && (inputData.button3 == "1")) {
output = {message: "Nettoyage demandé", action: "action1"};
} else if ((inputData.button2 == "1") && (inputData.button3 == "1")) {
output = {message: "Rangement demandé, action: "action2"};
} else if ((inputData.button4 == "1") && (inputData.button3 == "1")) {
output = {message: "Vider les poubelles, action: "action3"};
} else if ((inputData.button5 == "1") && (inputData.button3 == "1")) {
output = {message: "Urgence", action: "action4"};
} else if (inputData.badge == "1") {
output = {message: "Demande traitée", action: "action5"};
} else {
output = {message:"void"};
}
Attached files: ZapierSmilioAction.png