Skip to content

Instantly share code, notes, and snippets.

@ryan-blunden
Last active August 14, 2025 13:49
Show Gist options
  • Save ryan-blunden/d3daa85d083c8247f8ae00e52c5809a7 to your computer and use it in GitHub Desktop.
Save ryan-blunden/d3daa85d083c8247f8ae00e52c5809a7 to your computer and use it in GitHub Desktop.
Gram video

create_dub_youtube_link

Purpose

Your objective is to create (not upsert) a Dub link specifically for YouTube videos that fetches the video metadata to populate the link title, description and image. If all the information you need is available in context then proceed immediately and do not ask for confirmation. Restrict tool usage to only the tools supplied. Your output should be informative but concise, like that of a CLI.

Step 1

Get the YouTube metadata for the provided YouTube URL {{youtubeUrl}}. If retrieving the youtube metadata step failed, do not proceed to the next step and let them know the cause of the failure.

Step 2

Create a Dub link using the fetched metadata as follows:

link.url: Set the link URL to exactly {{youtubeUrl}}.

link.title: Set to the video title without changes.

link.description: start with the original video description, remove chapter listings, ads or promotions, URLs, and generic filler text such as “support this channel” or “subscribe.” Keep it under 240 characters, preserving the original wording wherever possible, and only rephrase if required for grammar or to meet the character limit.

link.key: This is the link slug, so create a condensed, lowercase hyphen separated identifier derived from the video title, no more than 12 characters, with spaces, punctuation, and special characters removed.

link.image: Set to the video thumbnail.

link.proxy: Set to true to enable social media previews with custom properties.

Step 3

Generate the dashboard URL for the created link by first retrieving the workplace slug using the workspaceId.

Then construct the URL using the format https://app.dub.co/{workspace.slug}/links/{link.domain}/{link.key}, then display a summary that includes the {{youtubeURL}}, the link URL, and the generated Dub dashboard URL.

link_utm_parameter_find_and_replace

Description

Find links with a specific UTM parameter type and value and replace with an updated value. Use this when you need to bulk apply UTM parameter value fixes across your workspace.

Prompt

Update all Dub links where {{utm_parameter}} = "{{find}}" and replace with "{{replace}}".

  1. Validate {{utm_parameter}} is one of: utm_source, utm_medium, utm_campaign, utm_term, or utm_content.
  2. Get filtered links list using the dub_get_links tool where {{utm_parameter}} = "{{find}}".
  3. List the links to update with the before and after {{utm_parameter}} value and do not proceed until the user replies with "approved".
  4. Update each link using the dub_update_link tool to set {{utm_parameter}} = "{{replace}}". Never set the url property directly and do not use the dub_bulk_update_links tool as bulk utm parameter updates are not supported.
  5. Provide a summary of the updates made.

Your output should be informative and concise, like that of a CLI.

Arguments

  • find: The current value of the selected UTM parameter that should be replaced.
  • replace: The new value to set for the selected UTM parameter.
  • utm_parameter: Must be one of: utm_source, utm_medium, utm_campaign, utm_term, or utm_content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment