@framers/agentos-ext-channel-tiktok 0.1.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/LICENSE +98 -0
- package/dist/TikTokChannelAdapter.d.ts +30 -0
- package/dist/TikTokChannelAdapter.d.ts.map +1 -0
- package/dist/TikTokChannelAdapter.js +112 -0
- package/dist/TikTokChannelAdapter.js.map +1 -0
- package/dist/TikTokService.d.ts +107 -0
- package/dist/TikTokService.d.ts.map +1 -0
- package/dist/TikTokService.js +241 -0
- package/dist/TikTokService.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/analytics.d.ts +36 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +48 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/discover.d.ts +30 -0
- package/dist/tools/discover.d.ts.map +1 -0
- package/dist/tools/discover.js +37 -0
- package/dist/tools/discover.js.map +1 -0
- package/dist/tools/engage.d.ts +41 -0
- package/dist/tools/engage.d.ts.map +1 -0
- package/dist/tools/engage.js +53 -0
- package/dist/tools/engage.js.map +1 -0
- package/dist/tools/search.d.ts +46 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +53 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/trending.d.ts +36 -0
- package/dist/tools/trending.d.ts.map +1 -0
- package/dist/tools/trending.js +50 -0
- package/dist/tools/trending.js.map +1 -0
- package/dist/tools/upload.d.ts +69 -0
- package/dist/tools/upload.d.ts.map +1 -0
- package/dist/tools/upload.js +61 -0
- package/dist/tools/upload.js.map +1 -0
- package/manifest.json +30 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License.
|
|
30
|
+
|
|
31
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License.
|
|
34
|
+
|
|
35
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
36
|
+
|
|
37
|
+
4. Redistribution.
|
|
38
|
+
|
|
39
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
40
|
+
|
|
41
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
42
|
+
|
|
43
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
44
|
+
|
|
45
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
+
|
|
47
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
48
|
+
|
|
49
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
50
|
+
|
|
51
|
+
5. Submission of Contributions.
|
|
52
|
+
|
|
53
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
54
|
+
|
|
55
|
+
6. Trademarks.
|
|
56
|
+
|
|
57
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
58
|
+
|
|
59
|
+
7. Disclaimer of Warranty.
|
|
60
|
+
|
|
61
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
62
|
+
|
|
63
|
+
8. Limitation of Liability.
|
|
64
|
+
|
|
65
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
66
|
+
|
|
67
|
+
9. Accepting Warranty or Additional Liability.
|
|
68
|
+
|
|
69
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
70
|
+
|
|
71
|
+
END OF TERMS AND CONDITIONS
|
|
72
|
+
|
|
73
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
74
|
+
|
|
75
|
+
To apply the Apache License to your work, attach the following
|
|
76
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
77
|
+
replaced with your own identifying information. (Don't include
|
|
78
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
79
|
+
comment syntax for the file format. We also recommend that a
|
|
80
|
+
file or class name and description of purpose be included on the
|
|
81
|
+
same "printed page" as the copyright notice for easier
|
|
82
|
+
identification within third-party archives.
|
|
83
|
+
|
|
84
|
+
Copyright (c) 2025 Framers
|
|
85
|
+
|
|
86
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
+
you may not use this file except in compliance with the License.
|
|
88
|
+
You may obtain a copy of the License at
|
|
89
|
+
|
|
90
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
+
|
|
92
|
+
Unless required by applicable law or agreed to in writing, software
|
|
93
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
+
See the License for the specific language governing permissions and
|
|
96
|
+
limitations under the License.
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview IChannelAdapter implementation for TikTok.
|
|
3
|
+
*
|
|
4
|
+
* TikTok is a video-first content platform. The adapter focuses on
|
|
5
|
+
* outbound video publishing and content discovery. Inbound events
|
|
6
|
+
* are limited as TikTok's API does not provide real-time messaging.
|
|
7
|
+
*/
|
|
8
|
+
import type { IChannelAdapter, ChannelPlatform, ChannelCapability, ChannelAuthConfig, ChannelConnectionInfo, ChannelSendResult, MessageContent, ChannelEventHandler, ChannelEventType } from '@framers/agentos';
|
|
9
|
+
import { TikTokService } from './TikTokService';
|
|
10
|
+
export declare class TikTokChannelAdapter implements IChannelAdapter {
|
|
11
|
+
private readonly service;
|
|
12
|
+
readonly platform: ChannelPlatform;
|
|
13
|
+
readonly displayName = "TikTok";
|
|
14
|
+
readonly capabilities: readonly ChannelCapability[];
|
|
15
|
+
private handlers;
|
|
16
|
+
constructor(service: TikTokService);
|
|
17
|
+
initialize(_auth: ChannelAuthConfig): Promise<void>;
|
|
18
|
+
shutdown(): Promise<void>;
|
|
19
|
+
getConnectionInfo(): ChannelConnectionInfo;
|
|
20
|
+
sendMessage(conversationId: string, content: MessageContent): Promise<ChannelSendResult>;
|
|
21
|
+
sendTypingIndicator(_conversationId: string, _isTyping: boolean): Promise<void>;
|
|
22
|
+
on(handler: ChannelEventHandler, eventTypes?: ChannelEventType[]): () => void;
|
|
23
|
+
getConversationInfo(_conversationId: string): Promise<{
|
|
24
|
+
name?: string;
|
|
25
|
+
memberCount?: number;
|
|
26
|
+
isGroup: boolean;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=TikTokChannelAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TikTokChannelAdapter.d.ts","sourceRoot":"","sources":["../src/TikTokChannelAdapter.ts"],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strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview IChannelAdapter implementation for TikTok.
|
|
5
|
+
*
|
|
6
|
+
* TikTok is a video-first content platform. The adapter focuses on
|
|
7
|
+
* outbound video publishing and content discovery. Inbound events
|
|
8
|
+
* are limited as TikTok's API does not provide real-time messaging.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.TikTokChannelAdapter = void 0;
|
|
12
|
+
class TikTokChannelAdapter {
|
|
13
|
+
constructor(service) {
|
|
14
|
+
this.service = service;
|
|
15
|
+
this.platform = 'tiktok';
|
|
16
|
+
this.displayName = 'TikTok';
|
|
17
|
+
this.capabilities = [
|
|
18
|
+
'video',
|
|
19
|
+
'reels',
|
|
20
|
+
'reactions',
|
|
21
|
+
'hashtags',
|
|
22
|
+
'engagement_metrics',
|
|
23
|
+
'content_discovery',
|
|
24
|
+
];
|
|
25
|
+
this.handlers = new Map();
|
|
26
|
+
}
|
|
27
|
+
async initialize(_auth) {
|
|
28
|
+
// TikTok does not support real-time inbound messaging via API.
|
|
29
|
+
// Adapter is primarily for outbound content publishing.
|
|
30
|
+
}
|
|
31
|
+
async shutdown() {
|
|
32
|
+
this.handlers.clear();
|
|
33
|
+
}
|
|
34
|
+
getConnectionInfo() {
|
|
35
|
+
return {
|
|
36
|
+
status: this.service.isRunning ? 'connected' : 'disconnected',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async sendMessage(conversationId, content) {
|
|
40
|
+
// On TikTok, "sending a message" means publishing a video.
|
|
41
|
+
// conversationId is unused but kept for interface compliance.
|
|
42
|
+
const videoBlock = content.blocks.find((b) => b.type === 'video');
|
|
43
|
+
const reelBlock = content.blocks.find((b) => b.type === 'reel');
|
|
44
|
+
const textBlock = content.blocks.find((b) => b.type === 'text');
|
|
45
|
+
let videoUrl;
|
|
46
|
+
let caption;
|
|
47
|
+
let hashtags;
|
|
48
|
+
if (reelBlock && reelBlock.type === 'reel') {
|
|
49
|
+
videoUrl = reelBlock.videoUrl;
|
|
50
|
+
caption = reelBlock.caption ?? '';
|
|
51
|
+
hashtags = reelBlock.hashtags;
|
|
52
|
+
}
|
|
53
|
+
else if (videoBlock && videoBlock.type === 'video') {
|
|
54
|
+
videoUrl = videoBlock.url;
|
|
55
|
+
caption = videoBlock.caption ?? '';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error('TikTok requires a video or reel content block for publishing');
|
|
59
|
+
}
|
|
60
|
+
// Override caption with text block if present
|
|
61
|
+
if (textBlock && textBlock.type === 'text' && !caption) {
|
|
62
|
+
caption = textBlock.text;
|
|
63
|
+
}
|
|
64
|
+
// Merge hashtags from platform options
|
|
65
|
+
if (content.platformOptions?.['hashtags']) {
|
|
66
|
+
const extraTags = content.platformOptions['hashtags'];
|
|
67
|
+
hashtags = [...(hashtags ?? []), ...extraTags];
|
|
68
|
+
}
|
|
69
|
+
const privacyLevel = content.platformOptions?.['privacyLevel'];
|
|
70
|
+
const result = await this.service.uploadVideo({
|
|
71
|
+
videoUrl,
|
|
72
|
+
caption,
|
|
73
|
+
hashtags,
|
|
74
|
+
privacyLevel,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
messageId: result.id,
|
|
78
|
+
timestamp: result.createTime
|
|
79
|
+
? new Date(result.createTime * 1000).toISOString()
|
|
80
|
+
: new Date().toISOString(),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async sendTypingIndicator(_conversationId, _isTyping) {
|
|
84
|
+
// TikTok does not support typing indicators — no-op
|
|
85
|
+
}
|
|
86
|
+
on(handler, eventTypes) {
|
|
87
|
+
this.handlers.set(handler, eventTypes);
|
|
88
|
+
return () => {
|
|
89
|
+
this.handlers.delete(handler);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async getConversationInfo(_conversationId) {
|
|
93
|
+
try {
|
|
94
|
+
const me = await this.service.getMe();
|
|
95
|
+
return {
|
|
96
|
+
name: me.displayName ?? me.username,
|
|
97
|
+
memberCount: me.followerCount,
|
|
98
|
+
isGroup: false,
|
|
99
|
+
metadata: {
|
|
100
|
+
username: me.username,
|
|
101
|
+
videoCount: me.videoCount,
|
|
102
|
+
likeCount: me.likeCount,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return { isGroup: false };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.TikTokChannelAdapter = TikTokChannelAdapter;
|
|
112
|
+
//# sourceMappingURL=TikTokChannelAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TikTokChannelAdapter.js","sourceRoot":"","sources":["../src/TikTokChannelAdapter.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;GAMG;;;AAeH,MAAa,oBAAoB;IAc/B,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAb1C,aAAQ,GAAoB,QAAQ,CAAC;QACrC,gBAAW,GAAG,QAAQ,CAAC;QACvB,iBAAY,GAAiC;YACpD,OAAO;YACP,OAAO;YACP,WAAW;YACX,UAAU;YACV,oBAAoB;YACpB,mBAAmB;SACX,CAAC;QAEH,aAAQ,GAAG,IAAI,GAAG,EAAuD,CAAC;IAE5B,CAAC;IAEvD,KAAK,CAAC,UAAU,CAAC,KAAwB;QACvC,+DAA+D;QAC/D,wDAAwD;IAC1D,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED,iBAAiB;QACf,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc;SAC9D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,cAAsB,EAAE,OAAuB;QAC/D,2DAA2D;QAC3D,8DA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E,EAAE,CAAC,UAAU;oBACzB,SAAS,EAAE,EAAE,CAAC,SAAS;iBACxB;aACF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AArHD,oDAqHC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TikTok API for Business service layer.
|
|
3
|
+
*
|
|
4
|
+
* Wraps TikTok API for Business via axios for video upload,
|
|
5
|
+
* trending content, search, analytics, engagement, and discovery.
|
|
6
|
+
*/
|
|
7
|
+
export interface TikTokConfig {
|
|
8
|
+
accessToken: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
password?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VideoUploadOptions {
|
|
13
|
+
videoUrl: string;
|
|
14
|
+
caption: string;
|
|
15
|
+
hashtags?: string[];
|
|
16
|
+
privacyLevel?: 'PUBLIC_TO_EVERYONE' | 'MUTUAL_FOLLOW_FRIENDS' | 'FOLLOWER_OF_CREATOR' | 'SELF_ONLY';
|
|
17
|
+
disableComment?: boolean;
|
|
18
|
+
disableDuet?: boolean;
|
|
19
|
+
disableStitch?: boolean;
|
|
20
|
+
coverTimestampMs?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface VideoResult {
|
|
23
|
+
id: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
createTime?: number;
|
|
27
|
+
coverUrl?: string;
|
|
28
|
+
shareUrl?: string;
|
|
29
|
+
duration?: number;
|
|
30
|
+
metrics?: {
|
|
31
|
+
views: number;
|
|
32
|
+
likes: number;
|
|
33
|
+
comments: number;
|
|
34
|
+
shares: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface SearchOptions {
|
|
38
|
+
query: string;
|
|
39
|
+
type?: 'video' | 'user';
|
|
40
|
+
maxResults?: number;
|
|
41
|
+
cursor?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface TrendingResult {
|
|
44
|
+
type: 'hashtag' | 'sound';
|
|
45
|
+
name: string;
|
|
46
|
+
id?: string;
|
|
47
|
+
videoCount?: number;
|
|
48
|
+
viewCount?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface AnalyticsResult {
|
|
51
|
+
videoId: string;
|
|
52
|
+
metrics: {
|
|
53
|
+
views: number;
|
|
54
|
+
likes: number;
|
|
55
|
+
comments: number;
|
|
56
|
+
shares: number;
|
|
57
|
+
avgWatchTime?: number;
|
|
58
|
+
totalWatchTime?: number;
|
|
59
|
+
reach?: number;
|
|
60
|
+
fullVideoWatchedRate?: number;
|
|
61
|
+
};
|
|
62
|
+
dateRange?: {
|
|
63
|
+
start: string;
|
|
64
|
+
end: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface CreatorResult {
|
|
68
|
+
id: string;
|
|
69
|
+
username: string;
|
|
70
|
+
displayName?: string;
|
|
71
|
+
avatarUrl?: string;
|
|
72
|
+
followerCount?: number;
|
|
73
|
+
followingCount?: number;
|
|
74
|
+
likeCount?: number;
|
|
75
|
+
videoCount?: number;
|
|
76
|
+
}
|
|
77
|
+
export declare class TikTokService {
|
|
78
|
+
private client;
|
|
79
|
+
private running;
|
|
80
|
+
private readonly config;
|
|
81
|
+
constructor(config: TikTokConfig);
|
|
82
|
+
initialize(): Promise<void>;
|
|
83
|
+
shutdown(): Promise<void>;
|
|
84
|
+
get isRunning(): boolean;
|
|
85
|
+
uploadVideo(options: VideoUploadOptions): Promise<VideoResult>;
|
|
86
|
+
getTrendingHashtags(maxResults?: number): Promise<TrendingResult[]>;
|
|
87
|
+
getTrendingSounds(maxResults?: number): Promise<TrendingResult[]>;
|
|
88
|
+
searchVideos(options: SearchOptions): Promise<VideoResult[]>;
|
|
89
|
+
searchUsers(query: string, maxResults?: number): Promise<CreatorResult[]>;
|
|
90
|
+
getVideoAnalytics(videoId: string): Promise<AnalyticsResult>;
|
|
91
|
+
getCreatorAnalytics(): Promise<{
|
|
92
|
+
followerCount: number;
|
|
93
|
+
followingCount: number;
|
|
94
|
+
likeCount: number;
|
|
95
|
+
videoCount: number;
|
|
96
|
+
}>;
|
|
97
|
+
likeVideo(videoId: string): Promise<void>;
|
|
98
|
+
commentOnVideo(videoId: string, text: string): Promise<{
|
|
99
|
+
commentId: string;
|
|
100
|
+
}>;
|
|
101
|
+
getRecommendedVideos(maxResults?: number): Promise<VideoResult[]>;
|
|
102
|
+
getMe(): Promise<CreatorResult>;
|
|
103
|
+
private requireClient;
|
|
104
|
+
private mapVideoResult;
|
|
105
|
+
private appendHashtags;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=TikTokService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TikTokService.d.ts","sourceRoot":"","sources":["../src/TikTokService.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAQH,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,oBAAoB,GAAG,uBAAuB,GAAG,qBAAqB,GAAG,WAAW,CAAC;IACpG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QA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QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAW7E,oBAAoB,CAAC,UAAU,GAAE,MAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAYrE,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC;IAoBrC,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;CAKvB"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview TikTok API for Business service layer.
|
|
5
|
+
*
|
|
6
|
+
* Wraps TikTok API for Business via axios for video upload,
|
|
7
|
+
* trending content, search, analytics, engagement, and discovery.
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TikTokService = void 0;
|
|
14
|
+
const axios_1 = __importDefault(require("axios"));
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Service
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
const BASE_URL = 'https://open.tiktokapis.com/v2';
|
|
19
|
+
class TikTokService {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.client = null;
|
|
22
|
+
this.running = false;
|
|
23
|
+
this.config = config;
|
|
24
|
+
}
|
|
25
|
+
async initialize() {
|
|
26
|
+
if (this.running)
|
|
27
|
+
return;
|
|
28
|
+
this.client = axios_1.default.create({
|
|
29
|
+
baseURL: BASE_URL,
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${this.config.accessToken}`,
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
},
|
|
34
|
+
timeout: 60000,
|
|
35
|
+
});
|
|
36
|
+
this.running = true;
|
|
37
|
+
}
|
|
38
|
+
async shutdown() {
|
|
39
|
+
this.client = null;
|
|
40
|
+
this.running = false;
|
|
41
|
+
}
|
|
42
|
+
get isRunning() {
|
|
43
|
+
return this.running;
|
|
44
|
+
}
|
|
45
|
+
// ── Video Upload ──
|
|
46
|
+
async uploadVideo(options) {
|
|
47
|
+
const client = this.requireClient();
|
|
48
|
+
const caption = this.appendHashtags(options.caption, options.hashtags);
|
|
49
|
+
// Step 1: Initialize upload
|
|
50
|
+
const initResponse = await client.post('/post/publish/inbox/video/init/', {
|
|
51
|
+
source_info: {
|
|
52
|
+
source: 'PULL_FROM_URL',
|
|
53
|
+
video_url: options.videoUrl,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const publishId = initResponse.data.data?.publish_id;
|
|
57
|
+
// Step 2: Publish with metadata
|
|
58
|
+
const publishResponse = await client.post('/post/publish/video/init/', {
|
|
59
|
+
post_info: {
|
|
60
|
+
title: caption,
|
|
61
|
+
privacy_level: options.privacyLevel ?? 'PUBLIC_TO_EVERYONE',
|
|
62
|
+
disable_comment: options.disableComment ?? false,
|
|
63
|
+
disable_duet: options.disableDuet ?? false,
|
|
64
|
+
disable_stitch: options.disableStitch ?? false,
|
|
65
|
+
video_cover_timestamp_ms: options.coverTimestampMs ?? 0,
|
|
66
|
+
},
|
|
67
|
+
source_info: {
|
|
68
|
+
source: 'PULL_FROM_URL',
|
|
69
|
+
video_url: options.videoUrl,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const data = publishResponse.data.data ?? {};
|
|
73
|
+
return {
|
|
74
|
+
id: data.publish_id ?? publishId ?? '',
|
|
75
|
+
caption,
|
|
76
|
+
shareUrl: data.share_url,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// ── Trending ──
|
|
80
|
+
async getTrendingHashtags(maxResults = 20) {
|
|
81
|
+
const client = this.requireClient();
|
|
82
|
+
const response = await client.post('/research/hashtag/query/', {
|
|
83
|
+
max_count: Math.min(maxResults, 100),
|
|
84
|
+
});
|
|
85
|
+
return (response.data.data?.hashtags ?? []).map((h) => ({
|
|
86
|
+
type: 'hashtag',
|
|
87
|
+
name: h.hashtag_name ?? h.name ?? '',
|
|
88
|
+
id: h.id,
|
|
89
|
+
videoCount: h.video_count,
|
|
90
|
+
viewCount: h.view_count,
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
async getTrendingSounds(maxResults = 20) {
|
|
94
|
+
const client = this.requireClient();
|
|
95
|
+
const response = await client.post('/research/music/query/', {
|
|
96
|
+
max_count: Math.min(maxResults, 100),
|
|
97
|
+
});
|
|
98
|
+
return (response.data.data?.sounds ?? response.data.data?.music ?? []).map((s) => ({
|
|
99
|
+
type: 'sound',
|
|
100
|
+
name: s.title ?? s.name ?? '',
|
|
101
|
+
id: s.id,
|
|
102
|
+
videoCount: s.video_count,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
// ── Search ──
|
|
106
|
+
async searchVideos(options) {
|
|
107
|
+
const client = this.requireClient();
|
|
108
|
+
const response = await client.post('/research/video/query/', {
|
|
109
|
+
query: {
|
|
110
|
+
and: [{ operation: 'IN', field_name: 'keyword', field_values: [options.query] }],
|
|
111
|
+
},
|
|
112
|
+
max_count: Math.min(options.maxResults ?? 10, 100),
|
|
113
|
+
cursor: options.cursor ?? 0,
|
|
114
|
+
});
|
|
115
|
+
return (response.data.data?.videos ?? []).map((v) => this.mapVideoResult(v));
|
|
116
|
+
}
|
|
117
|
+
async searchUsers(query, maxResults = 10) {
|
|
118
|
+
const client = this.requireClient();
|
|
119
|
+
const response = await client.post('/research/user/query/', {
|
|
120
|
+
query: {
|
|
121
|
+
and: [{ operation: 'IN', field_name: 'keyword', field_values: [query] }],
|
|
122
|
+
},
|
|
123
|
+
max_count: Math.min(maxResults, 100),
|
|
124
|
+
});
|
|
125
|
+
return (response.data.data?.users ?? []).map((u) => ({
|
|
126
|
+
id: u.id ?? u.open_id ?? '',
|
|
127
|
+
username: u.username ?? '',
|
|
128
|
+
displayName: u.display_name,
|
|
129
|
+
avatarUrl: u.avatar_url,
|
|
130
|
+
followerCount: u.follower_count,
|
|
131
|
+
followingCount: u.following_count,
|
|
132
|
+
likeCount: u.likes_count ?? u.like_count,
|
|
133
|
+
videoCount: u.video_count,
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
// ── Analytics ──
|
|
137
|
+
async getVideoAnalytics(videoId) {
|
|
138
|
+
const client = this.requireClient();
|
|
139
|
+
const response = await client.post('/video/query/', {
|
|
140
|
+
filters: { video_ids: [videoId] },
|
|
141
|
+
fields: [
|
|
142
|
+
'id', 'title', 'video_description', 'create_time',
|
|
143
|
+
'like_count', 'comment_count', 'share_count', 'view_count',
|
|
144
|
+
],
|
|
145
|
+
});
|
|
146
|
+
const video = response.data.data?.videos?.[0] ?? {};
|
|
147
|
+
return {
|
|
148
|
+
videoId,
|
|
149
|
+
metrics: {
|
|
150
|
+
views: video.view_count ?? 0,
|
|
151
|
+
likes: video.like_count ?? 0,
|
|
152
|
+
comments: video.comment_count ?? 0,
|
|
153
|
+
shares: video.share_count ?? 0,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async getCreatorAnalytics() {
|
|
158
|
+
const client = this.requireClient();
|
|
159
|
+
const response = await client.get('/user/info/', {
|
|
160
|
+
params: { fields: 'follower_count,following_count,likes_count,video_count' },
|
|
161
|
+
});
|
|
162
|
+
const data = response.data.data?.user ?? {};
|
|
163
|
+
return {
|
|
164
|
+
followerCount: data.follower_count ?? 0,
|
|
165
|
+
followingCount: data.following_count ?? 0,
|
|
166
|
+
likeCount: data.likes_count ?? 0,
|
|
167
|
+
videoCount: data.video_count ?? 0,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
// ── Engagement ──
|
|
171
|
+
async likeVideo(videoId) {
|
|
172
|
+
const client = this.requireClient();
|
|
173
|
+
await client.post('/video/like/', { video_id: videoId });
|
|
174
|
+
}
|
|
175
|
+
async commentOnVideo(videoId, text) {
|
|
176
|
+
const client = this.requireClient();
|
|
177
|
+
const response = await client.post('/video/comment/', {
|
|
178
|
+
video_id: videoId,
|
|
179
|
+
text,
|
|
180
|
+
});
|
|
181
|
+
return { commentId: response.data.data?.comment_id ?? '' };
|
|
182
|
+
}
|
|
183
|
+
// ── Discovery (For You) ──
|
|
184
|
+
async getRecommendedVideos(maxResults = 20) {
|
|
185
|
+
const client = this.requireClient();
|
|
186
|
+
const response = await client.post('/video/list/', {
|
|
187
|
+
max_count: Math.min(maxResults, 20),
|
|
188
|
+
fields: ['id', 'title', 'video_description', 'create_time', 'cover_image_url', 'share_url', 'duration', 'like_count', 'comment_count', 'share_count', 'view_count'],
|
|
189
|
+
});
|
|
190
|
+
return (response.data.data?.videos ?? []).map((v) => this.mapVideoResult(v));
|
|
191
|
+
}
|
|
192
|
+
// ── User Info ──
|
|
193
|
+
async getMe() {
|
|
194
|
+
const client = this.requireClient();
|
|
195
|
+
const response = await client.get('/user/info/', {
|
|
196
|
+
params: { fields: 'open_id,union_id,avatar_url,display_name,username,follower_count,following_count,likes_count,video_count' },
|
|
197
|
+
});
|
|
198
|
+
const data = response.data.data?.user ?? {};
|
|
199
|
+
return {
|
|
200
|
+
id: data.open_id ?? '',
|
|
201
|
+
username: data.username ?? '',
|
|
202
|
+
displayName: data.display_name,
|
|
203
|
+
avatarUrl: data.avatar_url,
|
|
204
|
+
followerCount: data.follower_count,
|
|
205
|
+
followingCount: data.following_count,
|
|
206
|
+
likeCount: data.likes_count,
|
|
207
|
+
videoCount: data.video_count,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
// ── Internal Helpers ──
|
|
211
|
+
requireClient() {
|
|
212
|
+
if (!this.client)
|
|
213
|
+
throw new Error('TikTokService not initialized');
|
|
214
|
+
return this.client;
|
|
215
|
+
}
|
|
216
|
+
mapVideoResult(data) {
|
|
217
|
+
return {
|
|
218
|
+
id: data.id ?? data.video_id ?? '',
|
|
219
|
+
title: data.title,
|
|
220
|
+
caption: data.video_description ?? data.caption,
|
|
221
|
+
createTime: data.create_time,
|
|
222
|
+
coverUrl: data.cover_image_url,
|
|
223
|
+
shareUrl: data.share_url,
|
|
224
|
+
duration: data.duration,
|
|
225
|
+
metrics: {
|
|
226
|
+
views: data.view_count ?? 0,
|
|
227
|
+
likes: data.like_count ?? 0,
|
|
228
|
+
comments: data.comment_count ?? 0,
|
|
229
|
+
shares: data.share_count ?? 0,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
appendHashtags(caption, hashtags) {
|
|
234
|
+
if (!hashtags?.length)
|
|
235
|
+
return caption;
|
|
236
|
+
const tags = hashtags.map((t) => (t.startsWith('#') ? t : `#${t}`)).join(' ');
|
|
237
|
+
return `${caption} ${tags}`;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
exports.TikTokService = TikTokService;
|
|
241
|
+
//# sourceMappingURL=TikTokService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TikTokService.js","sourceRoot":"","sources":["../src/TikTokService.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;GAKG;;;;;;AAEH,kDAAkD;AAgFlD,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AAElD,MAAa,aAAa;IAKxB,YAAY,MAAoB;QAJxB,WAAM,GAAyB,IAAI,CAAC;QACpC,YAAO,GAAG,KAAK,CAAC;QAItB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QAEzB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;gBAClD,cAAc,EAAE,kBAAkB;aACnC;YACD,OAAO,EAAE,KAAM;SAChB,CAAC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sCAuQC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TikTok Channel Extension for AgentOS.
|
|
3
|
+
*
|
|
4
|
+
* Provides video publishing and content discovery via TikTok API for Business,
|
|
5
|
+
* plus ITool descriptors for video upload, trending, search, analytics,
|
|
6
|
+
* engagement, and discovery.
|
|
7
|
+
*
|
|
8
|
+
* @module @framers/agentos-ext-channel-tiktok
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtensionContext, ExtensionPack } from '@framers/agentos';
|
|
11
|
+
import { TikTokService, type TikTokConfig } from './TikTokService';
|
|
12
|
+
import { TikTokChannelAdapter } from './TikTokChannelAdapter';
|
|
13
|
+
import { TikTokUploadTool } from './tools/upload';
|
|
14
|
+
import { TikTokTrendingTool } from './tools/trending';
|
|
15
|
+
import { TikTokSearchTool } from './tools/search';
|
|
16
|
+
import { TikTokAnalyticsTool } from './tools/analytics';
|
|
17
|
+
import { TikTokEngageTool } from './tools/engage';
|
|
18
|
+
import { TikTokDiscoverTool } from './tools/discover';
|
|
19
|
+
export interface TikTokChannelOptions {
|
|
20
|
+
accessToken?: string;
|
|
21
|
+
accessTokenEnv?: string;
|
|
22
|
+
username?: string;
|
|
23
|
+
password?: string;
|
|
24
|
+
priority?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
|
|
27
|
+
export { TikTokService, TikTokChannelAdapter };
|
|
28
|
+
export { TikTokUploadTool, TikTokTrendingTool, TikTokSearchTool, TikTokAnalyticsTool, TikTokEngageTool, TikTokDiscoverTool };
|
|
29
|
+
export type { TikTokConfig };
|
|
30
|
+
export default createExtensionPack;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|