GetPostAnalytics icon
Script icon
Process icon
DiscordIncomingWebhook icon
Schedule icon

LinkedIn Weekly Social Report with Computed Averages

Automate a weekly LinkedIn report with Kestra. Fetch post reactions, compute average engagement in Python, and send the digest to Discord on Fridays.

Categories
Business

A weekly social report should write itself. This blueprint fetches reaction analytics for the week's LinkedIn posts with io.kestra.plugin.linkedin.GetPostAnalytics, passes the totalPosts and totalReactions scalars into a small Python step that computes the average reactions per post, and sends the digest to Discord every Friday afternoon. Raw totals say how loud the week was, the average says whether the content actually got better.

How it works

  1. fetch_analytics (io.kestra.plugin.linkedin.GetPostAnalytics) pulls reaction data for every URN in the activity_urns input and exposes totalPosts and totalReactions as scalar outputs alongside the per-post posts array.
  2. compute_stats (io.kestra.plugin.scripts.python.Script on the Process task runner) receives the two totals as environment variables, computes the average reactions per post, and emits avg_reactions through Kestra's ::outputs:: protocol, making it available as {{ outputs.compute_stats.vars.avg_reactions }}.
  3. send_report posts the three scalars, posts, reactions, and average, to Discord in one line.
  4. The errors block sends a distinct Discord alert when any step fails, so Friday never ends without either the report or the reason it is missing.
  5. A disabled-by-default Schedule trigger runs the report every Friday at 16:00.

What you get

  • A weekly engagement digest that arrives on schedule with zero manual collection.
  • A computed quality metric, average reactions per post, next to the raw volume numbers.
  • A division-by-zero guard, a week with no posts reports an average of 0 instead of failing.
  • A Python step ready to grow, add medians, week-over-week deltas, or targets without touching the fetch.

Who it's for

  • Marketing leads who open Monday planning with last week's engagement numbers.
  • Social media managers proving content improvements with a per-post average, not just totals.
  • Small teams that want reporting automated before they hire an analyst.

Why orchestrate this with Kestra

The report is three concerns glued together, an authenticated API call, a computation, and a notification. Kestra keeps each one a separate, replaceable task, moves the values between them as typed outputs, runs the chain on a schedule, and records every week's numbers in the execution history.

Prerequisites

  • A LinkedIn Developer application and a valid OAuth2 access token with permission to read reactions.
  • Python 3 available on the Kestra host, the computation uses only the standard library on the Process task runner.
  • A Discord incoming webhook for the digest and failure alerts.

Secrets

  • LINKEDIN_ACCESS_TOKEN: OAuth2 access token sent as Bearer auth for LinkedIn REST API calls.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the two secrets to your Kestra namespace.
  2. Replace the default activity_urns values with the URNs of this week's posts.
  3. Execute the flow and check the Discord digest reports posts, reactions, and the average.
  4. Set disabled: false on the weekly trigger.

How to extend

  • Store each week's totals with io.kestra.plugin.core.kv.Set and add week-over-week deltas to the digest.
  • Reshape the per-post posts array for warehouse loading, as shown in the LinkedIn analytics to warehouse blueprint.
  • Chain the LinkedIn token refresh blueprint before the fetch so the Friday run never hits an expired token.
  • Update the URN list automatically by having your publishing flow append to a KV entry that this flow reads.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.