Instagram Data Source
The Instagram data source allows you to fetch photos and videos from a public Instagram accounts or hashtags.
Instagram Feed
Usage
Add the instagram-feed
data source to your enpage.config.js
file.
javascript
import { defineDataSources } from "@enpage/sdk/datasources";
export const datasources = defineDataSources({
// Define a data source named "myfeed" using the "instagram-feed" provider
myfeed: {
name: "Instagram Feed",
provider: "instagram-feed",
options: {
// Instagram username or hashtag
username: "enpage.co",
// Number of posts to fetch
limit: 10
}
}
});
Schema
Note
The schema displayed below is for reference only. It does not need to be included in your project.
ts
import { Type, type Static } from "@sinclair/typebox";
export const instagramFeedSchema = Type.Object({
data: Type.Array(
Type.Object({
id: Type.String(),
caption: Type.String(),
timestamp: Type.String(),
media_url: Type.String(),
permalink: Type.String(),
media_type: Type.Union([Type.Literal("IMAGE"), Type.Literal("VIDEO"), Type.Literal("CAROUSEL_ALBUM")]),
}),
),
paging: Type.Object({
cursors: Type.Object({
before: Type.Optional(Type.String()),
after: Type.Optional(Type.String()),
}),
next: Type.Optional(Type.String()),
}),
});
export type InstagramFeedSchema = Static<typeof instagramFeedSchema>;