Skip to content

Latest commit

 

History

History
232 lines (159 loc) · 11.5 KB

File metadata and controls

232 lines (159 loc) · 11.5 KB

Dm

Overview

Available Operations

Status

Retrieves the Direct Message (DM) availability status for a list of users. This endpoint checks if the specified accounts can receive messages based on their privacy settings, follow status, or verified permissions.

Example Usage

using System.Collections.Generic;
using XapiScraper;
using XapiScraper.Models.Components;

var sdk = new XapiScraperSDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

List<string> req = new List<string>() {
    "1696160451770429440",
};

var res = await sdk.Dm.StatusAsync(req);

// handle response

Parameters

Parameter Type Required Description
request List<string> ✔️ The request object to use for the request.

Response

DmStatusResponse

Errors

Error Type Status Code Content Type
XapiScraper.Models.Errors.HTTPValidationError 422 application/json
XapiScraper.Models.Errors.APIException 4XX, 5XX */*

Send

Send DM via XChat encrypted chat API (1:1 or existing group g...), optional image via media_urls (max 1) or video via video_url (mutually exclusive). $0.001 per call.

Example Usage

using System.Collections.Generic;
using XapiScraper;
using XapiScraper.Models.Components;

var sdk = new XapiScraperSDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

SendDmV3Query req = new SendDmV3Query() {
    Recipient = "baker_donn80196",
    Text = "hello from docs",
    MediaUrls = new List<string>() {
        "https://example.com/image.jpg",
    },
    VideoUrl = "https://video.twimg.com/amplify_video/2077160248830275584/vid/avc1/320x568/kwNDLTm",
    Pin = "1234",
    Cookie = "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
    Proxy = "http://username:password@ip:port",
};

var res = await sdk.Dm.SendAsync(req);

// handle response

Parameters

Parameter Type Required Description
request SendDmV3Query ✔️ The request object to use for the request.

Response

DmSendResponse

Errors

Error Type Status Code Content Type
XapiScraper.Models.Errors.HTTPValidationError 422 application/json
XapiScraper.Models.Errors.APIException 4XX, 5XX */*

History

Get DM history via XChat encrypted chat API. Use count for page size (10–200). Set all=true to follow has_more and return every page. Or paginate manually: when has_more is true, pass the oldest message's sequence_id as before.

Example Usage

using XapiScraper;
using XapiScraper.Models.Components;

var sdk = new XapiScraperSDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

GetDmHistoryV3Query req = new GetDmHistoryV3Query() {
    Recipient = "1928096185664843776:1989842918455291904",
    Pin = "1234",
    Count = 50,
    All = false,
    Before = "2076684837654876160",
    Cookie = "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
    Proxy = "http://username:password@ip:port",
};

var res = await sdk.Dm.HistoryAsync(req);

// handle response

Parameters

Parameter Type Required Description
request GetDmHistoryV3Query ✔️ The request object to use for the request.

Response

DmHistoryResponse

Errors

Error Type Status Code Content Type
XapiScraper.Models.Errors.HTTPValidationError 422 application/json
XapiScraper.Models.Errors.APIException 4XX, 5XX */*

Media

Fetch one XChat media attachment and return a playable URL. Use conversation_id, media_hash_key, and optional key_version from /v3/twitter/dm-history attachments.

Example Usage

using XapiScraper;
using XapiScraper.Models.Components;

var sdk = new XapiScraperSDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

GetDmMediaV3Query req = new GetDmMediaV3Query() {
    ConversationId = "1928096185664843776:1989842918455291904",
    MediaHashKey = "blRIlZCVIO",
    KeyVersion = "3",
    TypeName = "VIDEO",
    Filename = "clip.mp4",
    Pin = "1234",
    Cookie = "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
    Proxy = "http://username:password@ip:port",
};

var res = await sdk.Dm.MediaAsync(req);

// handle response

Parameters

Parameter Type Required Description
request GetDmMediaV3Query ✔️ The request object to use for the request.

Response

DmMediaResponse

Errors

Error Type Status Code Content Type
XapiScraper.Models.Errors.HTTPValidationError 422 application/json
XapiScraper.Models.Errors.APIException 4XX, 5XX */*

Conversations

Get XChat conversation list. Use count for page size (10–200). Set all=true to follow the inbox cursor and return every conversation.

Example Usage

using XapiScraper;
using XapiScraper.Models.Components;

var sdk = new XapiScraperSDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

GetConversationsV3Query req = new GetConversationsV3Query() {
    Count = 100,
    All = true,
    Cookie = "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
    Proxy = "http://username:password@ip:port",
};

var res = await sdk.Dm.ConversationsAsync(req);

// handle response

Parameters

Parameter Type Required Description
request GetConversationsV3Query ✔️ The request object to use for the request.

Response

DmConversationsResponse

Errors

Error Type Status Code Content Type
XapiScraper.Models.Errors.HTTPValidationError 422 application/json
XapiScraper.Models.Errors.APIException 4XX, 5XX */*