Twitter V2+V1 Post With Media
Twitter has deprecated the ability to post using the V1 API. Twitter's V2 API endpoint does allow for you to post a Tweet. However, the endpoint available only offers the ability to Post, they do not have an endpoint for posting with media.
The team at Pathfix has found a temporary workaround by using a combination of the V1 and V2 endpoint.
How this works?
- Use the V1 endpoint to prepare the media for upload
- Use the V2 endpoint to post the Tweet with media
Note: This is a temporary workaround until Twitter releases the ability to prepare and post Tweet with Media
You will need to configure and add both, Twitter and Twitter V2 integration in your Pathfix account. This means, your users will have to connect to both Twitter V1 and V2 in your app to give them the ability to post with media.
- If you have an existing account with Twitter developer, make sure you only have the total number of approved projects based on your plan
Twitter API known issues
Due to the ongoing migration from V1 to V2, there are a few known configuration/app issues that our team and users have seen, these are:
- Twitter is deleting/removing access and blocking API requests for entire accounts that have more than the allowed number of apps. Please check your limits in your account and delete any extra apps
- Some users are facing issue of Twitter randomly deleting their app everyday. Adding the app once again resolves this. For more information read the forum discussion here
Setup
- Click on the Keys and Tokens tab
- Copy the Consume Keys for use with Twitter V1 configuration
- Copy the OAuth 2.0 Keys for use in Twitter V2 configuration
- Log into Pathfix and add an Application (or select an existing application)
- Select Twitter from the list of providers
- Add the Consumer Keys copied over from your Twitter dev portal
- Save the settings
- Click on Test Connection and connect an account to test the configuration
- Go back to the Application page
- Select Twitter V2 from the list of providers
- Add your Twitter V2 OAuth 2.0 ClientID and ClientSecret and hit Save
- Click on Test Connection and connect an account to test the configuration
You will need to install 3 plugins for the setup to work:
Install all 3 plugins and add the Public Key and x-partner-key to the Pathfix plugins before proceeding.
- In the Design page, add the Pathfix Connector element to the page
- In the setup/properties window, select 'All Providers in my Pathfix account' and add the following list of providers: twitteroauth2,twitter
- This will show the Twitter V1 and Twitter V2 connect buttons
- Add an Input element to capture Text input from your user
- Add a Picture uploader element to capture images from the user
- Add a Button element to allow for the post action
Setting Up The Workflow
This is a 4 step process as Twitter needs certain info and file format, here is the sample setup.
Step 1:
- Select to include the file size and file type with the call
Step 2:
- Select the media ID String and Base 64 encoding
Step 3:
- Finalize the media and select the Media ID String
Step 4:
- Post the Tweet with media and Message using the Twitter V2 API for Post Media with Tweet
Your setup is complete.
Go to the Preview of your app, connect your Twitter account to both Twitter V1 and V2, test the post with media functionality.
Need help? Reach out to us at [email protected]