-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathget_list_by_id.js
More file actions
31 lines (26 loc) · 864 Bytes
/
get_list_by_id.js
File metadata and controls
31 lines (26 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* List Lookup - X API v2
*
* Endpoint: GET https://api.x.com/2/lists/:id
* Docs: https://developer.x.com/en/docs/twitter-api/lists/list-lookup/api-reference/get-lists-id
*
* Authentication: Bearer Token (App-only) or OAuth (User Context)
* Required env vars: BEARER_TOKEN
*/
const { Client } = require('@xdevplatform/xdk');
const token = process.env.BEARER_TOKEN;
const client = new Client({ bearerToken: token });
// Replace with the list ID you want to look up
const listId = "84839422";
(async () => {
try {
const response = await client.lists.getById(listId, {
listFields: ['created_at', 'follower_count', 'member_count', 'owner_id', 'description']
});
console.dir(response, { depth: null });
} catch (e) {
console.log(e);
process.exit(-1);
}
process.exit();
})();