@bubblelab/bubble-core 0.1.8 → 0.1.10

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.
Files changed (224) hide show
  1. package/dist/bubble-bundle.d.ts +333 -1438
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +64 -28
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.d.ts +17 -1
  6. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
  7. package/dist/bubble-flow/bubble-flow-class.js +16 -0
  8. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  9. package/dist/bubble-flow/sample/data-analyst-flow.d.ts +1 -1
  10. package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -1
  11. package/dist/bubble-flow/sample/error-ts.d.ts +1 -1
  12. package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -1
  13. package/dist/bubble-flow/sample/sanitytest.d.ts +1 -1
  14. package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -1
  15. package/dist/bubble-flow/sample/simple-webhook-2.d.ts +1 -1
  16. package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -1
  17. package/dist/bubble-flow/sample/simple-webhook.d.ts +1 -1
  18. package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -1
  19. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +1 -1
  20. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
  21. package/dist/bubble-flow/sample/slack-v0.1.d.ts +1 -1
  22. package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -1
  23. package/dist/bubble-flow/sample/slackagenttest.d.ts +1 -1
  24. package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -1
  25. package/dist/bubbles/service-bubble/ai-agent.d.ts +115 -97
  26. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  27. package/dist/bubbles/service-bubble/ai-agent.js +276 -96
  28. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  29. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +805 -0
  30. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts.map +1 -0
  31. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.js +131 -0
  32. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.js.map +1 -0
  33. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +485 -0
  34. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts.map +1 -0
  35. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.js +176 -0
  36. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.js.map +1 -0
  37. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +302 -0
  38. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts.map +1 -0
  39. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.js +138 -0
  40. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.js.map +1 -0
  41. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +642 -0
  42. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts.map +1 -0
  43. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.js +123 -0
  44. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.js.map +1 -0
  45. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +184 -0
  46. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts.map +1 -0
  47. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js +145 -0
  48. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js.map +1 -0
  49. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts +52 -0
  50. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts.map +1 -0
  51. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js +29 -0
  52. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js.map +1 -0
  53. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +1999 -0
  54. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -0
  55. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +54 -0
  56. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -0
  57. package/dist/bubbles/service-bubble/apify/apify.d.ts +143 -0
  58. package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -0
  59. package/dist/bubbles/service-bubble/apify/apify.js +276 -0
  60. package/dist/bubbles/service-bubble/apify/apify.js.map +1 -0
  61. package/dist/bubbles/service-bubble/apify/index.d.ts +6 -0
  62. package/dist/bubbles/service-bubble/apify/index.d.ts.map +1 -0
  63. package/dist/bubbles/service-bubble/apify/index.js +6 -0
  64. package/dist/bubbles/service-bubble/apify/index.js.map +1 -0
  65. package/dist/bubbles/service-bubble/apify/types.d.ts +7 -0
  66. package/dist/bubbles/service-bubble/apify/types.d.ts.map +1 -0
  67. package/dist/bubbles/service-bubble/apify/types.js +5 -0
  68. package/dist/bubbles/service-bubble/apify/types.js.map +1 -0
  69. package/dist/bubbles/service-bubble/gmail.d.ts +626 -132
  70. package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -1
  71. package/dist/bubbles/service-bubble/gmail.js +435 -7
  72. package/dist/bubbles/service-bubble/gmail.js.map +1 -1
  73. package/dist/bubbles/service-bubble/google-calendar.d.ts +36 -36
  74. package/dist/bubbles/service-bubble/google-drive.d.ts +233 -4
  75. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
  76. package/dist/bubbles/service-bubble/google-drive.js +65 -75
  77. package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
  78. package/dist/bubbles/service-bubble/google-sheets.d.ts +52 -52
  79. package/dist/bubbles/service-bubble/hello-world.js +2 -2
  80. package/dist/bubbles/service-bubble/hello-world.js.map +1 -1
  81. package/dist/bubbles/service-bubble/http.d.ts +6 -6
  82. package/dist/bubbles/service-bubble/postgresql.d.ts +4 -4
  83. package/dist/bubbles/service-bubble/resend.d.ts +5 -5
  84. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -1
  85. package/dist/bubbles/service-bubble/resend.js +16 -5
  86. package/dist/bubbles/service-bubble/resend.js.map +1 -1
  87. package/dist/bubbles/service-bubble/slack.d.ts +18 -18
  88. package/dist/bubbles/service-bubble/storage.d.ts +4 -4
  89. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
  90. package/dist/bubbles/service-bubble/storage.js +16 -5
  91. package/dist/bubbles/service-bubble/storage.js.map +1 -1
  92. package/dist/bubbles/service-bubble/x-twitter.d.ts +814 -0
  93. package/dist/bubbles/service-bubble/x-twitter.d.ts.map +1 -0
  94. package/dist/bubbles/service-bubble/x-twitter.js +445 -0
  95. package/dist/bubbles/service-bubble/x-twitter.js.map +1 -0
  96. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +20 -20
  97. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +16 -16
  98. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +14 -1
  99. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
  100. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +101 -47
  101. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
  102. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +435 -0
  103. package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -0
  104. package/dist/bubbles/tool-bubble/instagram-tool.js +474 -0
  105. package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -0
  106. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +2136 -0
  107. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -0
  108. package/dist/bubbles/tool-bubble/linkedin-tool.js +608 -0
  109. package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -0
  110. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +69 -64
  111. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -1
  112. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +97 -22
  113. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -1
  114. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +6 -6
  115. package/dist/bubbles/tool-bubble/research-agent-tool.js +5 -5
  116. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
  117. package/dist/bubbles/tool-bubble/tool-template.d.ts +8 -8
  118. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +14 -14
  119. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
  120. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +28 -28
  121. package/dist/bubbles/tool-bubble/web-scrape-tool.js +1 -1
  122. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
  123. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +5 -4
  124. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
  125. package/dist/bubbles/tool-bubble/web-search-tool.js +6 -2
  126. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
  127. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +394 -0
  128. package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -0
  129. package/dist/bubbles/tool-bubble/youtube-tool.js +352 -0
  130. package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -0
  131. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +47 -36
  132. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -1
  133. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +96 -65
  134. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -1
  135. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +38 -38
  136. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +1 -1
  137. package/dist/bubbles/workflow-bubble/generate-document.workflow.js.map +1 -1
  138. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +42 -42
  139. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +1 -1
  140. package/dist/bubbles/workflow-bubble/parse-document.workflow.js.map +1 -1
  141. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +22 -22
  142. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
  143. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +1 -4
  144. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
  145. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +60 -60
  146. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -1
  147. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +2 -2
  148. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -1
  149. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +20 -20
  150. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +1 -1
  151. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -1
  152. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +66 -66
  153. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +1 -1
  154. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -1
  155. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +18 -18
  156. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -1
  157. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +1 -2
  158. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -1
  159. package/dist/bubbles.json +489 -0
  160. package/dist/index.d.ts +16 -3
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +8 -1
  163. package/dist/index.js.map +1 -1
  164. package/dist/logging/BubbleLogger.d.ts +11 -0
  165. package/dist/logging/BubbleLogger.d.ts.map +1 -1
  166. package/dist/logging/BubbleLogger.js +87 -33
  167. package/dist/logging/BubbleLogger.js.map +1 -1
  168. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
  169. package/dist/logging/StreamingBubbleLogger.js +23 -16
  170. package/dist/logging/StreamingBubbleLogger.js.map +1 -1
  171. package/dist/test-gm.d.ts +10 -0
  172. package/dist/test-gm.d.ts.map +1 -0
  173. package/dist/test-gm.js +95 -0
  174. package/dist/test-gm.js.map +1 -0
  175. package/dist/types/available-tools.d.ts +1 -1
  176. package/dist/types/available-tools.d.ts.map +1 -1
  177. package/dist/types/available-tools.js +2 -0
  178. package/dist/types/available-tools.js.map +1 -1
  179. package/dist/types/base-bubble-class.d.ts +6 -1
  180. package/dist/types/base-bubble-class.d.ts.map +1 -1
  181. package/dist/types/base-bubble-class.js +47 -24
  182. package/dist/types/base-bubble-class.js.map +1 -1
  183. package/dist/types/bubble.d.ts +3 -13
  184. package/dist/types/bubble.d.ts.map +1 -1
  185. package/dist/types/bubble.js +1 -1
  186. package/dist/types/bubble.js.map +1 -1
  187. package/dist/types/service-bubble-class.d.ts +5 -5
  188. package/dist/types/service-bubble-class.d.ts.map +1 -1
  189. package/dist/types/service-bubble-class.js +6 -7
  190. package/dist/types/service-bubble-class.js.map +1 -1
  191. package/dist/types/tool-bubble-class.d.ts +1 -1
  192. package/dist/types/tool-bubble-class.d.ts.map +1 -1
  193. package/dist/types/tool-bubble-class.js +9 -3
  194. package/dist/types/tool-bubble-class.js.map +1 -1
  195. package/dist/types/workflow-bubble-class.d.ts +1 -1
  196. package/dist/types/workflow-bubble-class.d.ts.map +1 -1
  197. package/dist/utils/agent-formatter.d.ts +17 -0
  198. package/dist/utils/agent-formatter.d.ts.map +1 -0
  199. package/dist/utils/agent-formatter.js +139 -0
  200. package/dist/utils/agent-formatter.js.map +1 -0
  201. package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
  202. package/dist/utils/bubbleflow-validation.js +89 -32
  203. package/dist/utils/bubbleflow-validation.js.map +1 -1
  204. package/dist/utils/error-sanitizer.d.ts +12 -0
  205. package/dist/utils/error-sanitizer.d.ts.map +1 -0
  206. package/dist/utils/error-sanitizer.js +77 -0
  207. package/dist/utils/error-sanitizer.js.map +1 -0
  208. package/dist/utils/json-parsing.d.ts +1 -0
  209. package/dist/utils/json-parsing.d.ts.map +1 -1
  210. package/dist/utils/json-parsing.js +205 -32
  211. package/dist/utils/json-parsing.js.map +1 -1
  212. package/package.json +6 -5
  213. package/dist/bubble-trigger/index.d.ts +0 -2
  214. package/dist/bubble-trigger/index.d.ts.map +0 -1
  215. package/dist/bubble-trigger/index.js +0 -2
  216. package/dist/bubble-trigger/index.js.map +0 -1
  217. package/dist/bubble-trigger/types.d.ts +0 -87
  218. package/dist/bubble-trigger/types.d.ts.map +0 -1
  219. package/dist/bubble-trigger/types.js +0 -14
  220. package/dist/bubble-trigger/types.js.map +0 -1
  221. package/dist/types/ai-models.d.ts +0 -4
  222. package/dist/types/ai-models.d.ts.map +0 -1
  223. package/dist/types/ai-models.js +0 -16
  224. package/dist/types/ai-models.js.map +0 -1
@@ -0,0 +1,474 @@
1
+ import { z } from 'zod';
2
+ import { ToolBubble } from '../../types/tool-bubble-class.js';
3
+ import { CredentialType } from '@bubblelab/shared-schemas';
4
+ import { ApifyBubble } from '../service-bubble/apify/apify.js';
5
+ // Unified Instagram data types (service-agnostic)
6
+ const InstagramPostSchema = z.object({
7
+ url: z.string().nullable().describe('Post URL'),
8
+ caption: z.string().nullable().describe('Post caption text'),
9
+ likesCount: z.number().nullable().describe('Number of likes'),
10
+ commentsCount: z.number().nullable().describe('Number of comments'),
11
+ ownerUsername: z.string().nullable().describe('Post owner username'),
12
+ timestamp: z.string().nullable().describe('Post timestamp (ISO format)'),
13
+ type: z
14
+ .enum(['image', 'video', 'carousel'])
15
+ .nullable()
16
+ .describe('Post media type'),
17
+ displayUrl: z.string().nullable().describe('Main display image URL'),
18
+ hashtags: z.array(z.string()).nullable().describe('Hashtags in the post'),
19
+ });
20
+ const InstagramProfileSchema = z.object({
21
+ username: z.string().describe('Instagram username'),
22
+ fullName: z.string().nullable().describe('Full name'),
23
+ bio: z.string().nullable().describe('Profile bio'),
24
+ followersCount: z.number().nullable().describe('Number of followers'),
25
+ followingCount: z.number().nullable().describe('Number of following'),
26
+ postsCount: z.number().nullable().describe('Total posts'),
27
+ isVerified: z.boolean().nullable().describe('Verification status'),
28
+ profilePicUrl: z.string().nullable().describe('Profile picture URL'),
29
+ });
30
+ // Gemini-compatible single object schema with optional fields
31
+ const InstagramToolParamsSchema = z.object({
32
+ operation: z
33
+ .enum(['scrapeProfile', 'scrapeHashtag'])
34
+ .describe('Operation to perform: scrapeProfile for user profiles, scrapeHashtag for hashtag posts'),
35
+ // Profile scraping fields (optional)
36
+ profiles: z
37
+ .array(z.string())
38
+ .optional()
39
+ .describe('Instagram usernames or profile URLs to scrape (for scrapeProfile operation). Examples: ["@username", "https://www.instagram.com/username/"]'),
40
+ // Hashtag scraping fields (optional)
41
+ hashtags: z
42
+ .array(z.string())
43
+ .optional()
44
+ .describe('Hashtags to scrape (for scrapeHashtag operation). Examples: ["ai", "tech"] or ["https://www.instagram.com/explore/tags/ai"]'),
45
+ // Common fields
46
+ limit: z
47
+ .number()
48
+ .min(1)
49
+ .max(1000)
50
+ .default(20)
51
+ .optional()
52
+ .describe('Maximum number of posts to fetch (default: 20 for profiles, 50 for hashtags)'),
53
+ credentials: z
54
+ .record(z.nativeEnum(CredentialType), z.string())
55
+ .optional()
56
+ .describe('Required credentials (auto-injected)'),
57
+ });
58
+ // Gemini-compatible single result schema
59
+ const InstagramToolResultSchema = z.object({
60
+ operation: z
61
+ .enum(['scrapeProfile', 'scrapeHashtag'])
62
+ .describe('Operation that was performed'),
63
+ // Posts data (always present)
64
+ posts: z
65
+ .array(InstagramPostSchema)
66
+ .describe('Array of Instagram posts scraped'),
67
+ // Profile data (only for scrapeProfile operation)
68
+ profiles: z
69
+ .array(InstagramProfileSchema)
70
+ .optional()
71
+ .describe('Profile information for each scraped profile (only for scrapeProfile operation)'),
72
+ // Hashtag data (only for scrapeHashtag operation)
73
+ scrapedHashtags: z
74
+ .array(z.string())
75
+ .optional()
76
+ .describe('List of hashtags that were scraped (only for scrapeHashtag operation)'),
77
+ // Profile data (only for scrapeProfile operation)
78
+ scrapedProfiles: z
79
+ .array(z.string())
80
+ .optional()
81
+ .describe('List of profile usernames that were scraped (only for scrapeProfile operation)'),
82
+ // Common fields
83
+ totalPosts: z.number().describe('Total number of posts scraped'),
84
+ success: z.boolean().describe('Whether the operation was successful'),
85
+ error: z.string().describe('Error message if operation failed'),
86
+ });
87
+ /**
88
+ * Generic Instagram scraping tool with unified interface
89
+ *
90
+ * This tool abstracts away the underlying scraping service (currently Apify)
91
+ * and provides a simple, opinionated interface for Instagram data extraction.
92
+ *
93
+ * Supports two operations:
94
+ * - scrapeProfile: Scrape user profiles and their posts
95
+ * - scrapeHashtag: Scrape posts by hashtag
96
+ *
97
+ * Future versions can add support for other services (BrightData, custom scrapers)
98
+ * while maintaining the same interface.
99
+ */
100
+ export class InstagramTool extends ToolBubble {
101
+ // Required static metadata
102
+ static bubbleName = 'instagram-tool';
103
+ static schema = InstagramToolParamsSchema;
104
+ static resultSchema = InstagramToolResultSchema;
105
+ static shortDescription = 'Scrape Instagram profiles and posts with a simple, unified interface. Works with individual user profiles and hashtags.';
106
+ static longDescription = `
107
+ Universal Instagram scraping tool that provides a simple, opinionated interface for extracting Instagram data.
108
+
109
+ **OPERATIONS:**
110
+ 1. **scrapeProfile**: Scrape user profiles and their posts
111
+ - Get profile information (bio, followers, verified status)
112
+ - Fetch recent posts from specific users
113
+ - Track influencer or brand accounts
114
+
115
+ 2. **scrapeHashtag**: Scrape posts by hashtag
116
+ - Find trending content by hashtag
117
+ - Monitor brand mentions and campaigns
118
+ - Research hashtag performance
119
+
120
+ **WHEN TO USE THIS TOOL:**
121
+ - **Any Instagram scraping task** - profiles, posts, hashtags, engagement data
122
+ - **Social media research** - influencer analysis, competitor monitoring
123
+ - **Content gathering** - posts, captions, hashtags, engagement metrics
124
+ - **Market research** - brand mentions, user sentiment on Instagram
125
+ - **Trend analysis** - hashtag tracking, viral content discovery
126
+
127
+ **DO NOT USE research-agent-tool or web-scrape-tool for Instagram** - This tool is specifically optimized for Instagram and provides:
128
+ - Unified data format across all Instagram sources
129
+ - Automatic service selection and optimization
130
+ - Rate limiting and reliability handling
131
+ - Clean, structured data ready for analysis
132
+
133
+ **Simple Interface:**
134
+ Just specify the operation and provide Instagram usernames/URLs or hashtags to get back clean, structured data.
135
+ The tool automatically handles:
136
+ - URL normalization (accepts usernames, profile URLs, hashtag URLs)
137
+ - Service selection (currently Apify, future: multiple sources)
138
+ - Data transformation to unified format
139
+ - Error handling and retries
140
+
141
+ **What you get:**
142
+ - Posts with captions, likes, comments, timestamps
143
+ - Profile information (for scrapeProfile operation)
144
+ - Hashtags and engagement metrics
145
+ - Owner information
146
+
147
+ **Use cases:**
148
+ - Influencer analysis and discovery
149
+ - Brand monitoring and sentiment analysis
150
+ - Competitor research on Instagram
151
+ - Content strategy and trend analysis
152
+ - Market research through Instagram data
153
+ - Campaign performance tracking
154
+ - Hashtag research and optimization
155
+
156
+ The tool uses best-available services behind the scenes while maintaining a consistent, simple interface.
157
+ `;
158
+ static alias = 'ig';
159
+ static type = 'tool';
160
+ constructor(params = {
161
+ operation: 'scrapeProfile',
162
+ profiles: ['@instagram'],
163
+ limit: 20,
164
+ }, context) {
165
+ super(params, context);
166
+ }
167
+ async performAction() {
168
+ const credentials = this.params?.credentials;
169
+ if (!credentials || !credentials[CredentialType.APIFY_CRED]) {
170
+ return this.createErrorResult('Instagram scraping requires authentication. Please configure APIFY_CRED.');
171
+ }
172
+ try {
173
+ const { operation } = this.params;
174
+ // Validate required fields based on operation
175
+ if (operation === 'scrapeProfile' &&
176
+ (!this.params.profiles || this.params.profiles.length === 0)) {
177
+ return this.createErrorResult('Profiles array is required for scrapeProfile operation');
178
+ }
179
+ if (operation === 'scrapeHashtag' &&
180
+ (!this.params.hashtags || this.params.hashtags.length === 0)) {
181
+ return this.createErrorResult('Hashtags array is required for scrapeHashtag operation');
182
+ }
183
+ const result = await (async () => {
184
+ switch (operation) {
185
+ case 'scrapeProfile':
186
+ return await this.handleScrapeProfile(this.params);
187
+ case 'scrapeHashtag':
188
+ return await this.handleScrapeHashtag(this.params);
189
+ default:
190
+ throw new Error(`Unsupported operation: ${operation}`);
191
+ }
192
+ })();
193
+ return result;
194
+ }
195
+ catch (error) {
196
+ return this.createErrorResult(error instanceof Error ? error.message : 'Unknown error occurred');
197
+ }
198
+ }
199
+ /**
200
+ * Create an error result
201
+ */
202
+ createErrorResult(errorMessage) {
203
+ const { operation } = this.params;
204
+ return {
205
+ operation: operation || 'scrapeProfile',
206
+ posts: [],
207
+ profiles: operation === 'scrapeProfile' ? [] : undefined,
208
+ scrapedProfiles: operation === 'scrapeProfile' ? [] : undefined,
209
+ scrapedHashtags: operation === 'scrapeHashtag' ? [] : undefined,
210
+ totalPosts: 0,
211
+ success: false,
212
+ error: errorMessage,
213
+ };
214
+ }
215
+ /**
216
+ * Handle scrapeProfile operation
217
+ */
218
+ async handleScrapeProfile(params) {
219
+ // Normalize profile inputs to URLs
220
+ const instagramUrls = this.normalizeProfiles(params.profiles);
221
+ // Use Apify service to scrape profiles
222
+ const result = await this.scrapeWithApifyProfiles(instagramUrls, params.limit || 20);
223
+ return {
224
+ operation: 'scrapeProfile',
225
+ posts: result.posts,
226
+ profiles: result.profiles,
227
+ scrapedProfiles: result.scrapedProfiles,
228
+ totalPosts: result.totalPosts,
229
+ success: result.success,
230
+ error: result.error,
231
+ };
232
+ }
233
+ /**
234
+ * Handle scrapeHashtag operation
235
+ */
236
+ async handleScrapeHashtag(params) {
237
+ // Use Apify service to scrape hashtags
238
+ const result = await this.scrapeWithApifyHashtags(params.hashtags, params.limit || 50, params.credentials);
239
+ return {
240
+ operation: 'scrapeHashtag',
241
+ posts: result.posts,
242
+ scrapedHashtags: result.scrapedHashtags,
243
+ totalPosts: result.totalPosts,
244
+ success: result.success,
245
+ error: result.error,
246
+ };
247
+ }
248
+ /**
249
+ * Scrape hashtags using Apify service
250
+ * This is the current implementation - future versions could add other services
251
+ */
252
+ async scrapeWithApifyHashtags(hashtags, limit, credentials) {
253
+ // Normalize hashtags for Apify (remove # symbol and clean format)
254
+ const normalizedHashtags = this.normalizeHashtags(hashtags);
255
+ const scrape_hashtag_apify = new ApifyBubble({
256
+ actorId: 'apify/instagram-hashtag-scraper',
257
+ input: {
258
+ hashtags: normalizedHashtags,
259
+ resultsLimit: limit,
260
+ },
261
+ waitForFinish: true,
262
+ timeout: 180000, // 3 minutes
263
+ credentials,
264
+ }, this.context);
265
+ const apifyResult = await scrape_hashtag_apify.action();
266
+ if (!apifyResult.data.success) {
267
+ return {
268
+ posts: [],
269
+ totalPosts: 0,
270
+ scrapedHashtags: hashtags,
271
+ success: false,
272
+ error: apifyResult.data.error ||
273
+ 'Failed to scrape Instagram hashtags. Please try again.',
274
+ };
275
+ }
276
+ const items = apifyResult.data.items || [];
277
+ // Transform hashtag scraper results to unified post format
278
+ const posts = this.extractHashtagPosts(items);
279
+ return {
280
+ posts,
281
+ totalPosts: posts.length,
282
+ scrapedHashtags: hashtags,
283
+ success: true,
284
+ error: '',
285
+ };
286
+ }
287
+ /**
288
+ * Normalize various profile inputs to Instagram URLs
289
+ * Accepts: @username, username, https://instagram.com/username/
290
+ */
291
+ normalizeProfiles(profiles) {
292
+ return profiles.map((profile) => {
293
+ // Already a full URL
294
+ if (profile.startsWith('https://www.instagram.com/')) {
295
+ return profile;
296
+ }
297
+ // Remove @ if present
298
+ const cleanUsername = profile.startsWith('@')
299
+ ? profile.slice(1)
300
+ : profile;
301
+ // Convert to profile URL
302
+ return `https://www.instagram.com/${cleanUsername}/`;
303
+ });
304
+ }
305
+ /**
306
+ * Normalize hashtags for Apify actor
307
+ * Removes # symbol and cleans format to match Apify requirements
308
+ */
309
+ normalizeHashtags(hashtags) {
310
+ return hashtags.map((hashtag) => {
311
+ // Remove # symbol if present
312
+ let cleanHashtag = hashtag.startsWith('#') ? hashtag.slice(1) : hashtag;
313
+ // Remove any URL parts if it's a full Instagram hashtag URL
314
+ if (cleanHashtag.includes('instagram.com/explore/tags/')) {
315
+ cleanHashtag = cleanHashtag.split('instagram.com/explore/tags/')[1];
316
+ // Remove any trailing slashes or query parameters
317
+ cleanHashtag = cleanHashtag.split('/')[0].split('?')[0];
318
+ }
319
+ // Clean any remaining special characters that Apify doesn't like
320
+ // Keep only alphanumeric characters and underscores
321
+ cleanHashtag = cleanHashtag.replace(/[^a-zA-Z0-9_]/g, '');
322
+ return cleanHashtag;
323
+ });
324
+ }
325
+ /**
326
+ * Scrape profiles using Apify service
327
+ * This is the current implementation - future versions could add other services
328
+ * Always fetches both profile details and posts for maximum flexibility
329
+ */
330
+ async scrapeWithApifyProfiles(urls, limit) {
331
+ // Always use 'details' to get both profile information AND posts
332
+ const scrape_profile_apify = new ApifyBubble({
333
+ actorId: 'apify/instagram-scraper',
334
+ input: {
335
+ directUrls: urls,
336
+ resultsType: 'details', // Always fetch full details (profile + posts)
337
+ resultsLimit: limit,
338
+ },
339
+ waitForFinish: true,
340
+ timeout: 180000, // 3 minutes
341
+ credentials: this.params.credentials,
342
+ }, this.context);
343
+ const apifyResult = await scrape_profile_apify.action();
344
+ if (!apifyResult.data.success) {
345
+ return {
346
+ posts: [],
347
+ profiles: [],
348
+ totalPosts: 0,
349
+ scrapedProfiles: urls.map(this.extractUsername),
350
+ success: false,
351
+ error: apifyResult.data.error ||
352
+ 'Failed to scrape Instagram. Please try again.',
353
+ };
354
+ }
355
+ // Now items is automatically typed as InstagramPost[] - no casting needed!
356
+ const items = apifyResult.data.items || [];
357
+ // Extract posts from the results
358
+ const posts = this.extractPosts(items);
359
+ // Extract profile information from the results
360
+ const profiles = this.extractProfileInfo(items);
361
+ return {
362
+ posts,
363
+ profiles,
364
+ totalPosts: posts.length,
365
+ scrapedProfiles: urls.map(this.extractUsername),
366
+ success: true,
367
+ error: '',
368
+ };
369
+ }
370
+ /**
371
+ * Extract username from Instagram URL
372
+ */
373
+ extractUsername(url) {
374
+ const match = url.match(/instagram\.com\/([^/?]+)/);
375
+ return match ? match[1] : url;
376
+ }
377
+ /**
378
+ * Normalize post type to standard enum
379
+ */
380
+ normalizePostType(type) {
381
+ if (!type)
382
+ return null;
383
+ const normalized = type.toLowerCase();
384
+ if (normalized === 'image' || normalized === 'photo')
385
+ return 'image';
386
+ if (normalized === 'video')
387
+ return 'video';
388
+ if (normalized === 'carousel' || normalized === 'sidecar')
389
+ return 'carousel';
390
+ return null;
391
+ }
392
+ /**
393
+ * Extract posts from Apify results
394
+ * Handles both 'details' and 'posts' resultsType formats
395
+ */
396
+ extractPosts(items) {
397
+ const posts = [];
398
+ for (const item of items) {
399
+ if (typeof item !== 'object' || item === null)
400
+ continue;
401
+ const anyItem = item;
402
+ // Check if this item has posts nested (details format)
403
+ if (anyItem.latestPosts && Array.isArray(anyItem.latestPosts)) {
404
+ // Format from 'details' resultsType - posts are nested
405
+ for (const post of anyItem.latestPosts) {
406
+ posts.push({
407
+ url: post.url || null,
408
+ caption: post.caption || null,
409
+ likesCount: post.likesCount || null,
410
+ commentsCount: post.commentsCount || null,
411
+ ownerUsername: anyItem.username || post.ownerUsername || null,
412
+ timestamp: post.timestamp || null,
413
+ type: this.normalizePostType(post.type),
414
+ displayUrl: post.displayUrl || null,
415
+ hashtags: post.hashtags || null,
416
+ });
417
+ }
418
+ }
419
+ }
420
+ return posts;
421
+ }
422
+ /**
423
+ * Extract profile information from Apify results
424
+ * Handles the 'details' resultsType format
425
+ */
426
+ extractProfileInfo(items) {
427
+ const profiles = [];
428
+ for (const item of items) {
429
+ if (typeof item !== 'object' || item === null)
430
+ continue;
431
+ const anyItem = item;
432
+ // Check if this item has profile-level information (details format)
433
+ if (anyItem.username) {
434
+ profiles.push({
435
+ username: anyItem.username || '',
436
+ fullName: anyItem.fullName || '',
437
+ bio: anyItem.biography || '',
438
+ followersCount: anyItem.followersCount || 0,
439
+ followingCount: anyItem.followsCount || 0,
440
+ postsCount: anyItem.postsCount || null,
441
+ isVerified: anyItem.verified || false,
442
+ profilePicUrl: anyItem.profilePicUrl || '',
443
+ });
444
+ }
445
+ }
446
+ return profiles;
447
+ }
448
+ /**
449
+ * Extract posts from hashtag scraper results
450
+ * Hashtag scraper returns posts directly (not nested)
451
+ */
452
+ extractHashtagPosts(items) {
453
+ const posts = [];
454
+ for (const item of items) {
455
+ if (typeof item !== 'object' || item === null)
456
+ continue;
457
+ const anyItem = item;
458
+ // Hashtag scraper returns posts directly at the top level
459
+ posts.push({
460
+ url: anyItem.url || null,
461
+ caption: anyItem.caption || null,
462
+ likesCount: anyItem.likesCount || null,
463
+ commentsCount: anyItem.commentsCount || null,
464
+ ownerUsername: anyItem.ownerUsername || null,
465
+ timestamp: anyItem.timestamp || null,
466
+ type: this.normalizePostType(anyItem.type),
467
+ displayUrl: anyItem.displayUrl || null,
468
+ hashtags: anyItem.hashtags || null,
469
+ });
470
+ }
471
+ return posts;
472
+ }
473
+ }
474
+ //# sourceMappingURL=instagram-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instagram-tool.js","sourceRoot":"","sources":["../../../src/bubbles/tool-bubble/instagram-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAmB,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAG/D,kDAAkD;AAClD,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,CAAC,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