π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: tiktok access token fix
Nevo David35a9b1c4cf10
diff --git a/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts b/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.tsindex d969d99b8..4da6234ff 100644--- a/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts@@ -222,58 +222,51 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {postDetails: PostDetails<TikTokDto>[],integration: Integration): Promise<PostResponse[]> {- try {- const [firstPost, ...comments] = postDetails;+ const [firstPost, ...comments] = postDetails;- const {- data: { publish_id },- } = await (- await this.fetch(- 'https://open.tiktokapis.com/v2/post/publish/video/init/',- {- method: 'POST',- headers: {- 'Content-Type': 'application/json; charset=UTF-8',- Authorization: `Bearer ${accessToken}`,+ const {+ data: { publish_id },+ } = await (+ await this.fetch(+ 'https://open.tiktokapis.com/v2/post/publish/video/init/',+ {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json; charset=UTF-8',+ Authorization: `Bearer ${accessToken}`,+ },+ body: JSON.stringify({+ post_info: {+ title: firstPost.message,+ privacy_level: firstPost.settings.privacy_level,+ disable_duet: !firstPost.settings.duet,+ disable_comment: !firstPost.settings.comment,+ disable_stitch: !firstPost.settings.stitch,+ brand_content_toggle: firstPost.settings.brand_content_toggle,+ brand_organic_toggle: firstPost.settings.brand_organic_toggle,},- body: JSON.stringify({- post_info: {- title: firstPost.message,- privacy_level: firstPost.settings.privacy_level,- disable_duet: !firstPost.settings.duet,- disable_comment: !firstPost.settings.comment,- disable_stitch: !firstPost.settings.stitch,- brand_content_toggle: firstPost.settings.brand_content_toggle,- brand_organic_toggle: firstPost.settings.brand_organic_toggle,- },- source_info: {- source: 'PULL_FROM_URL',- video_url: firstPost?.media?.[0]?.url!,- },- }),- }- )- ).json();+ source_info: {+ source: 'PULL_FROM_URL',+ video_url: firstPost?.media?.[0]?.url!,+ },+ }),+ }+ )+ ).json();- const { url, id: videoId } = await this.uploadedVideoSuccess(- integration.profile!,- publish_id,- accessToken- );+ const { url, id: videoId } = await this.uploadedVideoSuccess(+ integration.profile!,+ publish_id,+ accessToken+ );- return [- {- id: firstPost.id,- releaseURL: url,- postId: String(videoId),- status: 'success',- },- ];- } catch (err) {- throw new BadBody('titok-error', JSON.stringify(err), {- // @ts-ignore- postDetails,- });- }+ return [+ {+ id: firstPost.id,+ releaseURL: url,+ postId: String(videoId),+ status: 'success',+ },+ ];}}