Files
Automata/packages/nodes-base/nodes/Mattermost/v1/actions/channel/addUser/execute.ts
Michael Kret 91d7e16c81 n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
2022-08-17 17:50:24 +02:00

24 lines
698 B
TypeScript

import { IExecuteFunctions } from 'n8n-core';
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
import { apiRequest } from '../../../transport';
export async function addUser(
this: IExecuteFunctions,
index: number,
): Promise<INodeExecutionData[]> {
const channelId = this.getNodeParameter('channelId', index) as string;
const body = {} as IDataObject;
const qs = {} as IDataObject;
const requestMethod = 'POST';
const endpoint = `channels/${channelId}/members`;
body.user_id = this.getNodeParameter('userId', index) as string;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
}