X (Twitter)

Formerly known as Twitter. From breaking news and entertainment to sports and politics, get the full story with all the live commentary. Use a X developer app you've created to send API requests.

Go to site
Explore
/
Apps
/
X (Twitter)

X (Twitter) API Integrations

Build and run workflows using the X (Twitter) API. Use 1000s of source-available triggers and actions across 2,000+ apps. Or write custom code to integrate any app or API in seconds.

Overview

The Twitter API on Pipedream enables you to automate interactions with Twitter, from posting tweets to analyzing social media trends. Pipedream's serverless platform provides the tools to create workflows that trigger on specific Twitter activities, process data, and connect with countless other apps for extensive automation scenarios. With Pipedream's integration, you can listen for events such as new tweets, mentions, or followers, and execute actions like tweeting, retweeting, or even leveraging sentiment analysis to gauge public perception.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { axios } from "@pipedream/platform"
import twitter from "@pipedream/twitter"
export default defineComponent({
  props: {
    twitter
  },
  async run({steps, $}) {
    const config = {
      url: `https://api.twitter.com/2/users/me`,
      params: {
        "user.fields": `created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,url,username,verified,withheld`,
        expansions: `pinned_tweet_id`,
      },
    }
    const headers = this.twitter._getAuthHeader(config)
    return await axios($, {
      ...config,
      headers
    })
  },
})

Choose an API to Connect with X (Twitter) API

1
-
24
of
2,000+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Salesforce (REST API)
Salesforce (REST API)
Web services API for interacting with Salesforce
HubSpot
HubSpot
HubSpot's CRM platform contains the marketing, sales, service, operations, and website-building software you need to grow your business.
Zoho CRM
Zoho CRM
Zoho CRM is an online Sales CRM software that manages your sales, marketing, and support in one CRM platform.
Stripe
Stripe
Stripe powers online and in-person payment processing and financial solutions for businesses of all sizes.
Shopify Developer App
Shopify Developer App
Shopify is a user-friendly e-commerce platform that helps small businesses build an online store and sell online through one streamlined dashboard.
WooCommerce
WooCommerce
WooCommerce is the open-source ecommerce platform for WordPress.
Snowflake
Snowflake
A data warehouse built for the cloud
MongoDB
MongoDB
MongoDB is an open source NoSQL database management program.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
ServiceNow
ServiceNow
The smarter way to workflow
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Microsoft Teams
Microsoft Teams
Microsoft Teams has communities, events, chats, channels, meetings, storage, tasks, and calendars in one place.

Example Use Cases

  • Automated Tweeting of Curated Content: Create a workflow that monitors RSS feeds or other content sources. When new items are detected, format the content and automatically post it to your Twitter account, keeping your followers engaged with fresh and relevant content.

  • Twitter Sentiment Analysis: Set up a workflow that triggers on new mentions of your username on Twitter. Pass the tweet text to a sentiment analysis service like Google's Natural Language API to determine the emotion conveyed. Use this data to respond appropriately or to gather insights on public perception.

  • Customer Support Ticketing: Develop a workflow that starts when your company's Twitter account receives a direct message. Automatically create a ticket in a customer support platform like Zendesk or HubSpot, ensuring that your team promptly addresses customer inquiries and issues mentioned on Twitter.

Getting Started

In order to connect your Twitter account to Pipedream, you'll need to create a developer project and app.

  1. First, visit Twitter's developer dashboard and sign in
  2. Next, create a new project and give it a name, select a use case, and provide a description

Creating a Project and App

  1. Provide a name for your app
  2. Note the API Key and API Key Secret that are displayed (the setup isn't done yet, but note these down)
  3. Click "App settings" at the bottom right of the screen

Configuring Authentication Settings

  1. In the bottom of your app's settings, in the "User Authentication Settings", choose "Set Up"
  2. Select the appropriate app permissions based on your use case
  3. Select "Web App, Automated App or Bot (Confidential client)" in the "Type of App" section
  4. Enter this URI in the "Callback URI / Redirect URI": https://api.pipedream.com/connect/oauth/oa_gk6iBa/callback
  5. Enter a website URL
  6. Click "Done" (the Client ID and Client Secret that are shown on the next page are not required for this setup)
  7. Enter the API Key and API Key Secret when prompted in Pipedream (if you lose them and need to regenerate new keys, you can do so from the "Keys and tokens" tab in your app's settings in Twitter's developer dashboard, in the "Consumer Keys" section)

Consumer API key

Simple Search with Twitter API on npm Download Counts from npm API
npm + X (Twitter)
 
Try it
Add Role with Discord Bot API on New Follower of User from Twitter API
X (Twitter) + Discord Bot
 
Try it
Get Table Records with ServiceNow API on New Tweet in List from Twitter API
X (Twitter) + ServiceNow
 
Try it
Create Tweet with Twitter API on New Row Added (Shared Drive, Instant) from Google Sheets API
Google Sheets + X (Twitter)
 
Try it
List Favorites with Twitter API on New Bookmark from Raindrop API
Raindrop + X (Twitter)
 
Try it
New Follower Received by User from the X (Twitter) API

Emit new event when the specified User receives a Follower See the documentation

 
Try it
New List Followed by User from the X (Twitter) API

Emit new event when the specified User follows a List See the documentation

 
Try it
New Mention Received by User from the X (Twitter) API

Emit new event when the specified User is mentioned in a Tweet See the documentation

 
Try it
New Message Received from the X (Twitter) API

Emit new event when a new Direct Message (DM) is received See the documentation

 
Try it
New Tweet Liked by User from the X (Twitter) API

Emit new event when a Tweet is liked by the specified User See the documentation

 
Try it
Search Tweets with the X (Twitter) API

Retrieve Tweets from the last seven days that match a query. See the documentation

 
Try it
Add User To List with the X (Twitter) API

Add a member to a list owned by the user. See the documentation

 
Try it
Create Tweet with the X (Twitter) API

Create a new tweet. See the documentation

 
Try it
Delete Tweet with the X (Twitter) API

Remove a posted tweet. See the documentation

 
Try it
Follow User with the X (Twitter) API

Follow a user. See the documentation

 
Try it

Troubleshooting

Below are some of the most common issues we see.

Issues Connecting Twitter

If you run into an error during the app connection process, make sure to doublecheck the below configurations:

  1. Ensure that you've entered the correct developer_consumer_key and developer_consumer_secret in Pipedream. These map to Twitter's "API Key" and "API Key Secret" in the "Keys & Tokens" section in their dashboard.
  2. Make sure the "Callback URI / Redirect URL" that you configure within the "User Authentication settings" for your app in Twitter's developer console exactly matches: https://api.pipedream.com/connect/oauth/oa_gk6iBa/callback

Errors from Twitter's API or Twitter Sources and Actions

  1. Free Twitter developer accounts only have access to write endpoints (for example, actions like "Create Tweet" and "Create Retweet")
  2. Twitter developer accounts on their Basic plan have access to write and read endpoints (for example, actions like "Create Tweet" and "Search Tweets", as well as sources like "New Post Matching Query")
  3. If you are getting errors from the Twitter sources or actions, please consult the developer plan to confirm if you have access to those endpoints.

Authentication

X (Twitter) uses OAuth authentication. When you connect your X (Twitter) account, Pipedream will open a popup window where you can sign into X (Twitter) and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any X (Twitter) API.

Pipedream requests the following authorization scopes when you connect your account:

OAuth Request Configurations:
  1. requestToken
    POSThttps://api.twitter.com/oauth/request_token
  2. authorization
    GEThttps://api.twitter.com/oauth/authenticate?client_id={{oauth.client_id}}&force_login=true&oauth_token={{oauth.token}}&redirect_uri={{oauth.redirect_uri}}&response_type=code&state={{oauth.state}}
  3. accessToken
    POSThttps://api.twitter.com/oauth/access_tokencontent-type: application/x-www-form-urlencodedaccept: application/json
    redirect_uri={{oauth.redirect_uri}}&grant_type=authorization_code&code={{oauth.code}}&code_verifier=challenge
Using Event Sources and Workflows: Analyze Twitter Sentiment in Real-Time and Save to Google Sheets
Using Event Sources and Workflows: Analyze Twitter Sentiment in Real-Time and Save to Google Sheets
Learn how you can use Pipedream event sources and serverless workflows to listen for new Twitter mentions, analyze the sentiment of each Tweet using the npm sentiment package (https://www.npmjs.com/package/sentiment), and then save that data to Google Sheets in real-time.
Entering Data in Params Forms
Entering Data in Params Forms
Learn about the new model to enter expressions and reference previous step exports in params forms.
Managing the Concurrency and Execution Rate of Workflow Events
Managing the Concurrency and Execution Rate of Workflow Events
Managing the Concurrency and Execution Rate of Workflow Events.

Community Posts

A Look at Pipedream
A Look at Pipedream
I'm going to build a workflow that will search Twitter every hour for a keyword. It will take the results, format them nicely, and then email it.
Building a Google Sheets Twitter Bot with Pipedream
Building a Google Sheets Twitter Bot with Pipedream
This is something that's been kicking around my head for a week or so and today I thought I'd try it. It ended up taking about 20 minutes total and 10 lines of code, of which 5 are a function I copied and pasted. While what I built is kind of trivial, I'm blown away by how much was done by built-in functions with Pipedream and how little work I had to do myself. In fact, most of my time was spent in setting stuff up outside of Pipedream itself. Alright, so what did I build?
Building a Twitter Bot in Pipedream
Building a Twitter Bot in Pipedream
I did this by parsing information from the GI Joe wikipedia site and implementing it on Pipedream's platform. I'm going to share how I built it, but be aware that roughly 95% of the work was involved in getting my random character. The aspects that pertain to Pipedream were incredibly simple - which is what you want in a platform.
Using State in Pipedream Workflows
Using State in Pipedream Workflows
I did this by parsing information from the GI Joe wikipedia site and implementing it on Pipedream's platform. I'm going to share how I built it, but be aware that roughly 95% of the work was involved in getting my random character. The aspects that pertain to Pipedream were incredibly simple - which is what you want in a platform.
Building a Twitter Scheduling System with Pipedream and Google Sheets
Building a Twitter Scheduling System with Pipedream and Google Sheets
A few months ago, I blogged about how I used Pipedream and Google Sheets to create a Twitter bot. The idea was simple - read a sheet - select a random row - and use that as the source of a new Tweet. I was thinking about this recently and how useful Google Sheets can be as a "light weight CMS" and figured out another interesting use case - Twitter scheduling.
A demo of using the Twitter API, via Pipedream, to render the images from a Twitter account.