mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(core): Add "Sent by n8n" attribution (#7183)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
This commit is contained in:
@@ -129,9 +129,12 @@ export async function slackApiRequestAllItems(
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function getMessageContent(this: IExecuteFunctions | ILoadOptionsFunctions, i: number) {
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
|
||||
export function getMessageContent(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
i: number,
|
||||
nodeVersion: number,
|
||||
instanceId?: string,
|
||||
) {
|
||||
const includeLinkToWorkflow = this.getNodeParameter(
|
||||
'otherOptions.includeLinkToWorkflow',
|
||||
i,
|
||||
@@ -139,7 +142,9 @@ export function getMessageContent(this: IExecuteFunctions | ILoadOptionsFunction
|
||||
) as IDataObject;
|
||||
|
||||
const { id } = this.getWorkflow();
|
||||
const automatedMessage = `_Automated with this <${this.getInstanceBaseUrl()}workflow/${id}?utm_source=n8n&utm_medium=slackNode|n8n workflow>_`;
|
||||
const automatedMessage = `_Automated with this <${this.getInstanceBaseUrl()}workflow/${id}?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=${encodeURIComponent(
|
||||
'n8n-nodes-base.slack',
|
||||
)}${instanceId ? '_' + instanceId : ''}|n8n workflow>_`;
|
||||
const messageType = this.getNodeParameter('messageType', i) as string;
|
||||
|
||||
let content: IDataObject = {};
|
||||
|
||||
@@ -558,7 +558,7 @@ export const messageFields: INodeProperties[] = [
|
||||
placeholder: 'Add options',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Include Link To Workflow',
|
||||
displayName: 'Include Link to Workflow',
|
||||
name: 'includeLinkToWorkflow',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
|
||||
@@ -322,6 +322,9 @@ export class SlackV2 implements INodeType {
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
const instanceId = await this.getInstanceId();
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
responseData = {
|
||||
@@ -768,7 +771,7 @@ export class SlackV2 implements INodeType {
|
||||
target = target.slice(0, 1) === '@' ? target : `@${target}`;
|
||||
}
|
||||
const { sendAsUser } = this.getNodeParameter('otherOptions', i) as IDataObject;
|
||||
const content = getMessageContent.call(this, i);
|
||||
const content = getMessageContent.call(this, i, nodeVersion, instanceId);
|
||||
|
||||
const body: IDataObject = {
|
||||
channel: target,
|
||||
|
||||
Reference in New Issue
Block a user