feat(workflows): add Gmail sending and testing workflows

- Introduced a new `send-gmail` workflow for sending emails via Gmail SMTP, with configurable parameters for recipients, subject, and body content.
- Added a `test-send-gmail` workflow to facilitate testing the email sending functionality with sample data.
- Implemented a `track` workflow to monitor Gojek trips, enhancing the server's capabilities for tracking and notifications.
- Updated the workflow management interface to include new workflows and improved organization of existing scripts.

Co-authored-by: Nasyarobby Putra <nasyarobby@gmail.com>
This commit is contained in:
2026-08-15 18:33:13 +07:00
parent 94ba931d9b
commit 7fe5defc43
22 changed files with 2486 additions and 159 deletions
+9 -3
View File
@@ -114,13 +114,14 @@ async function fetchHttp(ctx) {
}
fetchHttp.meta = {
description: "Fetch a URL and store the response body as-is (JSON stays an object)",
description: "Fetch a URL and store the response body.",
config: {
url: { type: "string", required: true, description: "Request URL" },
method: {
type: "string",
default: "GET",
description: "HTTP method (GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS)",
enum: ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
description: "HTTP method",
},
headers: {
type: "object",
@@ -134,7 +135,12 @@ fetchHttp.meta = {
},
},
input: {
method: { type: "string", required: false, description: "Fallback when config.method is omitted" },
method: {
type: "string",
required: false,
enum: ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
description: "Fallback when config.method is omitted",
},
headers: {
type: "object",
required: false,
@@ -6,3 +6,6 @@ scripts:
- comic-monkeyuser-to-ntfy.yaml
- time-and-comic-to-ntfy.yaml
- rss-selfhst-to-ntfy.yaml
- send-gmail.yaml
- test-send-gmail.yaml
- track.yaml
@@ -0,0 +1,40 @@
name: send-gmail
description: |
Send email via Gmail SMTP. Configure user/from and the named secret,
then call from other workflows with trigger-workflow.js (name: send-gmail).
Input (data):
to optional recipient(s); defaults to your Gmail below
subject required
text plain body (aliases: body, message)
html optional HTML body
from, cc, bcc, replyTo, priority, headers optional
scripts:
- script: jsonata.js
config:
expression: |
{
"data": {
"to": $exists(to) ? to : "nasyarobby@gmail.com",
"from": from,
"subject": subject,
"text": $exists(text) ? text : ($exists(body) ? body : message),
"html": html,
"cc": cc,
"bcc": bcc,
"replyTo": replyTo,
"priority": priority,
"headers": headers
}
}
- script: send-email.js
config:
service: Gmail
user: elevent16th@gmail.com
from: elevent16th@gmail.com
passwordSecret: gmail_app_password
triggers:
- type: workflow
- type: HTTP
method: POST
path: /send-gmail
@@ -0,0 +1,18 @@
name: test-send-gmail
description: |
Kick send-gmail with sample data. Edit the payload below, then Run
(or POST /u/default/test-send-gmail).
scripts:
- script: trigger-workflow.js
config:
name: send-gmail
expression: |
{
"subject": "scrunner test",
"text": "Hello from test-send-gmail",
"html": "<p>Hello from <strong>test-send-gmail</strong></p>"
}
triggers:
- type: HTTP
method: POST
path: /test-send-gmail
@@ -0,0 +1,32 @@
name: Track Gojek Trip
scripts:
- script: fetch-http.js
config:
url: https://api.gojekapi.com/live/track/491c3132c2cc7043
method: GET
headers:
Content-Type: application/json
Accept: application/json
Origin: https://track.gojek.com
- script: fingerprint.js
config:
key: gojek-track-status
jsonata: data.httpResponse.status
- script: jsonata.js
config:
expression: |
{
"data": {
"title": httpResponse.customer_name,
"message": httpResponse.customer_name & " : " & httpResponse.status
}
}
- script: ntfy.js
config:
url: https://n.0dev.web.id/system
triggers:
- type: cron
schedule: "* * * * *"
- type: HTTP
method: GET
path: /new