@memberjunction/actions-bizapps-social 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +16 -0
- package/README.md +375 -0
- package/dist/base/base-social.action.d.ts +137 -0
- package/dist/base/base-social.action.d.ts.map +1 -0
- package/dist/base/base-social.action.js +176 -0
- package/dist/base/base-social.action.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/buffer/actions/create-post.action.d.ts +20 -0
- package/dist/providers/buffer/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/create-post.action.js +195 -0
- package/dist/providers/buffer/actions/create-post.action.js.map +1 -0
- package/dist/providers/buffer/actions/delete-post.action.d.ts +20 -0
- package/dist/providers/buffer/actions/delete-post.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/delete-post.action.js +119 -0
- package/dist/providers/buffer/actions/delete-post.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-analytics.action.d.ts +28 -0
- package/dist/providers/buffer/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-analytics.action.js +143 -0
- package/dist/providers/buffer/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.d.ts +24 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.js +161 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-profiles.action.d.ts +24 -0
- package/dist/providers/buffer/actions/get-profiles.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-profiles.action.js +128 -0
- package/dist/providers/buffer/actions/get-profiles.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.d.ts +32 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.js +187 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.js.map +1 -0
- package/dist/providers/buffer/actions/index.d.ts +9 -0
- package/dist/providers/buffer/actions/index.d.ts.map +1 -0
- package/dist/providers/buffer/actions/index.js +25 -0
- package/dist/providers/buffer/actions/index.js.map +1 -0
- package/dist/providers/buffer/actions/reorder-queue.action.d.ts +20 -0
- package/dist/providers/buffer/actions/reorder-queue.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/reorder-queue.action.js +138 -0
- package/dist/providers/buffer/actions/reorder-queue.action.js.map +1 -0
- package/dist/providers/buffer/actions/search-posts.action.d.ts +28 -0
- package/dist/providers/buffer/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/search-posts.action.js +249 -0
- package/dist/providers/buffer/actions/search-posts.action.js.map +1 -0
- package/dist/providers/buffer/buffer-base.action.d.ts +95 -0
- package/dist/providers/buffer/buffer-base.action.d.ts.map +1 -0
- package/dist/providers/buffer/buffer-base.action.js +419 -0
- package/dist/providers/buffer/buffer-base.action.js.map +1 -0
- package/dist/providers/buffer/index.d.ts +3 -0
- package/dist/providers/buffer/index.d.ts.map +1 -0
- package/dist/providers/buffer/index.js +19 -0
- package/dist/providers/buffer/index.js.map +1 -0
- package/dist/providers/facebook/actions/boost-post.action.d.ts +45 -0
- package/dist/providers/facebook/actions/boost-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/boost-post.action.js +340 -0
- package/dist/providers/facebook/actions/boost-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/create-album.action.d.ts +33 -0
- package/dist/providers/facebook/actions/create-album.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/create-album.action.js +285 -0
- package/dist/providers/facebook/actions/create-album.action.js.map +1 -0
- package/dist/providers/facebook/actions/create-post.action.d.ts +21 -0
- package/dist/providers/facebook/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/create-post.action.js +223 -0
- package/dist/providers/facebook/actions/create-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-page-insights.action.d.ts +37 -0
- package/dist/providers/facebook/actions/get-page-insights.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-page-insights.action.js +359 -0
- package/dist/providers/facebook/actions/get-page-insights.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-page-posts.action.d.ts +29 -0
- package/dist/providers/facebook/actions/get-page-posts.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-page-posts.action.js +216 -0
- package/dist/providers/facebook/actions/get-page-posts.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-post-insights.action.d.ts +33 -0
- package/dist/providers/facebook/actions/get-post-insights.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-post-insights.action.js +287 -0
- package/dist/providers/facebook/actions/get-post-insights.action.js.map +1 -0
- package/dist/providers/facebook/actions/index.d.ts +10 -0
- package/dist/providers/facebook/actions/index.d.ts.map +1 -0
- package/dist/providers/facebook/actions/index.js +26 -0
- package/dist/providers/facebook/actions/index.js.map +1 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.d.ts +41 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.js +328 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.js.map +1 -0
- package/dist/providers/facebook/actions/schedule-post.action.d.ts +29 -0
- package/dist/providers/facebook/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/schedule-post.action.js +289 -0
- package/dist/providers/facebook/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/search-posts.action.d.ts +54 -0
- package/dist/providers/facebook/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/search-posts.action.js +396 -0
- package/dist/providers/facebook/actions/search-posts.action.js.map +1 -0
- package/dist/providers/facebook/facebook-base.action.d.ts +230 -0
- package/dist/providers/facebook/facebook-base.action.d.ts.map +1 -0
- package/dist/providers/facebook/facebook-base.action.js +566 -0
- package/dist/providers/facebook/facebook-base.action.js.map +1 -0
- package/dist/providers/facebook/index.d.ts +3 -0
- package/dist/providers/facebook/index.d.ts.map +1 -0
- package/dist/providers/facebook/index.js +19 -0
- package/dist/providers/facebook/index.js.map +1 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts +24 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js +266 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts +25 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js +202 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts +20 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js +172 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.d.ts +52 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.js +265 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts +37 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js +208 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts +36 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js +212 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/search-posts.action.d.ts +53 -0
- package/dist/providers/hootsuite/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/search-posts.action.js +353 -0
- package/dist/providers/hootsuite/actions/search-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts +20 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js +217 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/hootsuite-base.action.d.ts +101 -0
- package/dist/providers/hootsuite/hootsuite-base.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/hootsuite-base.action.js +274 -0
- package/dist/providers/hootsuite/hootsuite-base.action.js.map +1 -0
- package/dist/providers/hootsuite/index.d.ts +10 -0
- package/dist/providers/hootsuite/index.d.ts.map +1 -0
- package/dist/providers/hootsuite/index.js +28 -0
- package/dist/providers/hootsuite/index.js.map +1 -0
- package/dist/providers/instagram/actions/create-post.action.d.ts +30 -0
- package/dist/providers/instagram/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/create-post.action.js +269 -0
- package/dist/providers/instagram/actions/create-post.action.js.map +1 -0
- package/dist/providers/instagram/actions/create-story.action.d.ts +43 -0
- package/dist/providers/instagram/actions/create-story.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/create-story.action.js +365 -0
- package/dist/providers/instagram/actions/create-story.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-account-insights.action.d.ts +50 -0
- package/dist/providers/instagram/actions/get-account-insights.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-account-insights.action.js +390 -0
- package/dist/providers/instagram/actions/get-account-insights.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-business-posts.action.d.ts +30 -0
- package/dist/providers/instagram/actions/get-business-posts.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-business-posts.action.js +246 -0
- package/dist/providers/instagram/actions/get-business-posts.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-comments.action.d.ts +41 -0
- package/dist/providers/instagram/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-comments.action.js +337 -0
- package/dist/providers/instagram/actions/get-comments.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-post-insights.action.d.ts +42 -0
- package/dist/providers/instagram/actions/get-post-insights.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-post-insights.action.js +271 -0
- package/dist/providers/instagram/actions/get-post-insights.action.js.map +1 -0
- package/dist/providers/instagram/actions/index.d.ts +9 -0
- package/dist/providers/instagram/actions/index.d.ts.map +1 -0
- package/dist/providers/instagram/actions/index.js +26 -0
- package/dist/providers/instagram/actions/index.js.map +1 -0
- package/dist/providers/instagram/actions/schedule-post.action.d.ts +34 -0
- package/dist/providers/instagram/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/schedule-post.action.js +234 -0
- package/dist/providers/instagram/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/instagram/actions/search-posts.action.d.ts +56 -0
- package/dist/providers/instagram/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/search-posts.action.js +479 -0
- package/dist/providers/instagram/actions/search-posts.action.js.map +1 -0
- package/dist/providers/instagram/index.d.ts +3 -0
- package/dist/providers/instagram/index.d.ts.map +1 -0
- package/dist/providers/instagram/index.js +20 -0
- package/dist/providers/instagram/index.js.map +1 -0
- package/dist/providers/instagram/instagram-base.action.d.ts +76 -0
- package/dist/providers/instagram/instagram-base.action.d.ts.map +1 -0
- package/dist/providers/instagram/instagram-base.action.js +362 -0
- package/dist/providers/instagram/instagram-base.action.js.map +1 -0
- package/dist/providers/linkedin/actions/create-article.action.d.ts +28 -0
- package/dist/providers/linkedin/actions/create-article.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/create-article.action.js +275 -0
- package/dist/providers/linkedin/actions/create-article.action.js.map +1 -0
- package/dist/providers/linkedin/actions/create-post.action.d.ts +20 -0
- package/dist/providers/linkedin/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/create-post.action.js +188 -0
- package/dist/providers/linkedin/actions/create-post.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-followers.action.d.ts +29 -0
- package/dist/providers/linkedin/actions/get-followers.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-followers.action.js +222 -0
- package/dist/providers/linkedin/actions/get-followers.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts +24 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.js +163 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts +25 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.js +156 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts +28 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.js +200 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.js.map +1 -0
- package/dist/providers/linkedin/actions/index.d.ts +9 -0
- package/dist/providers/linkedin/actions/index.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/index.js +25 -0
- package/dist/providers/linkedin/actions/index.js.map +1 -0
- package/dist/providers/linkedin/actions/schedule-post.action.d.ts +22 -0
- package/dist/providers/linkedin/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/schedule-post.action.js +205 -0
- package/dist/providers/linkedin/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/linkedin/actions/search-posts.action.d.ts +41 -0
- package/dist/providers/linkedin/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/search-posts.action.js +292 -0
- package/dist/providers/linkedin/actions/search-posts.action.js.map +1 -0
- package/dist/providers/linkedin/index.d.ts +3 -0
- package/dist/providers/linkedin/index.d.ts.map +1 -0
- package/dist/providers/linkedin/index.js +19 -0
- package/dist/providers/linkedin/index.js.map +1 -0
- package/dist/providers/linkedin/linkedin-base.action.d.ts +166 -0
- package/dist/providers/linkedin/linkedin-base.action.d.ts.map +1 -0
- package/dist/providers/linkedin/linkedin-base.action.js +346 -0
- package/dist/providers/linkedin/linkedin-base.action.js.map +1 -0
- package/dist/providers/tiktok/actions/create-video-post.action.d.ts +21 -0
- package/dist/providers/tiktok/actions/create-video-post.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/create-video-post.action.js +226 -0
- package/dist/providers/tiktok/actions/create-video-post.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.d.ts +32 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.js +242 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-comments.action.d.ts +44 -0
- package/dist/providers/tiktok/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-comments.action.js +290 -0
- package/dist/providers/tiktok/actions/get-comments.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.d.ts +48 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.js +309 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.d.ts +20 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.js +131 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.d.ts +28 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.js +198 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.js.map +1 -0
- package/dist/providers/tiktok/actions/index.d.ts +8 -0
- package/dist/providers/tiktok/actions/index.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/index.js +25 -0
- package/dist/providers/tiktok/actions/index.js.map +1 -0
- package/dist/providers/tiktok/actions/search-videos.action.d.ts +89 -0
- package/dist/providers/tiktok/actions/search-videos.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/search-videos.action.js +653 -0
- package/dist/providers/tiktok/actions/search-videos.action.js.map +1 -0
- package/dist/providers/tiktok/index.d.ts +3 -0
- package/dist/providers/tiktok/index.d.ts.map +1 -0
- package/dist/providers/tiktok/index.js +20 -0
- package/dist/providers/tiktok/index.js.map +1 -0
- package/dist/providers/tiktok/tiktok-base.action.d.ts +87 -0
- package/dist/providers/tiktok/tiktok-base.action.d.ts.map +1 -0
- package/dist/providers/tiktok/tiktok-base.action.js +294 -0
- package/dist/providers/tiktok/tiktok-base.action.js.map +1 -0
- package/dist/providers/twitter/actions/create-thread.action.d.ts +28 -0
- package/dist/providers/twitter/actions/create-thread.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/create-thread.action.js +217 -0
- package/dist/providers/twitter/actions/create-thread.action.js.map +1 -0
- package/dist/providers/twitter/actions/create-tweet.action.d.ts +24 -0
- package/dist/providers/twitter/actions/create-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/create-tweet.action.js +199 -0
- package/dist/providers/twitter/actions/create-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/delete-tweet.action.d.ts +24 -0
- package/dist/providers/twitter/actions/delete-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/delete-tweet.action.js +158 -0
- package/dist/providers/twitter/actions/delete-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-analytics.action.d.ts +44 -0
- package/dist/providers/twitter/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-analytics.action.js +399 -0
- package/dist/providers/twitter/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-mentions.action.d.ts +24 -0
- package/dist/providers/twitter/actions/get-mentions.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-mentions.action.js +229 -0
- package/dist/providers/twitter/actions/get-mentions.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-timeline.action.d.ts +24 -0
- package/dist/providers/twitter/actions/get-timeline.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-timeline.action.js +249 -0
- package/dist/providers/twitter/actions/get-timeline.action.js.map +1 -0
- package/dist/providers/twitter/actions/index.d.ts +14 -0
- package/dist/providers/twitter/actions/index.d.ts.map +1 -0
- package/dist/providers/twitter/actions/index.js +30 -0
- package/dist/providers/twitter/actions/index.js.map +1 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.d.ts +30 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.js +250 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/search-tweets.action.d.ts +41 -0
- package/dist/providers/twitter/actions/search-tweets.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/search-tweets.action.js +559 -0
- package/dist/providers/twitter/actions/search-tweets.action.js.map +1 -0
- package/dist/providers/twitter/index.d.ts +8 -0
- package/dist/providers/twitter/index.d.ts.map +1 -0
- package/dist/providers/twitter/index.js +24 -0
- package/dist/providers/twitter/index.js.map +1 -0
- package/dist/providers/twitter/twitter-base.action.d.ts +185 -0
- package/dist/providers/twitter/twitter-base.action.d.ts.map +1 -0
- package/dist/providers/twitter/twitter-base.action.js +484 -0
- package/dist/providers/twitter/twitter-base.action.js.map +1 -0
- package/dist/providers/youtube/actions/create-playlist.action.d.ts +28 -0
- package/dist/providers/youtube/actions/create-playlist.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/create-playlist.action.js +235 -0
- package/dist/providers/youtube/actions/create-playlist.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.d.ts +60 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.js +429 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.d.ts +28 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.js +263 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-comments.action.d.ts +40 -0
- package/dist/providers/youtube/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-comments.action.js +381 -0
- package/dist/providers/youtube/actions/get-comments.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.d.ts +48 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.js +280 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.js.map +1 -0
- package/dist/providers/youtube/actions/index.d.ts +10 -0
- package/dist/providers/youtube/actions/index.d.ts.map +1 -0
- package/dist/providers/youtube/actions/index.js +26 -0
- package/dist/providers/youtube/actions/index.js.map +1 -0
- package/dist/providers/youtube/actions/schedule-video.action.d.ts +24 -0
- package/dist/providers/youtube/actions/schedule-video.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/schedule-video.action.js +225 -0
- package/dist/providers/youtube/actions/schedule-video.action.js.map +1 -0
- package/dist/providers/youtube/actions/search-videos.action.d.ts +40 -0
- package/dist/providers/youtube/actions/search-videos.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/search-videos.action.js +483 -0
- package/dist/providers/youtube/actions/search-videos.action.js.map +1 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.d.ts +32 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.js +298 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.js.map +1 -0
- package/dist/providers/youtube/actions/upload-video.action.d.ts +28 -0
- package/dist/providers/youtube/actions/upload-video.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/upload-video.action.js +266 -0
- package/dist/providers/youtube/actions/upload-video.action.js.map +1 -0
- package/dist/providers/youtube/index.d.ts +3 -0
- package/dist/providers/youtube/index.d.ts.map +1 -0
- package/dist/providers/youtube/index.js +19 -0
- package/dist/providers/youtube/index.js.map +1 -0
- package/dist/providers/youtube/youtube-base.action.d.ts +83 -0
- package/dist/providers/youtube/youtube-base.action.d.ts.map +1 -0
- package/dist/providers/youtube/youtube-base.action.js +319 -0
- package/dist/providers/youtube/youtube-base.action.js.map +1 -0
- package/package.json +42 -0
- package/social_actions_summary.md +439 -0
- package/src/base/base-social.action.ts +270 -0
- package/src/index.ts +26 -0
- package/src/providers/buffer/actions/create-post.action.ts +205 -0
- package/src/providers/buffer/actions/delete-post.action.ts +116 -0
- package/src/providers/buffer/actions/get-analytics.action.ts +146 -0
- package/src/providers/buffer/actions/get-pending-posts.action.ts +161 -0
- package/src/providers/buffer/actions/get-profiles.action.ts +126 -0
- package/src/providers/buffer/actions/get-sent-posts.action.ts +189 -0
- package/src/providers/buffer/actions/index.ts +8 -0
- package/src/providers/buffer/actions/reorder-queue.action.ts +141 -0
- package/src/providers/buffer/actions/search-posts.action.ts +262 -0
- package/src/providers/buffer/buffer-base.action.ts +490 -0
- package/src/providers/buffer/index.ts +2 -0
- package/src/providers/facebook/actions/boost-post.action.ts +412 -0
- package/src/providers/facebook/actions/create-album.action.ts +335 -0
- package/src/providers/facebook/actions/create-post.action.ts +243 -0
- package/src/providers/facebook/actions/get-page-insights.action.ts +427 -0
- package/src/providers/facebook/actions/get-page-posts.action.ts +241 -0
- package/src/providers/facebook/actions/get-post-insights.action.ts +338 -0
- package/src/providers/facebook/actions/index.ts +9 -0
- package/src/providers/facebook/actions/respond-to-comments.action.ts +372 -0
- package/src/providers/facebook/actions/schedule-post.action.ts +310 -0
- package/src/providers/facebook/actions/search-posts.action.ts +449 -0
- package/src/providers/facebook/facebook-base.action.ts +750 -0
- package/src/providers/facebook/index.ts +2 -0
- package/src/providers/hootsuite/actions/bulk-schedule-posts.action.ts +293 -0
- package/src/providers/hootsuite/actions/create-scheduled-post.action.ts +206 -0
- package/src/providers/hootsuite/actions/delete-scheduled-post.action.ts +173 -0
- package/src/providers/hootsuite/actions/get-analytics.action.ts +281 -0
- package/src/providers/hootsuite/actions/get-scheduled-posts.action.ts +220 -0
- package/src/providers/hootsuite/actions/get-social-profiles.action.ts +220 -0
- package/src/providers/hootsuite/actions/search-posts.action.ts +395 -0
- package/src/providers/hootsuite/actions/update-scheduled-post.action.ts +222 -0
- package/src/providers/hootsuite/hootsuite-base.action.ts +346 -0
- package/src/providers/hootsuite/index.ts +12 -0
- package/src/providers/instagram/README.md +129 -0
- package/src/providers/instagram/actions/create-post.action.ts +329 -0
- package/src/providers/instagram/actions/create-story.action.ts +415 -0
- package/src/providers/instagram/actions/get-account-insights.action.ts +449 -0
- package/src/providers/instagram/actions/get-business-posts.action.ts +281 -0
- package/src/providers/instagram/actions/get-comments.action.ts +395 -0
- package/src/providers/instagram/actions/get-post-insights.action.ts +302 -0
- package/src/providers/instagram/actions/index.ts +9 -0
- package/src/providers/instagram/actions/schedule-post.action.ts +248 -0
- package/src/providers/instagram/actions/search-posts.action.ts +569 -0
- package/src/providers/instagram/index.ts +3 -0
- package/src/providers/instagram/instagram-base.action.ts +430 -0
- package/src/providers/linkedin/actions/create-article.action.ts +301 -0
- package/src/providers/linkedin/actions/create-post.action.ts +190 -0
- package/src/providers/linkedin/actions/get-followers.action.ts +226 -0
- package/src/providers/linkedin/actions/get-organization-posts.action.ts +164 -0
- package/src/providers/linkedin/actions/get-personal-posts.action.ts +158 -0
- package/src/providers/linkedin/actions/get-post-analytics.action.ts +205 -0
- package/src/providers/linkedin/actions/index.ts +8 -0
- package/src/providers/linkedin/actions/schedule-post.action.ts +206 -0
- package/src/providers/linkedin/actions/search-posts.action.ts +323 -0
- package/src/providers/linkedin/index.ts +2 -0
- package/src/providers/linkedin/linkedin-base.action.ts +481 -0
- package/src/providers/tiktok/actions/create-video-post.action.ts +234 -0
- package/src/providers/tiktok/actions/get-account-analytics.action.ts +255 -0
- package/src/providers/tiktok/actions/get-comments.action.ts +332 -0
- package/src/providers/tiktok/actions/get-trending-hashtags.action.ts +341 -0
- package/src/providers/tiktok/actions/get-user-videos.action.ts +136 -0
- package/src/providers/tiktok/actions/get-video-analytics.action.ts +218 -0
- package/src/providers/tiktok/actions/index.ts +8 -0
- package/src/providers/tiktok/actions/search-videos.action.ts +717 -0
- package/src/providers/tiktok/index.ts +3 -0
- package/src/providers/tiktok/tiktok-base.action.ts +356 -0
- package/src/providers/twitter/README.md +207 -0
- package/src/providers/twitter/actions/create-thread.action.ts +227 -0
- package/src/providers/twitter/actions/create-tweet.action.ts +204 -0
- package/src/providers/twitter/actions/delete-tweet.action.ts +153 -0
- package/src/providers/twitter/actions/get-analytics.action.ts +440 -0
- package/src/providers/twitter/actions/get-mentions.action.ts +233 -0
- package/src/providers/twitter/actions/get-timeline.action.ts +248 -0
- package/src/providers/twitter/actions/index.ts +14 -0
- package/src/providers/twitter/actions/schedule-tweet.action.ts +259 -0
- package/src/providers/twitter/actions/search-tweets.action.ts +588 -0
- package/src/providers/twitter/index.ts +8 -0
- package/src/providers/twitter/twitter-base.action.ts +629 -0
- package/src/providers/youtube/actions/create-playlist.action.ts +256 -0
- package/src/providers/youtube/actions/get-channel-analytics.action.ts +502 -0
- package/src/providers/youtube/actions/get-channel-videos.action.ts +286 -0
- package/src/providers/youtube/actions/get-comments.action.ts +411 -0
- package/src/providers/youtube/actions/get-video-analytics.action.ts +298 -0
- package/src/providers/youtube/actions/index.ts +9 -0
- package/src/providers/youtube/actions/schedule-video.action.ts +246 -0
- package/src/providers/youtube/actions/search-videos.action.ts +530 -0
- package/src/providers/youtube/actions/update-video-metadata.action.ts +321 -0
- package/src/providers/youtube/actions/upload-video.action.ts +288 -0
- package/src/providers/youtube/index.ts +2 -0
- package/src/providers/youtube/youtube-base.action.ts +373 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
2
|
+
import { BaseSocialMediaAction, MediaFile } from '../../base/base-social.action';
|
|
3
|
+
import { UserInfo, LogStatus, LogError } from '@memberjunction/core';
|
|
4
|
+
import axios, { AxiosInstance, AxiosError } from 'axios';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base class for all Instagram actions.
|
|
8
|
+
* Handles Instagram Graph API and Basic Display API authentication and common functionality.
|
|
9
|
+
* Instagram uses Facebook's Graph API infrastructure.
|
|
10
|
+
*/
|
|
11
|
+
@RegisterClass(BaseSocialMediaAction, 'InstagramBaseAction')
|
|
12
|
+
export abstract class InstagramBaseAction extends BaseSocialMediaAction {
|
|
13
|
+
protected get platformName(): string {
|
|
14
|
+
return 'Instagram';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected get apiBaseUrl(): string {
|
|
18
|
+
return 'https://graph.facebook.com/v18.0';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Instagram Business Account ID (stored in CustomAttribute1)
|
|
23
|
+
*/
|
|
24
|
+
protected get instagramBusinessAccountId(): string {
|
|
25
|
+
return this.getCustomAttribute(1) || '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Facebook Page ID (stored in CustomAttribute2) - required for Instagram Business API
|
|
30
|
+
*/
|
|
31
|
+
protected get facebookPageId(): string {
|
|
32
|
+
return this.getCustomAttribute(2) || '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Axios instance for API calls
|
|
37
|
+
*/
|
|
38
|
+
private _axiosInstance: AxiosInstance | null = null;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get or create axios instance with authentication
|
|
42
|
+
*/
|
|
43
|
+
protected get axios(): AxiosInstance {
|
|
44
|
+
if (!this._axiosInstance) {
|
|
45
|
+
this._axiosInstance = axios.create({
|
|
46
|
+
baseURL: this.apiBaseUrl,
|
|
47
|
+
headers: this.buildHeaders()
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Add response interceptor for error handling
|
|
51
|
+
this._axiosInstance.interceptors.response.use(
|
|
52
|
+
response => response,
|
|
53
|
+
async error => {
|
|
54
|
+
if (error.response?.status === 401 && this.isAuthError(error)) {
|
|
55
|
+
LogStatus('Instagram token appears invalid, attempting refresh...');
|
|
56
|
+
await this.refreshAccessToken();
|
|
57
|
+
|
|
58
|
+
// Retry the request with new token
|
|
59
|
+
error.config.headers.Authorization = `Bearer ${this.getAccessToken()}`;
|
|
60
|
+
return axios.request(error.config);
|
|
61
|
+
}
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return this._axiosInstance;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Refresh the Instagram/Facebook access token
|
|
71
|
+
*/
|
|
72
|
+
protected async refreshAccessToken(): Promise<void> {
|
|
73
|
+
try {
|
|
74
|
+
// Instagram uses Facebook's OAuth system
|
|
75
|
+
// Long-lived tokens need to be exchanged periodically
|
|
76
|
+
const currentToken = this.getAccessToken();
|
|
77
|
+
if (!currentToken) {
|
|
78
|
+
throw new Error('No access token available to refresh');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Exchange for a new long-lived token
|
|
82
|
+
const response = await axios.get(`${this.apiBaseUrl}/oauth/access_token`, {
|
|
83
|
+
params: {
|
|
84
|
+
grant_type: 'fb_exchange_token',
|
|
85
|
+
client_id: this.getCustomAttribute(3), // App ID stored in CustomAttribute3
|
|
86
|
+
client_secret: this.getCustomAttribute(4), // App Secret stored in CustomAttribute4
|
|
87
|
+
fb_exchange_token: currentToken
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (response.data.access_token) {
|
|
92
|
+
await this.updateStoredTokens(
|
|
93
|
+
response.data.access_token,
|
|
94
|
+
undefined, // Instagram doesn't use refresh tokens
|
|
95
|
+
response.data.expires_in || 5184000 // Default to 60 days
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// Reset axios instance to use new token
|
|
99
|
+
this._axiosInstance = null;
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
LogError('Failed to refresh Instagram access token', error);
|
|
103
|
+
throw new Error('Failed to refresh Instagram access token');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Make an Instagram Graph API request
|
|
109
|
+
*/
|
|
110
|
+
protected async makeInstagramRequest<T = any>(
|
|
111
|
+
endpoint: string,
|
|
112
|
+
method: 'GET' | 'POST' | 'DELETE' = 'GET',
|
|
113
|
+
data?: any,
|
|
114
|
+
params?: any
|
|
115
|
+
): Promise<T> {
|
|
116
|
+
try {
|
|
117
|
+
this.logApiRequest(method, `${this.apiBaseUrl}/${endpoint}`, data || params);
|
|
118
|
+
|
|
119
|
+
const response = await this.axios.request<T>({
|
|
120
|
+
url: endpoint,
|
|
121
|
+
method,
|
|
122
|
+
data,
|
|
123
|
+
params
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
this.logApiResponse(response.data);
|
|
127
|
+
return response.data;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (axios.isAxiosError(error)) {
|
|
130
|
+
this.handleInstagramError(error);
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Handle Instagram-specific errors
|
|
138
|
+
*/
|
|
139
|
+
protected handleInstagramError(error: AxiosError): void {
|
|
140
|
+
const response = error.response;
|
|
141
|
+
if (!response) {
|
|
142
|
+
throw new Error('Network error occurred while calling Instagram API');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const errorData = response.data as any;
|
|
146
|
+
const errorMessage = errorData?.error?.message || 'Unknown Instagram API error';
|
|
147
|
+
const errorCode = errorData?.error?.code;
|
|
148
|
+
const errorSubcode = errorData?.error?.error_subcode;
|
|
149
|
+
|
|
150
|
+
// Check for rate limiting
|
|
151
|
+
if (errorCode === 32 || errorCode === 4 || response.status === 429) {
|
|
152
|
+
const retryAfter = response.headers['x-app-usage']
|
|
153
|
+
? this.parseAppUsage(response.headers['x-app-usage'])
|
|
154
|
+
: 3600; // Default to 1 hour
|
|
155
|
+
|
|
156
|
+
throw {
|
|
157
|
+
code: 'RATE_LIMIT',
|
|
158
|
+
message: 'Instagram API rate limit exceeded',
|
|
159
|
+
retryAfter
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Check for permission errors
|
|
164
|
+
if (errorCode === 10 || errorSubcode === 460) {
|
|
165
|
+
throw {
|
|
166
|
+
code: 'INSUFFICIENT_PERMISSIONS',
|
|
167
|
+
message: 'Insufficient permissions for this Instagram operation'
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Media errors
|
|
172
|
+
if (errorCode === 100 && errorMessage.toLowerCase().includes('media')) {
|
|
173
|
+
throw {
|
|
174
|
+
code: 'INVALID_MEDIA',
|
|
175
|
+
message: errorMessage
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Post not found
|
|
180
|
+
if (errorCode === 100 && errorSubcode === 33) {
|
|
181
|
+
throw {
|
|
182
|
+
code: 'POST_NOT_FOUND',
|
|
183
|
+
message: 'Instagram post not found'
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
throw {
|
|
188
|
+
code: 'PLATFORM_ERROR',
|
|
189
|
+
message: errorMessage,
|
|
190
|
+
details: errorData
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Parse Facebook's app usage header to determine rate limit status
|
|
196
|
+
*/
|
|
197
|
+
private parseAppUsage(appUsage: string): number {
|
|
198
|
+
try {
|
|
199
|
+
const usage = JSON.parse(appUsage);
|
|
200
|
+
const callCount = usage.call_count || 0;
|
|
201
|
+
const totalTime = usage.total_time || 0;
|
|
202
|
+
const totalCputime = usage.total_cputime || 0;
|
|
203
|
+
|
|
204
|
+
// If any metric is above 90%, implement backoff
|
|
205
|
+
if (callCount > 90 || totalTime > 90 || totalCputime > 90) {
|
|
206
|
+
return 3600; // Wait 1 hour
|
|
207
|
+
}
|
|
208
|
+
return 0;
|
|
209
|
+
} catch {
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Upload media to Instagram (returns container ID)
|
|
216
|
+
*/
|
|
217
|
+
protected async uploadSingleMedia(file: MediaFile): Promise<string> {
|
|
218
|
+
try {
|
|
219
|
+
// For Instagram, media must be hosted at a public URL
|
|
220
|
+
// This is a simplified version - in production, you'd upload to a CDN first
|
|
221
|
+
const mediaUrl = await this.uploadMediaToCDN(file);
|
|
222
|
+
|
|
223
|
+
let containerParams: any = {
|
|
224
|
+
access_token: this.getAccessToken()
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Determine media type and set appropriate parameters
|
|
228
|
+
if (file.mimeType.startsWith('image/')) {
|
|
229
|
+
containerParams.image_url = mediaUrl;
|
|
230
|
+
|
|
231
|
+
// Check if it's a carousel
|
|
232
|
+
if (file.filename.includes('carousel')) {
|
|
233
|
+
containerParams.is_carousel_item = true;
|
|
234
|
+
}
|
|
235
|
+
} else if (file.mimeType.startsWith('video/')) {
|
|
236
|
+
containerParams.video_url = mediaUrl;
|
|
237
|
+
containerParams.media_type = 'REELS'; // or 'VIDEO' for feed videos
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Add caption if provided in metadata
|
|
241
|
+
const metadata = (file as any).metadata;
|
|
242
|
+
if (metadata?.caption) {
|
|
243
|
+
containerParams.caption = metadata.caption;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Create media container
|
|
247
|
+
const response = await this.makeInstagramRequest<{ id: string }>(
|
|
248
|
+
`${this.instagramBusinessAccountId}/media`,
|
|
249
|
+
'POST',
|
|
250
|
+
containerParams
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
return response.id;
|
|
254
|
+
} catch (error) {
|
|
255
|
+
LogError('Failed to upload media to Instagram', error);
|
|
256
|
+
throw error;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Upload media to a CDN (placeholder - implement based on your CDN)
|
|
262
|
+
*/
|
|
263
|
+
private async uploadMediaToCDN(file: MediaFile): Promise<string> {
|
|
264
|
+
// In a real implementation, this would upload to S3, Cloudinary, etc.
|
|
265
|
+
// For now, throw an error indicating this needs implementation
|
|
266
|
+
throw new Error('Media CDN upload not implemented. Instagram requires media to be hosted at a public URL.');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Publish a media container
|
|
271
|
+
*/
|
|
272
|
+
protected async publishMediaContainer(containerId: string): Promise<string> {
|
|
273
|
+
const response = await this.makeInstagramRequest<{ id: string }>(
|
|
274
|
+
`${this.instagramBusinessAccountId}/media_publish`,
|
|
275
|
+
'POST',
|
|
276
|
+
{
|
|
277
|
+
creation_id: containerId,
|
|
278
|
+
access_token: this.getAccessToken()
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
return response.id;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Get insights for a media object or account
|
|
287
|
+
*/
|
|
288
|
+
protected async getInsights(
|
|
289
|
+
objectId: string,
|
|
290
|
+
metrics: string[],
|
|
291
|
+
period?: 'lifetime' | 'day' | 'week' | 'days_28'
|
|
292
|
+
): Promise<any> {
|
|
293
|
+
const params: any = {
|
|
294
|
+
metric: metrics.join(','),
|
|
295
|
+
access_token: this.getAccessToken()
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
if (period) {
|
|
299
|
+
params.period = period;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const response = await this.makeInstagramRequest<{ data: any[] }>(
|
|
303
|
+
`${objectId}/insights`,
|
|
304
|
+
'GET',
|
|
305
|
+
null,
|
|
306
|
+
params
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
return response.data;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Search for posts (limited to business account's own posts)
|
|
314
|
+
*/
|
|
315
|
+
protected async searchPosts(params: any): Promise<any[]> {
|
|
316
|
+
// Instagram doesn't have a general search API
|
|
317
|
+
// We can only search within the business account's own posts
|
|
318
|
+
const fields = 'id,caption,media_type,media_url,permalink,timestamp,like_count,comments_count';
|
|
319
|
+
|
|
320
|
+
let endpoint = `${this.instagramBusinessAccountId}/media`;
|
|
321
|
+
const queryParams: any = {
|
|
322
|
+
fields,
|
|
323
|
+
access_token: this.getAccessToken(),
|
|
324
|
+
limit: params.limit || 25
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Add date filtering if provided
|
|
328
|
+
if (params.startDate) {
|
|
329
|
+
queryParams.since = Math.floor(new Date(params.startDate).getTime() / 1000);
|
|
330
|
+
}
|
|
331
|
+
if (params.endDate) {
|
|
332
|
+
queryParams.until = Math.floor(new Date(params.endDate).getTime() / 1000);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const posts: any[] = [];
|
|
336
|
+
let hasNext = true;
|
|
337
|
+
|
|
338
|
+
while (hasNext && posts.length < (params.limit || 100)) {
|
|
339
|
+
const response = await this.makeInstagramRequest<{
|
|
340
|
+
data: any[];
|
|
341
|
+
paging?: { next: string };
|
|
342
|
+
}>(endpoint, 'GET', null, queryParams);
|
|
343
|
+
|
|
344
|
+
if (response.data) {
|
|
345
|
+
// Filter by caption if query is provided
|
|
346
|
+
const filtered = params.query
|
|
347
|
+
? response.data.filter(post =>
|
|
348
|
+
post.caption?.toLowerCase().includes(params.query.toLowerCase()))
|
|
349
|
+
: response.data;
|
|
350
|
+
|
|
351
|
+
posts.push(...filtered);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (response.paging?.next) {
|
|
355
|
+
// Parse next URL for pagination
|
|
356
|
+
const nextUrl = new URL(response.paging.next);
|
|
357
|
+
queryParams.after = nextUrl.searchParams.get('after');
|
|
358
|
+
} else {
|
|
359
|
+
hasNext = false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return posts.slice(0, params.limit || 100);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Normalize Instagram post to common format
|
|
368
|
+
*/
|
|
369
|
+
protected normalizePost(instagramPost: any): any {
|
|
370
|
+
return {
|
|
371
|
+
id: instagramPost.id,
|
|
372
|
+
platform: 'Instagram',
|
|
373
|
+
profileId: this.instagramBusinessAccountId,
|
|
374
|
+
content: instagramPost.caption || '',
|
|
375
|
+
mediaUrls: instagramPost.media_url ? [instagramPost.media_url] : [],
|
|
376
|
+
publishedAt: new Date(instagramPost.timestamp),
|
|
377
|
+
analytics: {
|
|
378
|
+
impressions: instagramPost.impressions_count || 0,
|
|
379
|
+
engagements: (instagramPost.like_count || 0) + (instagramPost.comments_count || 0),
|
|
380
|
+
clicks: 0, // Not available in basic metrics
|
|
381
|
+
shares: 0, // Instagram doesn't track shares
|
|
382
|
+
comments: instagramPost.comments_count || 0,
|
|
383
|
+
likes: instagramPost.like_count || 0,
|
|
384
|
+
reach: instagramPost.reach || 0,
|
|
385
|
+
saves: instagramPost.saved || 0,
|
|
386
|
+
videoViews: instagramPost.video_views || 0,
|
|
387
|
+
platformMetrics: instagramPost
|
|
388
|
+
},
|
|
389
|
+
platformSpecificData: {
|
|
390
|
+
mediaType: instagramPost.media_type,
|
|
391
|
+
permalink: instagramPost.permalink,
|
|
392
|
+
isCarousel: instagramPost.media_type === 'CAROUSEL_ALBUM'
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Check if media container is ready for publishing
|
|
399
|
+
*/
|
|
400
|
+
protected async isMediaContainerReady(containerId: string): Promise<boolean> {
|
|
401
|
+
const response = await this.makeInstagramRequest<{ status_code: string }>(
|
|
402
|
+
containerId,
|
|
403
|
+
'GET',
|
|
404
|
+
null,
|
|
405
|
+
{
|
|
406
|
+
fields: 'status_code',
|
|
407
|
+
access_token: this.getAccessToken()
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
return response.status_code === 'FINISHED';
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Wait for media container to be ready
|
|
416
|
+
*/
|
|
417
|
+
protected async waitForMediaContainer(containerId: string, maxWaitTime: number = 60000): Promise<void> {
|
|
418
|
+
const startTime = Date.now();
|
|
419
|
+
const pollInterval = 2000; // 2 seconds
|
|
420
|
+
|
|
421
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
422
|
+
if (await this.isMediaContainerReady(containerId)) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
throw new Error('Media container processing timeout');
|
|
429
|
+
}
|
|
430
|
+
}
|