Install the latest version of SDK
yarn add @neynar/nodejs-sdk
npm install @neynar/nodejs-sdk
Open Edit with copilot
Click on copilot on the bottom right in vs-code you'll see the following menu
Add files
Navigate to node_modules/@neynar/nodejs-sdk/v1-to-v2-migration.md
and add the file to the working set
Search for @neynar/nodejs-sdk
in the entire project, add all the files to the working set that uses SDK methods. (You can also drag and drop files in the copilot window to add them.)
You should see something like this
Choose an AI agent (we recommend Claude) and add the following prompt.
I need help migrating code from Neynar SDK v1 to v2. Here are the specific details about my code that you need to analyze and update:
1. Please scan through my code and identify any:
- Method names that have been removed, renamed, or updated to v2 API
- Changes in enum names or enum key formats
- Changes in import paths
- Changes in method argument formats
- Changes in response structures
2. For each piece of code you analyze, please:
- Show the existing v1 code
- Provide the updated v2 code
- Highlight any breaking changes in the response structure
- Note any additional considerations or best practices
3. Key Migration Rules to Apply:
- All v1 API methods have been removed and must be replaced with v2 alternatives
- All method arguments should now use key-value pairs format
- Update enum imports to use '@neynar/nodejs-sdk/build/api'
- Update renamed enums and their key formats
- Consider response structure changes in the new methods
- Handle changes in client initialization
4. When showing code changes, please:
- Include necessary import statements
- Add comments explaining key changes
- Highlight any breaking changes that might affect dependent code
5. Reference Information:
- API endpoint changes and new parameters
- Response structure modifications
- Required vs optional parameters
- Type changes
- Error handling differences
Please analyze my code and provide detailed, step-by-step guidance for updating it to be compatible with Neynar SDK v2.
I need to know exactly how to update it to v2, including all necessary changes to imports, method names, parameters, and response handling.
With this, you should get most of the code changes correctly replaced but please verify it once. The only place where AI can make mistakes in code replacement is where v1 API methods are used which are completely removed from the v2 SDK. This is because the response structure is changed in v2 APIs.