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:
Michael Kret
2023-10-03 11:18:59 +03:00
committed by GitHub
parent f0a66873b9
commit 8f9fe6269b
20 changed files with 345 additions and 57 deletions

View File

@@ -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 = {};