• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

  • Due to Holi celebrations, our team will have limited availability. While we’ll continue to monitor threads, responses may be slightly delayed.

X (Formerly Twitter) - Guide for Creating Connection (OAuth 2.0)

  • Thread starter Deleted member 8616
  • Start date
Status
Not open for further replies.
How to Integrate X (Formerly Twitter) with Pabbly Connect Using OAuth 2.0

This guide walks you through setting up X (Formerly Twitter) integration with Pabbly Connect using OAuth 2.0 Authorization Code Flow with PKCE.

Note: X now uses a pay-per-use credit system. There are no fixed monthly plans. You only pay for what you use. Some endpoints like GET /2/users/me work without credits, but posting tweets and reading tweet data require credits.



Step 1: Create an X Developer Account

1. Go to https://developer.x.com
2. Click "Go to Console"
3. Sign in with your X account
4. You will be redirected to the new Developer Console at console.x.com



Step 2: Create an App in the Developer Console

1. In the Developer Console (console.x.com), click "Apps" in the left sidebar
2. Click "Create App"
3. Enter your app name (e.g., "Pabbly Connect Integrations")
4. Your app will be created with a Client ID and Client Secret

Important: Save your Client ID and Client Secret immediately. You will need these for Pabbly Connect.



Step 3: Configure App Authentication Settings

1. In the Apps page, click on your app name
2. Under "OAuth 2.0 Keys", click "Edit settings"
3. Configure the following:

App Permissions:
Select: Read and write and Direct message
(This enables OAuth 1.0a permissions)

Type of App:
Select: Web App, Automated App or Bot (Confidential client)
(This enables OAuth 2.0 authentication)

App Info:

4. Click "Save Changes"



Step 4: Get Your API Keys

1. Go back to your app in the Developer Console
2. Under "OAuth 2.0 Keys", you will see:
  • Client ID — Copy this
  • Client Secret — Click "Show" and copy this

Security Tip: Keep your Client Secret safe. Never share it publicly. If compromised, click "Regenerate" to create a new one.



Step 5: Connect X (Formerly Twitter) in Pabbly Connect

1. In Pabbly Connect, create a new workflow
2. Add an action step and search for "X (Formerly Twitter)"
3. Select an action event (e.g., "Get Me", "Create Tweet", etc.)
4. Click "Connect" to set up the connection
5. In the connection popup, enter:
  • Client ID: Your OAuth 2.0 Client ID from Step 4
  • Client Secret: Your OAuth 2.0 Client Secret from Step 4

6. Click "Connect With X (Formerly Twitter)"
7. A new window will open asking you to authorize the app on X
8. Click "Authorize app"
9. You will be redirected back to Pabbly Connect with the connection established



Step 6: Test the Connection

1. After connecting, click "Save & Send Test Request"
2. If successful, you will see a response with your account data:
  • Data Id — Your X account ID
  • Data Name — Your display name
  • Data Username — Your @username



OAuth 2.0 Configuration Details (For Custom App Setup in Pabbly)

If you are configuring OAuth 2.0 manually in Pabbly's app settings, use these values:

  • Auth Type: OAuth 2.0
  • Grant Type: Authorization Code with PKCE
  • Redirect URL: https://connect.pabbly.com/callback-url
  • Authorize URL: https://x.com/i/oauth2/authorize
  • Token URL: https://api.x.com/2/oauth2/token
  • Refresh Token URL: (Leave blank — same as Token URL)
  • Client ID: Your OAuth 2.0 Client ID
  • Client Secret: Your OAuth 2.0 Client Secret
  • Code Challenge Method: SHA-256
  • Scope: tweet.read tweet.write users.read offline.access
  • State: (Leave blank — auto-generated by Pabbly)
  • Client Authentication: Send as Basic Auth header
  • Refresh Access Token on Expiration: Enabled (checked)



Important Notes

1. Access tokens expire every 2 hours. Pabbly automatically refreshes them using the refresh token if "Refresh Access Token on Expiration" is enabled.

2. Only one active connection per X account. Each time you authorize the app, the previous token is invalidated. All workflow steps using X should use the same connection.

3. Credits required for API calls. X uses pay-per-use billing. Some basic endpoints (like GET /2/users/me) work without credits, but most operations (posting tweets, reading tweets) require credits. Purchase credits at console.x.com > Billing > Credits.

4. Scopes explained:
  • tweet.read — Read tweets
  • tweet.write — Post and delete tweets
  • users.read — Read user profile information
  • offline.access — Get a refresh token for automatic token renewal



Troubleshooting

  • Invalid State error: Leave the State field blank in Pabbly. Do not enter any custom value.
  • 401 Unauthorized: Access token expired or old connection. Create a new connection or re-authorize.
  • CreditsDepleted: No API credits in your developer account. Buy credits at console.x.com > Billing.
  • client-not-enrolled: App not attached to a project. This error is from the old system. New console apps should work automatically.
  • unauthorized_client: Missing or wrong Client Secret. Verify Client Secret and ensure Client Authentication is set to "Send as Basic Auth header".
  • redirect_uri mismatch: Ensure https://connect.pabbly.com/callback-url is set in both X Developer Console and Pabbly.



API Endpoints Reference

  • Get User Info: GET https://api.x.com/2/users/me
  • Post a Tweet: POST https://api.x.com/2/tweets
  • Delete a Tweet: DELETE https://api.x.com/2/tweets/{id}
  • Token Exchange: POST https://api.x.com/2/oauth2/token
  • Authorization: GET https://x.com/i/oauth2/authorize
 

Attachments

  • Screenshot 2023-04-12 at 6.34.23 PM.png
    Screenshot 2023-04-12 at 6.34.23 PM.png
    190.2 KB · Views: 6,048
  • Screenshot 2023-04-12 at 6.32.20 PM.png
    Screenshot 2023-04-12 at 6.32.20 PM.png
    80.7 KB · Views: 6,167
  • Screenshot 2023-04-12 at 6.22.07 PM.png
    Screenshot 2023-04-12 at 6.22.07 PM.png
    223.5 KB · Views: 6,533
  • Screenshot 2023-04-12 at 6.16.09 PM.png
    Screenshot 2023-04-12 at 6.16.09 PM.png
    263.2 KB · Views: 6,986
  • Screenshot 2023-04-12 at 5.35.04 PM.png
    Screenshot 2023-04-12 at 5.35.04 PM.png
    244.7 KB · Views: 8,419
  • Screenshot 2023-04-12 at 6.06.00 PM.png
    Screenshot 2023-04-12 at 6.06.00 PM.png
    236.1 KB · Views: 7,511
  • Screenshot 2023-04-12 at 6.14.15 PM.png
    Screenshot 2023-04-12 at 6.14.15 PM.png
    277.5 KB · Views: 7,241
  • Screenshot 2023-04-12 at 5.34.24 PM.png
    Screenshot 2023-04-12 at 5.34.24 PM.png
    482.4 KB · Views: 8,657
Last edited by a moderator:
Status
Not open for further replies.
Top