Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Copilot
AI
changed the title
[WIP] Use Twitter username in postImmediate tweet link
Fix postImmediate API to return Twitter username instead of display name for correct tweet links
Jul 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
postImmediateAPI endpoint was returning the Twitter account's display name instead of the username/handle, causing the frontend to build incorrect tweet links.Before:
accountName: account.name(display name like "John Doe")https://x.com/John Doe/status/123❌ (broken)After:
accountName: me.username(handle like "johndoe")https://x.com/johndoe/status/123✅ (working)Changes
Added Twitter user data fetch: After successfully posting a tweet, the handler now calls
client.v2.me()to fetch the authenticated user's Twitter profile dataUpdated response format:
Removed unnecessary fields: Removed the
success: truefield as it wasn't needed for the frontend functionalityTechnical Details
const { data: me } = await client.v2.me()tweetId,accountName, andaccountIdpostImmediatehandlerTesting
The fix ensures that when users post tweets immediately via the API, the frontend receives the correct Twitter username to build properly formatted tweet links that work on X/Twitter.
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.