first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.bitly",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Utility"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/bitly/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.bitly/"
}
]
}
}
@@ -0,0 +1,224 @@
import type {
IExecuteFunctions,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeConnectionTypes } from 'n8n-workflow';
import { bitlyApiRequest, bitlyApiRequestAllItems } from './GenericFunctions';
import { linkFields, linkOperations } from './LinkDescription';
export class Bitly implements INodeType {
description: INodeTypeDescription = {
displayName: 'Bitly',
name: 'bitly',
icon: 'file:bitly.svg',
group: ['output'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume Bitly API',
defaults: {
name: 'Bitly',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'bitlyApi',
required: true,
displayOptions: {
show: {
authentication: ['accessToken'],
},
},
},
{
name: 'bitlyOAuth2Api',
required: true,
displayOptions: {
show: {
authentication: ['oAuth2'],
},
},
},
],
properties: [
{
displayName: 'Authentication',
name: 'authentication',
type: 'options',
options: [
{
name: 'Access Token',
value: 'accessToken',
},
{
name: 'OAuth2',
value: 'oAuth2',
},
],
default: 'accessToken',
},
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Link',
value: 'link',
},
],
default: 'link',
},
...linkOperations,
...linkFields,
],
};
methods = {
loadOptions: {
// Get all the available groups to display them to user so that they can
// select them easily
async getGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const groups = await bitlyApiRequestAllItems.call(this, 'groups', 'GET', '/groups');
for (const group of groups) {
const groupName = group.name;
const groupId = group.guid;
returnData.push({
name: groupName,
value: groupId,
});
}
return returnData;
},
// Get all the available tags to display them to user so that they can
// select them easily
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const groupId = this.getCurrentNodeParameter('group') as string;
const returnData: INodePropertyOptions[] = [];
const tags = await bitlyApiRequestAllItems.call(
this,
'tags',
'GET',
`groups/${groupId}/tags`,
);
for (const tag of tags) {
const tagName = tag;
const tagId = tag;
returnData.push({
name: tagName,
value: tagId,
});
}
return returnData;
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
const length = items.length;
let responseData;
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
for (let i = 0; i < length; i++) {
try {
if (resource === 'link') {
if (operation === 'create') {
const longUrl = this.getNodeParameter('longUrl', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i);
const body: IDataObject = {
long_url: longUrl,
};
if (additionalFields.title) {
body.title = additionalFields.title as string;
}
if (additionalFields.domain) {
body.domain = additionalFields.domain as string;
}
if (additionalFields.group) {
body.group = additionalFields.group as string;
}
if (additionalFields.tags) {
body.tags = additionalFields.tags as string[];
}
const deeplinks = (this.getNodeParameter('deeplink', i) as IDataObject)
.deeplinkUi as IDataObject[];
if (deeplinks) {
for (const deeplink of deeplinks) {
//@ts-ignore
body.deeplinks.push({
app_uri_path: deeplink.appUriPath,
install_type: deeplink.installType,
install_url: deeplink.installUrl,
app_id: deeplink.appId,
});
}
}
responseData = await bitlyApiRequest.call(this, 'POST', '/bitlinks', body);
}
if (operation === 'update') {
const linkId = this.getNodeParameter('id', i) as string;
const updateFields = this.getNodeParameter('updateFields', i);
const body: IDataObject = {};
if (updateFields.longUrl) {
body.long_url = updateFields.longUrl as string;
}
if (updateFields.title) {
body.title = updateFields.title as string;
}
if (updateFields.archived !== undefined) {
body.archived = updateFields.archived as boolean;
}
if (updateFields.group) {
body.group = updateFields.group as string;
}
if (updateFields.tags) {
body.tags = updateFields.tags as string[];
}
const deeplinks = (this.getNodeParameter('deeplink', i) as IDataObject)
.deeplinkUi as IDataObject[];
if (deeplinks) {
for (const deeplink of deeplinks) {
//@ts-ignore
body.deeplinks.push({
app_uri_path: deeplink.appUriPath,
install_type: deeplink.installType,
install_url: deeplink.installUrl,
app_id: deeplink.appId,
});
}
}
responseData = await bitlyApiRequest.call(this, 'PATCH', `/bitlinks/${linkId}`, body);
}
if (operation === 'get') {
const linkId = this.getNodeParameter('id', i) as string;
responseData = await bitlyApiRequest.call(this, 'GET', `/bitlinks/${linkId}`);
}
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message, json: {}, itemIndex: i });
continue;
}
throw error;
}
}
return [returnData];
}
}
@@ -0,0 +1,79 @@
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
ILoadOptionsFunctions,
JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function bitlyApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
resource: string,
body: any = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
let options: IRequestOptions = {
headers: {},
method,
qs,
body,
uri: uri || `https://api-ssl.bitly.com/v4${resource}`,
json: true,
};
options = Object.assign({}, options, option);
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
try {
if (authenticationMethod === 'accessToken') {
const credentials = await this.getCredentials('bitlyApi');
options.headers = { Authorization: `Bearer ${credentials.accessToken}` };
return await this.helpers.request(options);
} else {
return await this.helpers.requestOAuth2.call(this, 'bitlyOAuth2Api', options, {
tokenType: 'Bearer',
});
}
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
/**
* Make an API request to paginated flow endpoint
* and return all results
*/
export async function bitlyApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string,
method: IHttpRequestMethods,
resource: string,
body: any = {},
query: IDataObject = {},
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
let uri: string | undefined;
query.size = 50;
do {
responseData = await bitlyApiRequest.call(this, method, resource, body, query, uri);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
if (responseData.pagination?.next) {
uri = responseData.pagination.next;
}
} while (responseData.pagination?.next !== undefined);
return returnData;
}
@@ -0,0 +1,292 @@
import type { INodeProperties } from 'n8n-workflow';
export const linkOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['link'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a link',
action: 'Create a link',
},
{
name: 'Get',
value: 'get',
description: 'Get a link',
action: 'Get a link',
},
{
name: 'Update',
value: 'update',
description: 'Update a link',
action: 'Update a link',
},
],
default: 'create',
},
];
export const linkFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* link:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Long URL',
name: 'longUrl',
type: 'string',
displayOptions: {
show: {
resource: ['link'],
operation: ['create'],
},
},
default: '',
placeholder: 'https://example.com',
required: true,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['link'],
operation: ['create'],
},
},
options: [
{
displayName: 'Domain',
name: 'domain',
type: 'string',
default: 'bit.ly',
},
{
displayName: 'Group Name or ID',
name: 'group',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getGroups',
},
},
{
displayName: 'Tag Names or IDs',
name: 'tags',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getTags',
loadOptionsDependsOn: ['group'],
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
},
],
},
{
displayName: 'Deeplinks',
name: 'deeplink',
placeholder: 'Add Deep Link',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
displayOptions: {
show: {
resource: ['link'],
operation: ['create'],
},
},
default: {},
options: [
{
name: 'deeplinkUi',
displayName: 'Deep Link',
values: [
{
displayName: 'App ID',
name: 'appId',
type: 'string',
default: '',
},
{
displayName: 'App URI Path',
name: 'appUriPath',
type: 'string',
default: '',
},
{
displayName: 'Install Type',
name: 'installType',
type: 'string',
default: '',
},
{
displayName: 'Install URL',
name: 'installUrl',
type: 'string',
default: '',
},
],
},
],
},
/* -------------------------------------------------------------------------- */
/* link:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Bitlink',
name: 'id',
type: 'string',
default: '',
placeholder: 'bit.ly/22u3ypK',
required: true,
displayOptions: {
show: {
resource: ['link'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['link'],
operation: ['update'],
},
},
options: [
{
displayName: 'Archived',
name: 'archived',
type: 'boolean',
default: false,
},
{
displayName: 'Group Name or ID',
name: 'group',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsMethod: 'getGroups',
},
},
{
displayName: 'Long URL',
name: 'longUrl',
type: 'string',
default: '',
},
{
displayName: 'Tag Names or IDs',
name: 'tags',
type: 'multiOptions',
description:
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getTags',
loadOptionsDependsOn: ['group'],
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
},
],
},
{
displayName: 'Deeplinks',
name: 'deeplink',
placeholder: 'Add Deep Link',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
displayOptions: {
show: {
resource: ['link'],
operation: ['update'],
},
},
default: {},
options: [
{
name: 'deeplinkUi',
displayName: 'Deep Link',
values: [
{
displayName: 'App ID',
name: 'appId',
type: 'string',
default: '',
},
{
displayName: 'App URI Path',
name: 'appUriPath',
type: 'string',
default: '',
},
{
displayName: 'Install Type',
name: 'installType',
type: 'string',
default: '',
},
{
displayName: 'Install URL',
name: 'installUrl',
type: 'string',
default: '',
},
],
},
],
},
/* -------------------------------------------------------------------------- */
/* link:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Bitlink',
name: 'id',
type: 'string',
default: '',
placeholder: 'bit.ly/22u3ypK',
required: true,
displayOptions: {
show: {
resource: ['link'],
operation: ['get'],
},
},
},
];
@@ -0,0 +1,35 @@
{
"type": "object",
"properties": {
"archived": {
"type": "boolean"
},
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"link": {
"type": "string"
},
"long_url": {
"type": "string"
},
"references": {
"type": "object",
"properties": {
"group": {
"type": "string"
}
}
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"version": 2
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><g fill-rule="evenodd" clip-rule="evenodd"><path fill="none" d="M0 0h128v128H0z"/><path fill="#DD5A2B" d="M63.708 0C28.443 0 0 28.306 0 65.322c0 19.193 10.266 37.736 24.703 48.877 2.78 2.145 6.091 1.949 7.989.109 1.599-1.55 1.467-5.282-1.507-7.897-11.541-10.149-19.52-25.514-19.52-40.861 0-27.564 24.474-50.756 52.044-50.756 33.558 0 51.503 27.252 51.503 50.351 0 14.114-6.902 31.155-19.361 42.025.019-.049 2.588-5.101 2.588-14.94 0-16.748-10.612-25.821-22.926-25.821-8.914 0-14.251 3.187-17.883 6.158 0-6.822.228-19.563.228-19.563 0-8.409-2.946-15.14-13.213-15.287-5.943-.084-10.353 2.641-13.103 8.803-.991 2.311-.626 4.822 1.333 5.96 1.621.941 4.287.243 5.606-1.517.881-1.1 1.375-1.335 2.141-1.252 1.261.136 1.309 2.168 1.359 3.468.038.998 1.008 15.494.477 52.746 0 10.275 8.059 22.077 27.355 22.077 8.307 0 14.686-2.322 23.953-7.587C107.871 112.398 128 94.62 128 64.55 128 26.977 97.572 0 63.708 0m6.052 113.602c-7.183.126-12.422-2.183-12.743-8.461-.12-2.356-.082-4.865.033-6.378.695-9.174 7.11-15.774 13.443-17.041 7.876-1.576 13.123 2.026 13.123 12.337-.001 6.968-1.935 19.334-13.856 19.543"/></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB