Unlocking Real-Time Engagement with X Account Activity API via Ayrshare

August 31, 2025

3 min read

Author: Ayrshare Team

Ayrshare Team

Ayrshare Team

Developer Relations

Guides and stories from the Ayrshare team, the unified social media API trusted by more than 10,000 teams.

Ask AI about this article

Opens your AI assistant in a new tab with this article preloaded.

Unlocking Real-Time Engagement with X Account Activity API via Ayrshare

Managing social for large clients can feel like you’re stuck at a crowded dinner party where everyone’s talking at once and you’re supposed to keep track of every conversation. The X Account Activity API from Ayrshare makes it simple. You get a single, real-time stream of mentions, likes, DMs, and more. The stream is clean, organized, and ready for your users to act on.

What Is the X Account Activity API?

Activated through updating an Ayrshare user profile with the xAccountActivityActive parameter, the X Account Activity integration allows you to receive real-time notifications whenever an event occurs on a linked X account, whether that’s a new Tweet, a mention, a Direct Message, a like, a follow, or even a block . Your account representative will also need to help enable the feature for your Business or Enterprise Plan account.

From there, your webhook will be triggered with detailed payloads like when a tweet is created, deleted, or a message is received—allowing you to respond immediately .

Here is an example payload for when a new direct message is sent or received:

json

json

{  "action": "accountActivity",  "code": 200,  "created": "2025-07-01T11:06:21Z",  "directMessageEvents": {    "type": "message_create",    "createdAt": "2025-07-01T11:06:21.247Z",    "id": "1234567890123456832",    "messageCreate": {      "target": {        "recipientId": "9876543210987654472"      },      "messageData": {        "entities": {          "hashtags": [],          "urls": [],          "symbols": [],          "userMentions": []        },        "text": "Yes"      },      "senderId": "1111222233334444555"    }  },  "hookId": "BCD890EFG123HIJ456KL",  "mediaUrls": [],  "platform": "twitter",  "refId": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",  "retryAttempt": 0,  "scheduleDate": "2025-07-01T11:06:21Z",  "source": "system",  "title": "X Account Activity",  "type": "accountActivity",  "url": "https://example.com/webhook-endpoint",  "users": {    "1111222233334444555": {      "verified": false,      "location": "New York, NY",      "profileImageUrl": "http://pbs.twimg.com/profile_images/2222333344445555666/example123_normal.jpg",      "followersCount": 1179,      "url": "https://t.co/ExampleCompanyUrl",      "screenName": "ExampleCompany",      "protected": false,      "createdTimestamp": "1496875880999",      "profileImageUrlHttps": "https://pbs.twimg.com/profile_images/2222333344445555666/example123_normal.jpg",      "friendsCount": 1015,      "id": "1111222233334444555",      "description": "A sample company description https://t.co/ExampleCompanyUrl",      "statusesCount": 2315,      "name": "EXAMPLE COMPANY"    },    "9876543210987654472": {      "friendsCount": 6,      "profileImageUrlHttps": "https://pbs.twimg.com/profile_images/1234567890123456789/abcd1234_normal.png",      "profileImageUrl": "http://pbs.twimg.com/profile_images/1234567890123456789/abcd1234_normal.png",      "verified": false,      "location": "New York",      "id": "9876543210987654472",      "protected": false,      "followersCount": 27,      "name": "Example Business",      "description": "Sample business description for testing purposes. We make great products that people love and take just minutes to prepare!",      "statusesCount": 2475,      "screenName": "example_business",      "createdTimestamp": "1573572177562",      "url": "https://t.co/ExampleUrl123"    }  }}

Why It Matters: The Core Benefits

  1. Lightning-Fast Engagement

You no longer need to rely on manual checks or polling. Webhooks trigger instantly when activity occurs, such as a mention or a new DM, allowing your app or product to respond in real time.

  1. Centralized Workflow

Ayrshare already streamlines posting, analytics, messaging, and more across 13 platforms (including X) with a single, unified REST API . Now, you can centralize inbound social activity into the same flow with no fragmented tooling required.

  1. Automation Made Simple

Whether you want to auto-reply, trigger notifications in your app, log data for analytics, or create moderation workflows, everything can start with that webhook payload. Building automation logic is very straightforward.

  1. Scalability & Reliability with Ayrshare’s Infrastructure

Handling social integrations personally can be fraught with API changes, rate limits, and hidden complexity. With Ayrshare, you leverage a robust integration layer that abstracts away those challenges ensuring you stay focused on your product, not API maintenance .

Steps for Deployment

  1. Register your webhook URL to receive accountActivity actions via the Webhooks API.
  2. Update your user profile by setting "xAccountActivityActive": true with the Update Profile endpoint.
  3. Listen for events such as tweetCreateEvents, tweetDeleteEvents, new DMs, follows/unfollows, and more through your webhook listener.
  4. Build the next step: respond, notify, log, or analyze. That’s entirely up to you.

Real-World Use Cases

  • Smart CRM: Automatically log inbound DMs from X into your support ticket system ensuring no customer query ever slips through the cracks.
  • Real-Time Promotion Alerts: Trigger push notifications or Slack messages when your brand gets mentioned perfect for early reactions or engagement boosts.
  • Moderation & Analytics: Instantly capture harmful content or receive alerts for unexpected spikes, helping with moderation or crisis management.
  • Engagement Bots: Respond promptly to mentions or specific keywords, boosting engagement and creating a more dynamic audience experience.

Part of the Comprehensive Ayrshare Solution

The X Account Activity API is just one piece of the bigger puzzle. Ayrshare offers a powerful suite of APIs covering posting, analytics, scheduling, messaging, and webhooks across 13 major social networks. By bringing activity streams, engagement tools, and automation into a single platform, Ayrshare helps agencies, developers, and platforms manage social at scale. Think of it as your all-in-one toolkit for turning social media into clear, actionable insights and workflows.

Written by: Ayrshare Team

Guides and stories from the Ayrshare team, the unified social media API trusted by more than 10,000 teams.

Ayrshare Team

Ayrshare Team

Developer Relations

Guides and stories from the Ayrshare team, the unified social media API trusted by more than 10,000 teams.

Ask AI about this article

Opens your AI assistant in a new tab with this article preloaded.