Trey
Templates by Trey
Send email via Gmail on workflow error
Send an email via Gmail when a workflow error occurs. The email subject line will contain the workflow name; the message body will contain the following information: Workflow name Error message Last node executed Execution URL Stacktrace Error workflows do not need to be activated in order to be used, but they do need to be selected in the Settings menu of whatever workflows you want to use it. To use this workflow, you'll need to: Create and select credentials in the Gmail node Choose the email recipient(s) in the Gmail node Save and select the created workflow as the "Error Workflow" in the Settings menu of whatever workflows you want to email on error
Archive Spotify's discover weekly playlist
This workflow will archive your Spotify Discover Weekly playlist to an archive playlist named "Discover Weekly Archive" which you must create yourself. If you want to change the name of the archive playlist, you can edit value2 in the "Find Archive Playlist" node. It is configured to run at 8am on Mondays, a conservative value in case you forgot to set your GENERIC_TIMEZONE environment variable (see the docs here). Special thanks to erin2722 for creating the Spotify node and harshil1712 for help with the workflow logic. To use this workflow, you'll need to: Create then select your credentials in each Spotify node Create the archive playlist yourself Optionally, you may choose to: Edit the archive playlist name in the "Find Archive Playlist" node Adjust the Cron node with an earlier time if you know GENERIC_TIMEZONE is set Setup an error workflow like this one to be notified if anything goes wrong
Get local datetime into Function node using moment.js
A quick example showing how to get the local date and time into a Function node using moment.js. This relies on the GENERIC_TIMEZONE environment variable being correctly configured (see the docs here) NOTE: In order for this to work, you must whitelist the moment library for use by setting the following environment variable: bash NODEFUNCTIONALLOW_EXTERNAL=moment For convenience, the Function code is as follows: javascript const moment = require('moment'); let date = moment().tz($env['GENERIC_TIMEZONE']); let year = date.year(); let month = date.month(); // zero-indexed! let day = date.date(); let hour = date.hours(); let minute = date.minutes(); let second = date.seconds(); let millisecond = date.millisecond(); let formatted = date.format('YYYY-MM-DD HH:mm:ss.SSS Z'); return [ { json: { utc: date, year: year, month: month, // zero-indexed! day: day, hour: hour, minute: minute, second: second, millisecond: millisecond, formatted: formatted } } ];