Skip to content

Commit 909144b

Browse files
Bill Leoutsakoscursoragent
authored andcommitted
fix(tiktok): add avatarFile output to Get User Info
Adds a file-typed avatarFile output (sourced from the largest available avatar URL) alongside the existing string avatar fields, so the profile picture can be materialized as a UserFile and chained into file-consuming blocks (e.g. attached to an email), per PR review feedback. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4f29765 commit 909144b

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

apps/docs/content/docs/en/integrations/tiktok.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Get the authenticated TikTok user profile information including display name, av
4646
| `followingCount` | number | Number of accounts the user follows |
4747
| `likesCount` | number | Total likes received across all videos |
4848
| `videoCount` | number | Total number of public videos |
49+
| `avatarFile` | file | Downloadable copy of the profile avatar image \(largest available variant\), stored as a workflow file so it can be chained into file-consuming blocks \(e.g. attached to an email\). |
4950

5051
### `tiktok_list_videos`
5152

apps/sim/blocks/blocks/tiktok.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,12 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
584584
description: 'Total number of public videos',
585585
condition: { field: 'operation', value: 'tiktok_get_user' },
586586
},
587+
avatarFile: {
588+
type: 'file',
589+
description:
590+
'Downloadable copy of the profile avatar image, stored as a workflow file so it can be chained into file-consuming blocks (e.g. attached to an email).',
591+
condition: { field: 'operation', value: 'tiktok_get_user' },
592+
},
587593

588594
// List/Query Videos
589595
videos: {

apps/sim/tools/tiktok/get_user.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ export const tiktokGetUserTool: ToolConfig<TikTokGetUserParams, TikTokGetUserRes
9595
}
9696
}
9797

98+
const avatarSourceUrl = user.avatar_large_url ?? user.avatar_url
99+
const avatarFileName = `${user.username || user.open_id || 'tiktok-user'}-avatar.jpg`
100+
98101
return {
99102
success: true,
100103
output: {
@@ -112,6 +115,13 @@ export const tiktokGetUserTool: ToolConfig<TikTokGetUserParams, TikTokGetUserRes
112115
followingCount: user.following_count ?? null,
113116
likesCount: user.likes_count ?? null,
114117
videoCount: user.video_count ?? null,
118+
...(avatarSourceUrl && {
119+
avatarFile: {
120+
name: avatarFileName,
121+
mimeType: 'image/jpeg',
122+
url: avatarSourceUrl,
123+
},
124+
}),
115125
},
116126
}
117127
},
@@ -185,5 +195,11 @@ export const tiktokGetUserTool: ToolConfig<TikTokGetUserParams, TikTokGetUserRes
185195
description: 'Total number of public videos',
186196
optional: true,
187197
},
198+
avatarFile: {
199+
type: 'file',
200+
description:
201+
'Downloadable copy of the profile avatar image (largest available variant), stored as a workflow file so it can be chained into file-consuming blocks (e.g. attached to an email).',
202+
optional: true,
203+
},
188204
},
189205
}

apps/sim/tools/tiktok/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export interface TikTokGetUserResponse extends ToolResponse {
3131
followingCount: number | null
3232
likesCount: number | null
3333
videoCount: number | null
34+
avatarFile?: {
35+
name: string
36+
mimeType: string
37+
url: string
38+
}
3439
}
3540
}
3641

0 commit comments

Comments
 (0)