mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 09:34:07 -08:00
42721dba80
* First node set up. * Progress: all Resources and Operations updated * Upsates to all resources. * Updated tooltip for Tweet > Search > Tweet fields. * Upodate to resource locator items in User > Search. * Added e.g. to placeholders and minor copy tweaks. * Fixed Operations sorting. * Added a couple of operations back. * Removed 'Authorized API Call'. * Remove authorization header when empty * Import pkce * Add OAuth2 with new grant type to Twitter * Add pkce logic auto assign authorization code if pkce not defined * Add pkce to ui and interfaces * Fix scopes for Oauth2 twitter * Deubg + pass it through header * Add debug console, add airtable cred * Remove all console.logs, make PKCE in th body only when it exists * Remove invalid character ~ * Remove more console.logs * remove body inside query * Remove useless grantype check * Hide oauth2 twitter waiting for overhaul * Remove redundant header removal * Remove more console.logs * Add V2 twitter * Add V1 * Fix description V1, V2 * Fix description for V1 * Add Oauth2 request * Add user lookup * Add search username by ID * Search tweet feat * Wip create tweet * Generic function for returning ID * Add like and retweet feat * Add delete tweet feat * Fix Location tweets * Fix type * Feat List add members * Add scopes for dm and list * Add direct message feature * Improve response data * Fix regex * Add unit test to Twitter v2 * Fix unit test * Remove console.logs * Remove more console.logs * Handle @ in username * Minor copy tweaks. * Add return all logic * Add error for api permission error * Update message api error * Add error for date error * Add notice for TwitterOAuth2 api link * Fix display names location * fix List RLC * Fix like endpoint * Fix error message check * fix(core): Fix OAuth2 callback for grantType=clientCredentials * Improve fix for callback * update pnpm * Fix iso time for end time * sync oauth2Credential * remove unused codeVerifer in Server.ts * Add location and attachments notice * Add notice to oauth1 * Improve notice for twitter * moved credentials notice to TwitterOAuth1Api.credentials.ts --------- Co-authored-by: agobrech <ael.gobrecht@gmail.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Marcus <marcus@n8n.io>
480 lines
10 KiB
TypeScript
480 lines
10 KiB
TypeScript
import type { INodeProperties } from 'n8n-workflow';
|
|
|
|
export const tweetOperations: INodeProperties[] = [
|
|
{
|
|
displayName: 'Operation',
|
|
name: 'operation',
|
|
type: 'options',
|
|
noDataExpression: true,
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
name: 'Create',
|
|
value: 'create',
|
|
description: 'Create, quote, or reply to a tweet',
|
|
action: 'Create Tweet',
|
|
},
|
|
{
|
|
name: 'Delete',
|
|
value: 'delete',
|
|
description: 'Delete a tweet',
|
|
action: 'Delete Tweet',
|
|
},
|
|
{
|
|
name: 'Like',
|
|
value: 'like',
|
|
description: 'Like a tweet',
|
|
action: 'Like Tweet',
|
|
},
|
|
{
|
|
name: 'Retweet',
|
|
value: 'retweet',
|
|
description: 'Retweet a tweet',
|
|
action: 'Retweet Tweet',
|
|
},
|
|
{
|
|
name: 'Search',
|
|
value: 'search',
|
|
description: 'Search for tweets from the last seven days',
|
|
action: 'Search Tweets',
|
|
},
|
|
],
|
|
default: 'create',
|
|
},
|
|
];
|
|
|
|
export const tweetFields: INodeProperties[] = [
|
|
/* -------------------------------------------------------------------------- */
|
|
/* tweet:create */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Text',
|
|
name: 'text',
|
|
type: 'string',
|
|
typeOptions: {
|
|
rows: 2,
|
|
},
|
|
default: '',
|
|
required: true,
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['create'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
description:
|
|
'The text of the status update. URLs must be encoded. Links wrapped with the t.co shortener will affect character count',
|
|
},
|
|
{
|
|
displayName: 'Options',
|
|
name: 'additionalFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
default: {},
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['create'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
displayName: 'Location ID',
|
|
name: 'location',
|
|
type: 'string',
|
|
placeholder: '4e696bef7e24d378',
|
|
default: '',
|
|
description: 'Location information for the tweet',
|
|
},
|
|
{
|
|
displayName: 'Media ID',
|
|
name: 'attachments',
|
|
type: 'string',
|
|
default: '',
|
|
placeholder: '1664279886239010824',
|
|
description: 'The attachment ID to associate with the message',
|
|
},
|
|
{
|
|
displayName: 'Quote a Tweet',
|
|
name: 'inQuoteToStatusId',
|
|
type: 'resourceLocator',
|
|
default: { mode: 'id', value: '' },
|
|
description: 'The tweet being quoted',
|
|
modes: [
|
|
{
|
|
displayName: 'By ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. 1187836157394112513',
|
|
url: '',
|
|
},
|
|
{
|
|
displayName: 'By URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. https://twitter.com/n8n_io/status/1187836157394112513',
|
|
url: '',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
displayName: 'Reply to Tweet',
|
|
name: 'inReplyToStatusId',
|
|
type: 'resourceLocator',
|
|
default: { mode: 'id', value: '' },
|
|
// required: true,
|
|
description: 'The tweet being replied to',
|
|
modes: [
|
|
{
|
|
displayName: 'By ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. 1187836157394112513',
|
|
url: '',
|
|
},
|
|
{
|
|
displayName: 'By URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. https://twitter.com/n8n_io/status/1187836157394112513',
|
|
url: '',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
displayName: 'Locations are not supported due to Twitter V2 API limitations',
|
|
name: 'noticeLocation',
|
|
type: 'notice',
|
|
displayOptions: {
|
|
show: {
|
|
'/additionalFields.location': [''],
|
|
},
|
|
},
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Attachements are not supported due to Twitter V2 API limitations',
|
|
name: 'noticeAttachments',
|
|
type: 'notice',
|
|
displayOptions: {
|
|
show: {
|
|
'/additionalFields.attachments': [''],
|
|
},
|
|
},
|
|
default: '',
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* tweet:delete */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Tweet',
|
|
name: 'tweetDeleteId',
|
|
type: 'resourceLocator',
|
|
default: { mode: 'id', value: '' },
|
|
required: true,
|
|
description: 'The tweet to delete',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['tweet'],
|
|
operation: ['delete'],
|
|
},
|
|
},
|
|
modes: [
|
|
{
|
|
displayName: 'By ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. 1187836157394112513',
|
|
url: '',
|
|
},
|
|
{
|
|
displayName: 'By URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. https://twitter.com/n8n_io/status/1187836157394112513',
|
|
url: '',
|
|
},
|
|
],
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* tweet:like */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Tweet',
|
|
name: 'tweetId',
|
|
type: 'resourceLocator',
|
|
default: { mode: 'id', value: '' },
|
|
required: true,
|
|
description: 'The tweet to like',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['like'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
modes: [
|
|
{
|
|
displayName: 'By ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. 1187836157394112513',
|
|
url: '',
|
|
},
|
|
{
|
|
displayName: 'By URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. https://twitter.com/n8n_io/status/1187836157394112513',
|
|
url: '',
|
|
},
|
|
],
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* tweet:search */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
// displayName: 'Search Text',
|
|
displayName: 'Search Term',
|
|
name: 'searchText',
|
|
type: 'string',
|
|
required: true,
|
|
default: '',
|
|
placeholder: 'e.g. automation',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['search'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
description:
|
|
'A UTF-8, URL-encoded search query of 500 characters maximum, including operators. Queries may additionally be limited by complexity. Check the searching examples <a href="https://developer.twitter.com/en/docs/tweets/search/guides/standard-operators">here</a>.',
|
|
},
|
|
{
|
|
displayName: 'Return All',
|
|
name: 'returnAll',
|
|
type: 'boolean',
|
|
default: false,
|
|
description: 'Whether to return all results or only up to a given limit',
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['tweet'],
|
|
operation: ['search'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Limit',
|
|
name: 'limit',
|
|
type: 'number',
|
|
default: 50,
|
|
description: 'Max number of results to return',
|
|
typeOptions: {
|
|
minValue: 1,
|
|
},
|
|
displayOptions: {
|
|
show: {
|
|
resource: ['tweet'],
|
|
operation: ['search'],
|
|
returnAll: [false],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Options',
|
|
name: 'additionalFields',
|
|
type: 'collection',
|
|
placeholder: 'Add Field',
|
|
default: {},
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['search'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
options: [
|
|
{
|
|
displayName: 'Sort Order',
|
|
name: 'sortOrder',
|
|
type: 'options',
|
|
options: [
|
|
{
|
|
name: 'Recent',
|
|
value: 'recency',
|
|
},
|
|
{
|
|
name: 'Relevant',
|
|
value: 'relevancy',
|
|
},
|
|
],
|
|
// required: true,
|
|
description: 'The order in which to return results',
|
|
default: 'recency',
|
|
},
|
|
{
|
|
displayName: 'After',
|
|
name: 'startTime',
|
|
type: 'dateTime',
|
|
default: '',
|
|
description:
|
|
"Tweets before this date will not be returned. This date must be within the last 7 days if you don't have Academic Research access.",
|
|
},
|
|
{
|
|
displayName: 'Before',
|
|
name: 'endTime',
|
|
type: 'dateTime',
|
|
default: '',
|
|
description:
|
|
"Tweets after this date will not be returned. This date must be within the last 7 days if you don't have Academic Research access.",
|
|
},
|
|
{
|
|
displayName: 'Tweet Fields',
|
|
name: 'tweetFieldsObject',
|
|
type: 'multiOptions',
|
|
// eslint-disable-next-line n8n-nodes-base/node-param-multi-options-type-unsorted-items
|
|
options: [
|
|
{
|
|
name: 'Attachments',
|
|
value: 'attachments',
|
|
},
|
|
{
|
|
name: 'Author ID',
|
|
value: 'author_id',
|
|
},
|
|
{
|
|
name: 'Context Annotations',
|
|
value: 'context_annotations',
|
|
},
|
|
{
|
|
name: 'Conversation ID',
|
|
value: 'conversation_id',
|
|
},
|
|
{
|
|
name: 'Created At',
|
|
value: 'created_at',
|
|
},
|
|
{
|
|
name: 'Edit Controls',
|
|
value: 'edit_controls',
|
|
},
|
|
{
|
|
name: 'Entities',
|
|
value: 'entities',
|
|
},
|
|
{
|
|
name: 'Geo',
|
|
value: 'geo',
|
|
},
|
|
{
|
|
name: 'ID',
|
|
value: 'id',
|
|
},
|
|
{
|
|
name: 'In Reply To User ID',
|
|
value: 'in_reply_to_user_id',
|
|
},
|
|
{
|
|
name: 'Lang',
|
|
value: 'lang',
|
|
},
|
|
{
|
|
name: 'Non Public Metrics',
|
|
value: 'non_public_metrics',
|
|
},
|
|
{
|
|
name: 'Public Metrics',
|
|
value: 'public_metrics',
|
|
},
|
|
{
|
|
name: 'Organic Metrics',
|
|
value: 'organic_metrics',
|
|
},
|
|
{
|
|
name: 'Promoted Metrics',
|
|
value: 'promoted_metrics',
|
|
},
|
|
{
|
|
name: 'Possibly Sensitive',
|
|
value: 'possibly_sensitive',
|
|
},
|
|
{
|
|
name: 'Referenced Tweets',
|
|
value: 'referenced_tweets',
|
|
},
|
|
{
|
|
name: 'Reply Settings',
|
|
value: 'reply_settings',
|
|
},
|
|
{
|
|
name: 'Source',
|
|
value: 'source',
|
|
},
|
|
{
|
|
name: 'Text',
|
|
value: 'text',
|
|
},
|
|
{
|
|
name: 'Withheld',
|
|
value: 'withheld',
|
|
},
|
|
],
|
|
default: [],
|
|
description:
|
|
'The fields to add to each returned tweet object. Default fields are: ID, text, edit_history_tweet_ids.',
|
|
},
|
|
],
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* tweet:retweet */
|
|
/* -------------------------------------------------------------------------- */
|
|
{
|
|
displayName: 'Tweet',
|
|
name: 'tweetId',
|
|
type: 'resourceLocator',
|
|
default: { mode: 'id', value: '' },
|
|
required: true,
|
|
description: 'The tweet to retweet',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['retweet'],
|
|
resource: ['tweet'],
|
|
},
|
|
},
|
|
modes: [
|
|
{
|
|
displayName: 'By ID',
|
|
name: 'id',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. 1187836157394112513',
|
|
url: '',
|
|
},
|
|
{
|
|
displayName: 'By URL',
|
|
name: 'url',
|
|
type: 'string',
|
|
validation: [],
|
|
placeholder: 'e.g. https://twitter.com/n8n_io/status/1187836157394112513',
|
|
url: '',
|
|
},
|
|
],
|
|
},
|
|
];
|