Customize payload for different steps in workflow
Is there any way I can handle the payload for different steps in a workflow? Like for first push i want to set "title" different from second push. I'm using nodejs sdk.
Solution:Jump to solution
Thats not the issue im able to get the redirect url. im using custom url field in the payload. But when i have configured more than 1 push steps in one workflow all the push steps are getting same url. Is there any way to control the individual payload of a particular step when triggering the workflow?
13 Replies
Hi @Rahul-evolvier, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* NodeJS SDK
* Custom Action Step
* Onesignal
* Feature: Add Nodejs SDK methods for Workflow Overrides API
-----------------------------
Answer
Yes, you can customize the payload for different steps in a workflow using Novu's Node.js SDK. This can be achieved using the custom action step feature, where you can define custom logic that can modify or set different payload properties for each step in your workflow. Here's a detailed example to show how you can execute custom logic and use its result in subsequent steps, which could include setting a different "title" for each push:
(1)
This custom step allows you to execute any custom logic, including modifying the payload to suit your needs for each step within the workflow. You can then use the result of this custom step in the resolver functions of subsequent steps or actions.
Keep in mind, this is a generic example to illustrate the approach. You'll need to adapt it based on your specific workflow and the kind of payload adjustments you wish to accomplish for each step.
Got it. Tagging @Support for additional help.
Got it. Tagging @Support for additional help.
I have self hosted the app in docker
@Rahul-evolvier
Yes you can use different variables in those steps
My app uses a url field in push notifications to navigate to the relevant page. Is there any way to control the value of this field in different steps of a workflow?
currently we support title and message field imn push step
redirect url is provider specific and should be sent while triggering the workflow
https://docs.novu.co/channels-and-providers/push/fcm#sdk-trigger-example
Solution
Thats not the issue im able to get the redirect url. im using custom url field in the payload. But when i have configured more than 1 push steps in one workflow all the push steps are getting same url. Is there any way to control the individual payload of a particular step when triggering the workflow?
@Rahul-evolvier, you just advanced to level 2!
@Rahul-evolvier
Checkout this docs about variants
https://docs.novu.co/workflows/variants
In my opinion, this use case can be achieved using variants
I see in variants, step content will change
Sorry im not getting it. How can i change the payload content using variant?
There's only provision to add condition to execute that step or a variant of it right?
I see, variants allows you to create different versions of step havign different content based on some condtions,
but it will not solve your usecase.
could you help us by adding this in our roadmap?
Novu roadmap | Productlane
Find out what the Novu team is working on and leave your feedback - powered by Productlane