Triggers and queries contain ingredients – individual pieces of data.
Some example ingredients from the Twitter - New tweet by you trigger:
- Text – The text of the tweet itself
- UserName – User name of the tweeter
- LinkToTweet – The URL of the tweet
- CreatedAt – Date and time the tweet was created
- TweetEmbedCode – The HTML embed code for the tweet
Normally, these are used directly in action fields:
However, if we want to make changes to an ingredient, we can do so with filter code.
For example, to switch the LinkToTweet ingredient from a twitter.com
URL to a vxtwitter.com
URL, we can use the below filter code:
var link = Twitter.newTweetByYou.LinkToTweet;
var vxLink = link.replace('twitter.com','vxtwitter.com');
Discord.postMessageToChannel.setMessage(vxLink);
This code adds 'vx' to the start of the LinkToTweet ingredient before setting the Discord - Post a message to a channel action's Message field to the updated URL.