Send X (Twitter) DMs from a Google Sheet

How to send X (Twitter) DMs from a Google Sheet: install the Chrome extension, click Build with Browser agent, tell the agent what you want, and follow its prompts. A working bot is built and tested in minutes.

Here is how the automation works. To send X (Twitter) DMs from a Google Sheet, loop through the profile links in the sheet, open each profile, check it has a Message button with an If condition, then click it, type the message with Enter text and press Enter with Press key(s) to send. It is the same as messaging from a profile page by hand.

Author
Alex Barlow
Published

Build sending X DMs from a description


Describe it and click the button: the agent builds and tests the DM sender in your Chrome extension. Run it on the desktop app, where you are logged in to X.

  1. Open each X profile link in my sheet
  2. If the profile has a Message button, click it
  3. Type my message and send it
  4. Delete the profile from the sheet once done
Click to launch the Chrome extension. Not installed? You can create an account and try it free.Opens the Chrome extension. Free account to try.

You need a Google Sheet with one X profile link per row, and the message in a second column if it differs per profile. Leave the sheet as it is while the run deletes the rows it has done.

The video shows the agent building the X DM sender from the four lines above, in a few minutes.

Build sending X DMs step by step


The steps the agent builds, as the Builder shows them: each step by its name, with the fields to set under it. Add them yourself in this order in the step-by-step builder, or open the agent's result there to adjust it.

  • 1.0 Read data from a Google Sheet
    • Spreadsheet: your sheet
    • Sheet name: the tab with the profile links
  • 2.0 Loop through data
    • repeats for every row in [google-sheet-data]
    • 2.1 Go to page
      • URL: the profile link column of [google-sheet-data]
    • 2.2 Get data from bot's current page
      • Select: the element that wraps the Message button
    • 2.3 If condition
      • Data to check: [scrape-data]
      • Condition to check: Message
      • 2.3.1 Click element
        • Select: the Message button
      • 2.3.2 Enter text
        • Select text field: the message box
        • Text: your message, or the message column of [google-sheet-data]
      • 2.3.3 Press key(s)
        • Key: Enter
    • 2.4 Delete rows from a Google Sheet
      • Spreadsheet: your sheet
      • Sheet name: the tab with the profile links
      • First row: 1
      • Last row: 1

Common questions about sending X DMs


How do I test the X DM automation without sending messages?

Disable the Press key(s) step before the test run. The message is typed but never sent; turn the step back on when it looks right.

Why do the X profile pages not load?

The URL is not inserted correctly. In Go to page, check Enter URL holds the profile link column from [google-sheet-data].

Why is the Message button not found on X?

The selection no longer matches the page. In Get data from bot's current page, reselect an element that wraps around the Message button, and in Click element, reselect the button itself. Try the text selector. When a run fails, hand it to the agent and it repairs the step.

How do I send X DMs when X is not in English?

Change the If condition to check for the word on the Message button in your language. Check Data to check is still [scrape-data].

Why is no message typed into the X message box?

Enter text has no data or the wrong field. Check you have inserted the message in Text, or reselect the message box.

Can I send X DMs in bulk without code?

Yes. The automation is built from the four lines above, with no code: the sheet holds the profiles, and the steps click, type and send as you would by hand. A different message per profile is a second column in the sheet.

Can I schedule the X DM automation?

Yes, once the automation can log in by itself. Share the cookie in the automation's settings, or add steps to log in.

Can I send DMs on Instagram the same way?

Yes. See send Instagram DMs from a Google Sheet, and for text messages from your phone, send Google Messages to contacts from a Google Sheet.

Where do I get help?

Get in touch with support, or ask in the axiom.ai community.

Related guides