How to Pull Your YouTube Channel Stats via the http Connector for a Weekly Report
Build a scheduled Spojit workflow that calls the YouTube Data API with the http connector, reshapes the raw metrics with json utilities, has an Agent-mode Connector node write a plain-language summary, then emails the report and posts it to Slack.
What This Integration Does
As a creator you want a steady read on how your channel is growing without logging into a dashboard every Monday. This workflow pulls your subscriber count, total views, and video count straight from the YouTube Data API, then turns those numbers into a short written recap you can skim in seconds. Spojit has no native YouTube tile, so the workflow reaches the YouTube Data API directly through the http connector using your own Google API key. That is the honest, supported pattern for any service without a native connector.
The workflow runs on a Schedule trigger (for example every Monday at 9am in your timezone). On each run it fetches the current channel statistics, reshapes them into a clean object with the json connector, asks an Agent-mode Connector node to compare this week to the numbers you supply and write a short summary, then fans the result out to two channels: a Send Email node and a Slack send-message call. The workflow holds no state of its own between runs. If you want week-over-week deltas, store last week's totals in a place the workflow can read (a row in a database, a record in your CRM via the http connector, and so on); each run is otherwise independent and safe to re-run.
Prerequisites
- A Google Cloud API key with the YouTube Data API v3 enabled, and your channel ID (the value beginning with
UC...). You can also resolve the ID from a username at build time. - An http connector connection (the http connector is built in and needs no auth; you pass your API key in the request itself).
- A Slack connection with permission to post to your target channel, plus the channel ID or name.
- Each email recipient added to your org allowlist under Settings → General → Email recipients, so the Send Email node can deliver.
- Optional: last week's subscriber and view totals available somewhere the workflow can read, if you want the summary to describe growth.
Step 1: Start the workflow on a Schedule trigger
Add a Trigger node and set its type to Schedule. Enter a 5-field cron expression and an IANA timezone. For a Monday-morning report use 0 9 * * 1 with a timezone such as Australia/Sydney or America/New_York. A single Schedule trigger can hold several schedules if you want both a weekly and a monthly run. The trigger output is { scheduledAt }, which you can reference downstream as {{ trigger.scheduledAt }} to stamp the report date.
Step 2: Fetch channel statistics with the http connector
Add a Connector node in Direct mode on the http connector and pick the http-get tool. Point it at the YouTube Data API channels endpoint, requesting the statistics and snippet parts. Set the URL and query parameters like this:
GET https://www.googleapis.com/youtube/v3/channels
?part=statistics,snippet
&id=UC_your_channel_id
&key={{ your_api_key }}
Store the result in an output variable such as channel. A successful response carries the figures you want under {{ channel.items.0.statistics }}, including subscriberCount, viewCount, and videoCount, plus the channel title under {{ channel.items.0.snippet.title }}. Keep the API key out of any logged or emailed text.
Step 3: Pull recent video stats (optional second http-get)
If you want the report to call out a recent upload, add a second Connector node in Direct mode on the http connector with http-get against the search and videos endpoints. First list your latest uploads:
GET https://www.googleapis.com/youtube/v3/search
?part=snippet&channelId=UC_your_channel_id
&order=date&type=video&maxResults=1&key={{ your_api_key }}
Then call https://www.googleapis.com/youtube/v3/videos with part=statistics,snippet and the returned videoId to read that video's viewCount, likeCount, and commentCount. Save it as latestVideo. Skip this step entirely if you only need channel-level numbers.
Step 4: Reshape the metrics with the json connector
The YouTube response is deeply nested and the counts arrive as strings. Add a Transform node, or a Connector node in Direct mode on the json connector, to pull out just the fields you need. Use the pick tool to keep the statistics object, or get to read a single nested value such as items.0.statistics.subscriberCount. A clean target shape for the summary step looks like this:
{
"channelTitle": "{{ channel.items.0.snippet.title }}",
"subscribers": "{{ channel.items.0.statistics.subscriberCount }}",
"views": "{{ channel.items.0.statistics.viewCount }}",
"videos": "{{ channel.items.0.statistics.videoCount }}",
"reportDate": "{{ trigger.scheduledAt }}"
}
Save the reshaped object as metrics. The json connector also offers merge if you want to fold latestVideo figures into the same object, and stringify if you need a compact text version for the email body.
Step 5: Write the summary with an Agent-mode Connector node
Add a Connector node in Agent mode. This is the AI that runs inside the workflow: give it the metrics object and ask it to write two or three sentences in plain language describing where the channel stands, and the growth versus last week if you passed in prior totals. A prompt such as: "Using {{ metrics }} and last week's subscriber total {{ lastWeek.subscribers }}, write a friendly two-sentence recap of channel growth for a creator. State the current subscriber count, total views, and the change since last week." To keep the output predictable for the email and Slack steps, attach a Response Schema so the node returns structured JSON, for example:
{
"headline": "string",
"summary": "string",
"subscriberDelta": "number"
}
Save the result as report. You can scaffold this whole node by describing it to Miraxa, the intelligent layer across your automation, then fine-tune the prompt and schema in the properties panel.
Step 6: Email the report with a Send Email node
Add a Send Email node. It sends from Spojit's built-in mail service, so no connection is needed. Set Recipients to your own address (comma-separated for a team), a templated Subject such as Weekly YouTube report: {{ metrics.channelTitle }}, and a Body built from the agent output:
{{ report.headline }}
{{ report.summary }}
Subscribers: {{ metrics.subscribers }}
Total views: {{ metrics.views }}
Videos published: {{ metrics.videos }}
Report date: {{ metrics.reportDate }}
Set If sending fails to Continue anyway if you would rather still post to Slack when email delivery has a problem. Remember that only upstream variables resolve in the body, and recipients must be on the org allowlist.
Step 7: Post the same recap to Slack
Add a Connector node in Direct mode on the Slack connector and pick the send-message tool. Set the channel to your target channel ID or name and build the message text from the agent output:
:bar_chart: *{{ metrics.channelTitle }} weekly recap*
{{ report.summary }}
Subs: {{ metrics.subscribers }} | Views: {{ metrics.views }}
If you want email and Slack to run side by side rather than one after the other, drop both into a Parallel node so the report goes out on both channels at once.
Tips
- The YouTube Data API enforces a daily quota. A weekly run that makes one or two
http-getcalls uses almost nothing, so there is plenty of headroom even if you add more endpoints. - Statistic counts come back as strings. Convert them with the math connector or a Transform node before doing any subtraction for week-over-week deltas.
- Use the json connector's
pickorgettool early so the Agent-mode node only ever sees the few fields it needs; smaller input keeps the AI step fast and cheap. - If
subscriberCountis hidden on your channel, YouTube omits it from the response. Default it in your Transform step so the email never shows a blank.
Common Pitfalls
- Forgetting to enable YouTube Data API v3 on your Google Cloud project returns a 403. Enable the API and confirm the key has no referrer or IP restriction that blocks server-side calls.
- Passing a channel handle (the
@nameform) where the API expects theUC...channel ID returns an emptyitemsarray. Resolve the ID once and hardcode it, or look it up via theforUsernameparameter. - Cron without a timezone runs in an unexpected zone. Always set the IANA timezone on the Schedule trigger so 9am means 9am where you are.
- Slack
send-messagefails if the connection cannot post to the chosen channel. Invite the connection to private channels first, and double-check the channel ID.
Testing
Before turning the schedule on, switch the trigger to Manual (or add a temporary Manual trigger) and run the workflow once with the Run button. Inspect the execution to confirm the http-get call returned real statistics, the json step produced a clean metrics object, and the Agent-mode node wrote a sensible summary. Point the Send Email node at your own address and post Slack to a private test channel first. Once the numbers and wording look right, switch back to the Schedule trigger and enable the workflow.