@pipedream/twitter 2.2.4 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/actions/add-user-to-list/add-user-to-list.mjs +1 -1
- package/dist/actions/create-tweet/create-tweet.d.ts +3 -3
- package/dist/actions/create-tweet/create-tweet.mjs +1 -1
- package/dist/actions/delete-tweet/delete-tweet.mjs +1 -1
- package/dist/actions/follow-user/follow-user.mjs +1 -1
- package/dist/actions/get-tweet/get-tweet.mjs +1 -1
- package/dist/actions/get-user/get-user.mjs +1 -1
- package/dist/actions/like-tweet/like-tweet.mjs +1 -1
- package/dist/actions/list-favorites/list-favorites.mjs +1 -1
- package/dist/actions/list-followers/list-followers.mjs +1 -1
- package/dist/actions/list-lists/list-lists.mjs +1 -1
- package/dist/actions/list-mentions/list-mentions.mjs +1 -1
- package/dist/actions/list-user-tweets/list-user-tweets.mjs +1 -1
- package/dist/actions/retweet/retweet.mjs +1 -1
- package/dist/actions/send-dm/send-dm.mjs +1 -1
- package/dist/actions/simple-search/simple-search.mjs +1 -1
- package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +1 -1
- package/dist/actions/unfollow-user/unfollow-user.mjs +1 -1
- package/dist/actions/unlike-tweet/unlike-tweet.mjs +1 -1
- package/dist/actions/upload-media/upload-media.mjs +13 -22
- package/dist/common/addObjIncludes.d.ts +9 -0
- package/dist/common/addObjIncludes.mjs +70 -0
- package/dist/common/additionalProps.mjs +2 -2
- package/dist/common/appValidation.d.ts +6 -6
- package/dist/common/types/includeMapping.d.ts +11 -0
- package/dist/common/types/includeMapping.mjs +1 -0
- package/dist/common/types/responseSchemas.d.ts +35 -5
- package/dist/sources/common/base.d.ts +6 -6
- package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +4 -2
- package/dist/sources/new-list-followed/new-list-followed.mjs +4 -2
- package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.mjs +4 -2
- package/dist/sources/new-message/new-message.mjs +4 -2
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +4 -2
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +4 -2
- package/dist/sources/new-tweet-metrics/new-tweet-metrics.mjs +1 -1
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +4 -2
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +4 -2
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +4 -2
- package/dist/sources/new-user-followed/new-user-followed.mjs +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
|
|
1
6
|
# Getting Started
|
|
2
7
|
In order to connect your Twitter account to Pipedream, you'll need to create a developer project and app.
|
|
3
8
|
1. First, visit Twitter's [developer dashboard](https://developer.twitter.com/en/portal/dashboard) and sign in
|
|
@@ -19,6 +24,14 @@ In order to connect your Twitter account to Pipedream, you'll need to create a d
|
|
|
19
24
|
|
|
20
25
|

|
|
21
26
|
|
|
27
|
+
# Example Use Cases
|
|
28
|
+
|
|
29
|
+
- **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.
|
|
30
|
+
|
|
31
|
+
- **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.
|
|
32
|
+
|
|
33
|
+
- **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.
|
|
34
|
+
|
|
22
35
|
# Troubleshooting
|
|
23
36
|
Below are some of the most common issues we see.
|
|
24
37
|
|
|
@@ -8,7 +8,7 @@ export default defineAction({
|
|
|
8
8
|
key: "twitter-add-user-to-list",
|
|
9
9
|
name: "Add User To List",
|
|
10
10
|
description: `Add a member to a list owned by the user. [See the documentation](${DOCS_LINK})`,
|
|
11
|
-
version: "2.0.
|
|
11
|
+
version: "2.0.8",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
|
@@ -13,7 +13,7 @@ declare const _default: import("@pipedream/types").Action<unknown, {
|
|
|
13
13
|
getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
14
14
|
getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
15
15
|
getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
16
|
-
getAuthenticatedUserId(): Promise<
|
|
16
|
+
getAuthenticatedUserId(): Promise<import("../../common/types/responseSchemas.js").User["id"]>;
|
|
17
17
|
getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").DirectMessage>>;
|
|
18
18
|
getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
19
19
|
getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").List>>;
|
|
@@ -24,8 +24,8 @@ declare const _default: import("@pipedream/types").Action<unknown, {
|
|
|
24
24
|
getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
25
25
|
likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
|
|
26
26
|
getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
27
|
-
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").
|
|
28
|
-
retweet(args: import("../../common/types/requestParams.js").
|
|
27
|
+
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowingParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
28
|
+
retweet(args: import("../../common/types/requestParams.js").RetweetParams): Promise<object>;
|
|
29
29
|
searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
30
30
|
sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
|
|
31
31
|
unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
|
|
@@ -8,7 +8,7 @@ export default defineAction({
|
|
|
8
8
|
key: "twitter-get-tweet",
|
|
9
9
|
name: "Get Tweet",
|
|
10
10
|
description: `Return a single tweet specified by ID. [See the documentation](${DOCS_LINK})`,
|
|
11
|
-
version: "2.0.
|
|
11
|
+
version: "2.0.8",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-list-favorites",
|
|
12
12
|
name: "List Liked Tweets",
|
|
13
13
|
description: `Return the most recent tweets liked by you or the specified user. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-list-followers",
|
|
12
12
|
name: "List Followers",
|
|
13
13
|
description: `Return a collection of user objects for users following the specified user. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-list-lists",
|
|
12
12
|
name: "List Lists",
|
|
13
13
|
description: `Get all lists owned by a user. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-list-mentions",
|
|
12
12
|
name: "List Mentions",
|
|
13
13
|
description: `Return the most recent mentions for the specified user. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.9",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-list-user-tweets",
|
|
12
12
|
name: "List User Tweets",
|
|
13
13
|
description: `Return a collection of the most recent tweets posted by a user. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -8,7 +8,7 @@ export default defineAction({
|
|
|
8
8
|
key: "twitter-send-dm",
|
|
9
9
|
name: "Send Direct Message (DM)",
|
|
10
10
|
description: `Send a message to a user. [See the documentation](${DOCS_LINK})`,
|
|
11
|
-
version: "1.0.
|
|
11
|
+
version: "1.0.6",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-simple-search",
|
|
12
12
|
name: "Search Tweets",
|
|
13
13
|
description: `Retrieve Tweets from the last seven days that match a query. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -11,7 +11,7 @@ export default defineAction({
|
|
|
11
11
|
key: "twitter-simple-search-in-list",
|
|
12
12
|
name: "Search Tweets in List",
|
|
13
13
|
description: `Search Tweets by text in a list. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "2.0.
|
|
14
|
+
version: "2.0.8",
|
|
15
15
|
type: "action",
|
|
16
16
|
props: {
|
|
17
17
|
...common.props,
|
|
@@ -7,7 +7,7 @@ export default defineAction({
|
|
|
7
7
|
key: "twitter-unlike-tweet",
|
|
8
8
|
name: "Unlike Tweet",
|
|
9
9
|
description: `Unlike a tweet specified by its ID. [See the documentation](${DOCS_LINK})`,
|
|
10
|
-
version: "2.0.
|
|
10
|
+
version: "2.0.8",
|
|
11
11
|
type: "action",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -2,8 +2,7 @@ import common from "../../common/appValidation.mjs";
|
|
|
2
2
|
import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
|
|
3
3
|
import { defineAction } from "@pipedream/types";
|
|
4
4
|
import constants from "../../common/constants.mjs";
|
|
5
|
-
import
|
|
6
|
-
import { axios } from "@pipedream/platform";
|
|
5
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
7
6
|
import FormData from "form-data";
|
|
8
7
|
const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload";
|
|
9
8
|
export default defineAction({
|
|
@@ -11,15 +10,14 @@ export default defineAction({
|
|
|
11
10
|
key: "twitter-upload-media",
|
|
12
11
|
name: "Upload Media",
|
|
13
12
|
description: `Upload new media. [See the documentation](${DOCS_LINK})`,
|
|
14
|
-
version: "0.0.
|
|
13
|
+
version: "0.0.13",
|
|
15
14
|
type: "action",
|
|
16
15
|
props: {
|
|
17
16
|
...common.props,
|
|
18
17
|
filePath: {
|
|
19
18
|
type: "string",
|
|
20
|
-
label: "File Path",
|
|
21
|
-
description: "
|
|
22
|
-
optional: false,
|
|
19
|
+
label: "File Path or URL",
|
|
20
|
+
description: "Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf).",
|
|
23
21
|
},
|
|
24
22
|
media_category: {
|
|
25
23
|
type: "string",
|
|
@@ -30,29 +28,22 @@ export default defineAction({
|
|
|
30
28
|
},
|
|
31
29
|
},
|
|
32
30
|
async run({ $ }) {
|
|
33
|
-
|
|
34
|
-
let content;
|
|
31
|
+
let content, meta;
|
|
35
32
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
: await axios($, {
|
|
41
|
-
url: this.filePath,
|
|
42
|
-
responseType: "arraybuffer",
|
|
43
|
-
});
|
|
33
|
+
const { stream, metadata, } = await getFileStreamAndMetadata(this.filePath);
|
|
34
|
+
content = stream;
|
|
35
|
+
meta = metadata;
|
|
44
36
|
}
|
|
45
37
|
catch (err) {
|
|
46
38
|
$.export("error", err);
|
|
47
39
|
throw new Error(ACTION_ERROR_MESSAGE);
|
|
48
40
|
}
|
|
49
41
|
const data = new FormData();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
42
|
+
data.append("media_data", content, {
|
|
43
|
+
contentType: meta.contentType,
|
|
44
|
+
knownLength: meta.size,
|
|
45
|
+
filename: meta.name,
|
|
46
|
+
});
|
|
56
47
|
const response = await this.app.uploadMedia({
|
|
57
48
|
$,
|
|
58
49
|
data,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IncludesIdCollectionFlattened } from "./types/includeMapping.js";
|
|
2
|
+
import { DirectMessage, List, ResponseIncludes, Tweet, TwitterEntity, User } from "./types/responseSchemas.js";
|
|
3
|
+
export declare function getDirectMessageIncludeIds(obj: DirectMessage): IncludesIdCollectionFlattened;
|
|
4
|
+
export declare function getListIncludeIds(obj: List): IncludesIdCollectionFlattened;
|
|
5
|
+
export declare function getUserIncludeIds(obj: User): IncludesIdCollectionFlattened;
|
|
6
|
+
export declare function getTweetIncludeIds(obj: Tweet): IncludesIdCollectionFlattened;
|
|
7
|
+
export declare function getObjIncludes(obj: TwitterEntity, includes: ResponseIncludes, getIncludeIds: (o: TwitterEntity) => IncludesIdCollectionFlattened): {
|
|
8
|
+
[k: string]: any;
|
|
9
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// https://developer.twitter.com/en/docs/twitter-api/expansions
|
|
2
|
+
function flatClearIncludeIds(obj) {
|
|
3
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value,]) => [
|
|
4
|
+
key,
|
|
5
|
+
value.filter((e) => e !== undefined).flat(),
|
|
6
|
+
]));
|
|
7
|
+
}
|
|
8
|
+
export function getDirectMessageIncludeIds(obj) {
|
|
9
|
+
return flatClearIncludeIds({
|
|
10
|
+
userIds: [
|
|
11
|
+
obj.sender_id,
|
|
12
|
+
obj.participant_ids,
|
|
13
|
+
],
|
|
14
|
+
mediaKeys: [
|
|
15
|
+
obj.attachments?.media_keys,
|
|
16
|
+
],
|
|
17
|
+
tweetIds: [
|
|
18
|
+
obj.referenced_tweets?.map(({ id }) => id),
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function getListIncludeIds(obj) {
|
|
23
|
+
return flatClearIncludeIds({
|
|
24
|
+
userIds: [
|
|
25
|
+
obj.owner_id,
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function getUserIncludeIds(obj) {
|
|
30
|
+
return flatClearIncludeIds({
|
|
31
|
+
tweetIds: [
|
|
32
|
+
obj.pinned_tweet_id,
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function getTweetIncludeIds(obj) {
|
|
37
|
+
return flatClearIncludeIds({
|
|
38
|
+
userIds: [
|
|
39
|
+
obj.author_id,
|
|
40
|
+
obj.in_reply_to_user_id,
|
|
41
|
+
],
|
|
42
|
+
userNames: [
|
|
43
|
+
obj.entities?.mentions?.map(({ username }) => username),
|
|
44
|
+
],
|
|
45
|
+
tweetIds: [
|
|
46
|
+
obj.edit_history_tweet_ids,
|
|
47
|
+
obj.referenced_tweets?.map(({ id }) => id),
|
|
48
|
+
],
|
|
49
|
+
pollIds: [
|
|
50
|
+
obj.attachments?.poll_ids,
|
|
51
|
+
],
|
|
52
|
+
placeIds: [
|
|
53
|
+
obj.geo?.place_id,
|
|
54
|
+
],
|
|
55
|
+
mediaKeys: [
|
|
56
|
+
obj.attachments?.media_keys,
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function getObjIncludes(obj, includes = {}, getIncludeIds) {
|
|
61
|
+
const { userIds, userNames, tweetIds, pollIds, placeIds, mediaKeys, } = getIncludeIds(obj);
|
|
62
|
+
const result = {
|
|
63
|
+
media: includes.media?.filter((item) => mediaKeys?.includes(item.media_key)),
|
|
64
|
+
users: includes.users?.filter((item) => userIds?.includes(item.id) || userNames?.includes(item.username)),
|
|
65
|
+
places: includes.places?.filter((item) => placeIds?.includes(item.id)),
|
|
66
|
+
polls: includes.polls?.filter((item) => pollIds?.includes(item.id)),
|
|
67
|
+
tweets: includes.tweets?.filter((item) => tweetIds?.includes(item.id)),
|
|
68
|
+
};
|
|
69
|
+
return Object.fromEntries(Object.entries(result).filter(([, value,]) => value?.length > 0));
|
|
70
|
+
}
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
POLL_FIELD_OPTIONS,
|
|
9
9
|
TWEET_FIELD_OPTIONS,
|
|
10
10
|
USER_FIELD_OPTIONS,
|
|
11
|
-
} from "./dataFields
|
|
11
|
+
} from "./dataFields";
|
|
12
12
|
import {
|
|
13
13
|
LIST_EXPANSION_OPTIONS,
|
|
14
14
|
TWEET_EXPANSION_OPTIONS,
|
|
15
15
|
USER_EXPANSION_OPTIONS,
|
|
16
|
-
} from "./expansions
|
|
16
|
+
} from "./expansions";
|
|
17
17
|
|
|
18
18
|
// These cannot be propDefinitions in the app file, because additionalProps() needs them to be primitives
|
|
19
19
|
const listExpansions = {
|
|
@@ -51,7 +51,7 @@ declare const _default: {
|
|
|
51
51
|
getListTweets({ listId, ...args }: import("./types/requestParams.js").GetListTweetsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
52
52
|
getTweet({ tweetId, ...args }: import("./types/requestParams.js").GetTweetParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
53
53
|
getAuthenticatedUser(args: import("./types/requestParams.js").GetAuthenticatedUserParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").User>>;
|
|
54
|
-
getAuthenticatedUserId(): Promise<
|
|
54
|
+
getAuthenticatedUserId(): Promise<import("./types/responseSchemas.js").User["id"]>;
|
|
55
55
|
getDirectMessages(args: import("./types/requestParams.js").GetDirectMessagesParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").DirectMessage>>;
|
|
56
56
|
getUserLikedTweets({ userId, ...args }: import("./types/requestParams.js").GetUserLikedTweetParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
57
57
|
getUserOwnedLists({ userId, ...args }: import("./types/requestParams.js").GetUserOwnedListsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").List>>;
|
|
@@ -62,8 +62,8 @@ declare const _default: {
|
|
|
62
62
|
getUser({ userId, ...args }: import("./types/requestParams.js").GetUserParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").User>>;
|
|
63
63
|
likeTweet(args: import("./types/requestParams.js").LikeTweetParams): Promise<object>;
|
|
64
64
|
getUserFollowers({ userId, ...args }: import("./types/requestParams.js").GetUserFollowersParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").User>>;
|
|
65
|
-
getUserFollowing({ userId, ...args }: import("./types/requestParams.js").
|
|
66
|
-
retweet(args: import("./types/requestParams.js").
|
|
65
|
+
getUserFollowing({ userId, ...args }: import("./types/requestParams.js").GetUserFollowingParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").User>>;
|
|
66
|
+
retweet(args: import("./types/requestParams.js").RetweetParams): Promise<object>;
|
|
67
67
|
searchTweets(args: import("./types/requestParams.js").SearchTweetsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
68
68
|
sendMessage({ userId, ...args }: import("./types/requestParams.js").SendMessageParams): Promise<object>;
|
|
69
69
|
unfollowUser({ userId, ...args }: import("./types/requestParams.js").UnfollowUserParams): Promise<object>;
|
|
@@ -82,7 +82,7 @@ declare const _default: {
|
|
|
82
82
|
getListTweets({ listId, ...args }: import("./types/requestParams.js").GetListTweetsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
83
83
|
getTweet({ tweetId, ...args }: import("./types/requestParams.js").GetTweetParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
84
84
|
getAuthenticatedUser(args: import("./types/requestParams.js").GetAuthenticatedUserParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").User>>;
|
|
85
|
-
getAuthenticatedUserId(): Promise<
|
|
85
|
+
getAuthenticatedUserId(): Promise<import("./types/responseSchemas.js").User["id"]>;
|
|
86
86
|
getDirectMessages(args: import("./types/requestParams.js").GetDirectMessagesParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").DirectMessage>>;
|
|
87
87
|
getUserLikedTweets({ userId, ...args }: import("./types/requestParams.js").GetUserLikedTweetParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
88
88
|
getUserOwnedLists({ userId, ...args }: import("./types/requestParams.js").GetUserOwnedListsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").List>>;
|
|
@@ -93,8 +93,8 @@ declare const _default: {
|
|
|
93
93
|
getUser({ userId, ...args }: import("./types/requestParams.js").GetUserParams): Promise<import("./types/responseSchemas.js").ResponseObject<import("./types/responseSchemas.js").User>>;
|
|
94
94
|
likeTweet(args: import("./types/requestParams.js").LikeTweetParams): Promise<object>;
|
|
95
95
|
getUserFollowers({ userId, ...args }: import("./types/requestParams.js").GetUserFollowersParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").User>>;
|
|
96
|
-
getUserFollowing({ userId, ...args }: import("./types/requestParams.js").
|
|
97
|
-
retweet(args: import("./types/requestParams.js").
|
|
96
|
+
getUserFollowing({ userId, ...args }: import("./types/requestParams.js").GetUserFollowingParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").User>>;
|
|
97
|
+
retweet(args: import("./types/requestParams.js").RetweetParams): Promise<object>;
|
|
98
98
|
searchTweets(args: import("./types/requestParams.js").SearchTweetsParams): Promise<import("./types/responseSchemas.js").PaginatedResponseObject<import("./types/responseSchemas.js").Tweet>>;
|
|
99
99
|
sendMessage({ userId, ...args }: import("./types/requestParams.js").SendMessageParams): Promise<object>;
|
|
100
100
|
unfollowUser({ userId, ...args }: import("./types/requestParams.js").UnfollowUserParams): Promise<object>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type IncludesIdMap<T> = {
|
|
2
|
+
mediaKeys?: T;
|
|
3
|
+
placeIds?: T;
|
|
4
|
+
pollIds?: T;
|
|
5
|
+
tweetIds?: T;
|
|
6
|
+
userIds?: T;
|
|
7
|
+
userNames?: T;
|
|
8
|
+
};
|
|
9
|
+
export type IncludesIdCollection = IncludesIdMap<(string | string[])[]>;
|
|
10
|
+
export type IncludesIdCollectionFlattened = IncludesIdMap<string[]>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,12 +2,15 @@ export interface TwitterEntity {
|
|
|
2
2
|
id: string;
|
|
3
3
|
}
|
|
4
4
|
export type TwitterEntityMap = Record<string, object>;
|
|
5
|
-
export interface DirectMessage extends TwitterEntity {
|
|
5
|
+
export interface DirectMessage extends TwitterEntity, HasMediaAttachments, HasReferencedTweets {
|
|
6
6
|
event_type: "MessageCreate";
|
|
7
7
|
text: string;
|
|
8
|
+
sender_id?: string;
|
|
9
|
+
participant_ids?: string[];
|
|
8
10
|
}
|
|
9
11
|
export interface List extends TwitterEntity {
|
|
10
12
|
name: string;
|
|
13
|
+
owner_id?: string;
|
|
11
14
|
}
|
|
12
15
|
interface MetricsFields {
|
|
13
16
|
public_metrics?: string;
|
|
@@ -15,10 +18,28 @@ interface MetricsFields {
|
|
|
15
18
|
organic_metrics?: string;
|
|
16
19
|
promoted_metrics?: string;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
text: string;
|
|
20
|
-
edit_history_tweet_ids: string[];
|
|
21
|
+
interface HasReferencedTweets {
|
|
21
22
|
referenced_tweets?: ReferencedTweet[];
|
|
23
|
+
}
|
|
24
|
+
interface HasMediaAttachments {
|
|
25
|
+
attachments?: {
|
|
26
|
+
media_keys?: string[];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface Tweet extends TwitterEntity, MetricsFields, HasReferencedTweets {
|
|
30
|
+
text: string;
|
|
31
|
+
author_id?: string;
|
|
32
|
+
edit_history_tweet_ids?: string[];
|
|
33
|
+
in_reply_to_user_id?: string;
|
|
34
|
+
attachments?: HasMediaAttachments["attachments"] & {
|
|
35
|
+
poll_ids: string[];
|
|
36
|
+
};
|
|
37
|
+
geo?: {
|
|
38
|
+
place_id: string;
|
|
39
|
+
};
|
|
40
|
+
entities?: {
|
|
41
|
+
mentions?: User[];
|
|
42
|
+
};
|
|
22
43
|
includes?: {
|
|
23
44
|
tweets?: Tweet[];
|
|
24
45
|
};
|
|
@@ -30,10 +51,16 @@ export interface ReferencedTweet {
|
|
|
30
51
|
export interface User extends TwitterEntity {
|
|
31
52
|
name: string;
|
|
32
53
|
username: string;
|
|
54
|
+
pinned_tweet_id?: string;
|
|
33
55
|
}
|
|
34
|
-
|
|
56
|
+
type Poll = TwitterEntity;
|
|
57
|
+
type Place = TwitterEntity;
|
|
58
|
+
export interface ResponseIncludes {
|
|
59
|
+
places?: Place[];
|
|
60
|
+
polls?: Poll[];
|
|
35
61
|
users?: User[];
|
|
36
62
|
tweets?: Tweet[];
|
|
63
|
+
media?: MediaItem[];
|
|
37
64
|
}
|
|
38
65
|
interface ResponseBase {
|
|
39
66
|
includes?: ResponseIncludes;
|
|
@@ -49,4 +76,7 @@ export type PaginatedResponseObject<T extends TwitterEntity> = ResponseBase & {
|
|
|
49
76
|
result_count: number;
|
|
50
77
|
};
|
|
51
78
|
};
|
|
79
|
+
interface MediaItem {
|
|
80
|
+
media_key: string;
|
|
81
|
+
}
|
|
52
82
|
export {};
|
|
@@ -59,7 +59,7 @@ declare const _default: {
|
|
|
59
59
|
getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
60
60
|
getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
61
61
|
getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
62
|
-
getAuthenticatedUserId(): Promise<
|
|
62
|
+
getAuthenticatedUserId(): Promise<import("../../common/types/responseSchemas.js").User["id"]>;
|
|
63
63
|
getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").DirectMessage>>;
|
|
64
64
|
getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
65
65
|
getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").List>>;
|
|
@@ -70,8 +70,8 @@ declare const _default: {
|
|
|
70
70
|
getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
71
71
|
likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
|
|
72
72
|
getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
73
|
-
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").
|
|
74
|
-
retweet(args: import("../../common/types/requestParams.js").
|
|
73
|
+
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowingParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
74
|
+
retweet(args: import("../../common/types/requestParams.js").RetweetParams): Promise<object>;
|
|
75
75
|
searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
76
76
|
sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
|
|
77
77
|
unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
|
|
@@ -90,7 +90,7 @@ declare const _default: {
|
|
|
90
90
|
getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
91
91
|
getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
92
92
|
getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
93
|
-
getAuthenticatedUserId(): Promise<
|
|
93
|
+
getAuthenticatedUserId(): Promise<import("../../common/types/responseSchemas.js").User["id"]>;
|
|
94
94
|
getDirectMessages(args: import("../../common/types/requestParams.js").GetDirectMessagesParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").DirectMessage>>;
|
|
95
95
|
getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
96
96
|
getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").List>>;
|
|
@@ -101,8 +101,8 @@ declare const _default: {
|
|
|
101
101
|
getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas.js").ResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
102
102
|
likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
|
|
103
103
|
getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
104
|
-
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").
|
|
105
|
-
retweet(args: import("../../common/types/requestParams.js").
|
|
104
|
+
getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowingParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").User>>;
|
|
105
|
+
retweet(args: import("../../common/types/requestParams.js").RetweetParams): Promise<object>;
|
|
106
106
|
searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas.js").PaginatedResponseObject<import("../../common/types/responseSchemas.js").Tweet>>;
|
|
107
107
|
sendMessage({ userId, ...args }: import("../../common/types/requestParams.js").SendMessageParams): Promise<object>;
|
|
108
108
|
unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
|
|
@@ -4,12 +4,13 @@ import { getUserSummary as getItemSummary } from "../common/getItemSummary.mjs";
|
|
|
4
4
|
import { getUserFields } from "../../common/methods.mjs";
|
|
5
5
|
import { DOCS_LINK, MAX_RESULTS_PER_PAGE, } from "../../actions/list-followers/list-followers.mjs";
|
|
6
6
|
import cacheUserId from "../common/cacheUserId.mjs";
|
|
7
|
+
import { getObjIncludes, getUserIncludeIds, } from "../../common/addObjIncludes.mjs";
|
|
7
8
|
export default defineSource({
|
|
8
9
|
...common,
|
|
9
10
|
key: "twitter-new-follower-of-user",
|
|
10
11
|
name: "New Follower Received by User",
|
|
11
12
|
description: `Emit new event when the specified User receives a Follower [See the documentation](${DOCS_LINK})`,
|
|
12
|
-
version: "2.0
|
|
13
|
+
version: "2.1.0",
|
|
13
14
|
type: "source",
|
|
14
15
|
props: {
|
|
15
16
|
...common.props,
|
|
@@ -37,7 +38,8 @@ export default defineSource({
|
|
|
37
38
|
params: this.getUserFields(),
|
|
38
39
|
userId,
|
|
39
40
|
};
|
|
40
|
-
const { data } = await this.app.getUserFollowers(params);
|
|
41
|
+
const { data, includes, } = await this.app.getUserFollowers(params);
|
|
42
|
+
data.forEach((user) => user.includes = getObjIncludes(user, includes, getUserIncludeIds));
|
|
41
43
|
return data;
|
|
42
44
|
},
|
|
43
45
|
},
|