Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

2.8 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { BumpupsAuth } from '../common/auth';
import { makeRequest } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';

export const generateTimestamps = createAction({
  auth: BumpupsAuth,
  name: 'generateTimestamps',
  classification: 'READ',
  displayName: 'Generate Timestamps',
  description: 'Generates detailed timestamps for a YouTube video based on its content.',
  audience: 'both',
  aiMetadata: { description: 'Calls the Bumpups AI model on a public YouTube video URL to generate chapter timestamps from the video content, with a style option for long or short timestamp segments. Use when an agent needs chaptered timestamps for a specific YouTube video; the video URL is required and an optional language code sets the output language. Not idempotent — each call invokes the model and may produce different timestamps.', idempotent: false },
  props: {
    videoUrl: Property.ShortText({
      displayName: 'Video URL',
      description: 'The YouTube video URL.',
      required: true,
    }),
    model: Property.StaticDropdown({
      displayName: 'Model',
      required: true,
      defaultValue: 'bump-1.0',
      options: {
        disabled: false,
        options: [
          { label: 'bump-1.0', value: 'bump-1.0' },
        ],
      },
    }),
    language: Property.StaticDropdown({
      displayName: 'Language',
      required: false,
      defaultValue: 'en',
      options: {
        disabled: false,
        options: [
          { label: 'English (en)', value: 'en' },
          { label: 'Hindi (hi)', value: 'hi' },
          { label: 'Spanish (es)', value: 'es' },
          { label: 'Portuguese (pt)', value: 'pt' },
          { label: 'Russian (ru)', value: 'ru' },
          { label: 'German (de)', value: 'de' },
          { label: 'French (fr)', value: 'fr' },
          { label: 'Japanese (ja)', value: 'ja' },
          { label: 'Korean (ko)', value: 'ko' },
          { label: 'Arabic (ar)', value: 'ar' },
        ],
      },
    }),
    timestamps_style: Property.StaticDropdown({
      displayName: 'Timestamps Style',
      description: 'Preferred length of each timestamp.',
      required: false,
      defaultValue: 'long',
      options: {
        disabled: false,
        options: [
          { label: 'Long', value: 'long' },
          { label: 'Short', value: 'short' },
        ],
      },
    }),
  },
  async run({ auth, propsValue }) {
    const body = {
      url: propsValue.videoUrl,
      model: propsValue.model,
      language: propsValue.language || 'en',
      timestamps_style: propsValue.timestamps_style || 'long',
    };

    const response = await makeRequest(
      auth.secret_text,
      HttpMethod.POST,
      '/general/timestamps',
      body
    );

    return response;
  },
});