Reference

Source

A source connects to one social media provider, such as Instagram or YouTube, and fetches posts from it. Whenever you’re dealing with a source in your template, you’re working with a Source object. Fetch one by its handle, or get the sources in a feed with feed.getSources().

{% set source = craft.socialFeeds.getSourceByHandle('mySourceHandle') %}

{% if source and source.isConnected() %}
    {% for post in source.getPosts({ limit: 5 }) %}
        {{ post.getContent() }}
    {% endfor %}
{% endif %}

Properties

id

The ID of the source.

name

The name of the source, as shown in the control panel.

handle

The handle of the source, used to fetch it in templates and console commands.

enabled

Whether the source is enabled.

dateLastFetch

The date the source last fetched posts from its provider. This is null when the source hasn’t fetched yet or its cache was cleared.

providerName

The display name of the source’s provider, such as YouTube. This reads getProviderName().

providerHandle

The handle of the source’s provider, such as youTube. Posts from this source store it as their sourceType.

primaryColor

The provider’s brand colour as a hex value, such as #ff0000. This reads getPrimaryColor().

icon

The provider’s icon as SVG markup. This reads getIcon().

cpEditUrl

The URL to edit the source in the control panel.

Methods

isConfigured()

Returns whether the source has both a client ID and client secret saved.

isConnected()

Returns whether the source is connected to its provider with a saved access token.

getToken()

Returns the source’s saved access token, or null when it isn’t connected.

getPosts()

Returns: array|null

Returns the source’s Post objects. When the cache is enabled, posts come from the database and are refreshed from the provider once the cache duration has passed.

Last updated: Nov 13, 2026, 3:11:26 PM