pull:初次提交

This commit is contained in:
Yep_Q
2025-09-08 04:48:28 +08:00
parent 5c0619656d
commit f64f498365
11751 changed files with 1953723 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import type {
IExecuteFunctions,
IHookFunctions,
IDataObject,
JsonObject,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
/**
* Make an API request to MSG91
*
*/
export async function msg91ApiRequest(
this: IHookFunctions | IExecuteFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject,
query?: IDataObject,
): Promise<any> {
const credentials = await this.getCredentials('msg91Api');
if (query === undefined) {
query = {};
}
query.authkey = credentials.authkey as string;
const options = {
method,
form: body,
qs: query,
uri: `https://api.msg91.com/api${endpoint}`,
json: true,
};
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}

View File

@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.msg91",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Communication", "Development"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/msg91/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.msg91/"
}
]
}
}

View File

@@ -0,0 +1,173 @@
import type {
IExecuteFunctions,
IDataObject,
INodeExecutionData,
INodeType,
INodeTypeDescription,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
import { msg91ApiRequest } from './GenericFunctions';
export class Msg91 implements INodeType {
description: INodeTypeDescription = {
displayName: 'MSG91',
name: 'msg91',
icon: { light: 'file:msg91.svg', dark: 'file:msg91.dark.svg' },
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Sends transactional SMS via MSG91',
defaults: {
name: 'MSG91',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'msg91Api',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'SMS',
value: 'sms',
},
],
default: 'sms',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['sms'],
},
},
options: [
{
name: 'Send',
value: 'send',
description: 'Send SMS',
action: 'Send an SMS',
},
],
default: 'send',
},
{
displayName: 'Sender ID',
name: 'from',
type: 'string',
default: '',
placeholder: '4155238886',
required: true,
displayOptions: {
show: {
operation: ['send'],
resource: ['sms'],
},
},
description: 'The number from which to send the message',
},
{
displayName: 'To',
name: 'to',
type: 'string',
default: '',
placeholder: '+14155238886',
required: true,
displayOptions: {
show: {
operation: ['send'],
resource: ['sms'],
},
},
description: 'The number, with coutry code, to which to send the message',
},
{
displayName: 'Message',
name: 'message',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['send'],
resource: ['sms'],
},
},
description: 'The message to send',
},
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: IDataObject[] = [];
let operation: string;
let resource: string;
// For Post
let body: IDataObject;
// For Query string
let qs: IDataObject;
let requestMethod: IHttpRequestMethods;
let endpoint: string;
for (let i = 0; i < items.length; i++) {
endpoint = '';
body = {};
qs = {};
resource = this.getNodeParameter('resource', i);
operation = this.getNodeParameter('operation', i);
if (resource === 'sms') {
if (operation === 'send') {
// ----------------------------------
// sms:send
// ----------------------------------
requestMethod = 'GET';
endpoint = '/sendhttp.php';
qs.route = 4;
qs.country = 0;
qs.sender = this.getNodeParameter('from', i) as string;
qs.mobiles = this.getNodeParameter('to', i) as string;
qs.message = this.getNodeParameter('message', i) as string;
} else {
throw new NodeOperationError(
this.getNode(),
`The operation "${operation}" is not known!`,
{ itemIndex: i },
);
}
} else {
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
itemIndex: i,
});
}
const responseData = await msg91ApiRequest.call(this, requestMethod, endpoint, body, qs);
returnData.push({ requestId: responseData });
}
return [this.helpers.returnJsonArray(returnData)];
}
}

View File

@@ -0,0 +1,3 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.177723 15.809L39.7076 2.01121C39.763 1.993 39.8231 1.9971 39.8755 2.02264C39.9278 2.04818 39.968 2.09313 39.9876 2.1479C39.9958 2.1716 40 2.19649 40 2.22157V37.7045C40 37.7635 39.9766 37.8201 39.9347 37.8619C39.8928 37.9038 39.8362 37.9272 39.777 37.9272H39.7477L0.21149 36.0011C0.15436 35.9982 0.100553 35.9734 0.0611918 35.9319C0.0218302 35.8904 -7.65756e-05 35.8354 2.01129e-07 35.7783V16.0264C2.71122e-05 15.9754 0.0177435 15.9259 0.0501405 15.8865C0.0825374 15.847 0.127617 15.819 0.177723 15.809ZM4.49372 19.6088C4.29808 19.5714 4.09549 19.6082 3.92559 19.7121C3.7557 19.8159 3.63074 19.9794 3.57516 20.1705C3.51959 20.3616 3.5374 20.5666 3.62512 20.7452C3.71283 20.9238 3.86413 21.0633 4.04941 21.1364L18.492 25.3081L18.8146 25.0418L33.1968 13.1897C33.2898 13.1277 33.3686 13.047 33.4285 12.9527C33.4883 12.8584 33.5276 12.7526 33.544 12.6422C33.5603 12.5317 33.5533 12.4191 33.5234 12.3116C33.4935 12.204 33.4414 12.1039 33.3704 12.0177C33.2994 11.9314 33.211 11.8611 33.1111 11.8111C33.0113 11.7611 32.902 11.7325 32.7903 11.7273C32.6787 11.7221 32.5672 11.7402 32.463 11.7807C32.3588 11.8212 32.2643 11.8829 32.1856 11.9622L18.1277 23.5507L4.49372 19.6088Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,3 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.177723 15.809L39.7076 2.01121C39.763 1.993 39.8231 1.9971 39.8755 2.02264C39.9278 2.04818 39.968 2.09313 39.9876 2.1479C39.9958 2.1716 40 2.19649 40 2.22157V37.7045C40 37.7635 39.9766 37.8201 39.9347 37.8619C39.8928 37.9038 39.8362 37.9272 39.777 37.9272H39.7477L0.21149 36.0011C0.15436 35.9982 0.100553 35.9734 0.0611918 35.9319C0.0218302 35.8904 -7.65756e-05 35.8354 2.01129e-07 35.7783V16.0264C2.71122e-05 15.9754 0.0177435 15.9259 0.0501405 15.8865C0.0825374 15.847 0.127617 15.819 0.177723 15.809ZM4.49372 19.6088C4.29808 19.5714 4.09549 19.6082 3.92559 19.7121C3.7557 19.8159 3.63074 19.9794 3.57516 20.1705C3.51959 20.3616 3.5374 20.5666 3.62512 20.7452C3.71283 20.9238 3.86413 21.0633 4.04941 21.1364L18.492 25.3081L18.8146 25.0418L33.1968 13.1897C33.2898 13.1277 33.3686 13.047 33.4285 12.9527C33.4883 12.8584 33.5276 12.7526 33.544 12.6422C33.5603 12.5317 33.5533 12.4191 33.5234 12.3116C33.4935 12.204 33.4414 12.1039 33.3704 12.0177C33.2994 11.9314 33.211 11.8611 33.1111 11.8111C33.0113 11.7611 32.902 11.7325 32.7903 11.7273C32.6787 11.7221 32.5672 11.7402 32.463 11.7807C32.3588 11.8212 32.2643 11.8829 32.1856 11.9622L18.1277 23.5507L4.49372 19.6088Z" fill="#1E75BA"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB