mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Add appendN8nAttribution option to sendAndWait operation (#13697)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { SendAndWaitMessageBody } from './MessageInterface';
|
||||
import { getSendAndWaitConfig } from '../../../utils/sendAndWait/utils';
|
||||
import { createUtmCampaignLink } from '../../../utils/utilities';
|
||||
|
||||
export async function slackApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
@@ -307,6 +308,19 @@ export function createSendAndWaitMessageBody(context: IExecuteFunctions) {
|
||||
],
|
||||
};
|
||||
|
||||
if (config.appendAttribution) {
|
||||
const instanceId = context.getInstanceId();
|
||||
const attributionText = 'This message was sent automatically with ';
|
||||
const link = createUtmCampaignLink('n8n-nodes-base.slack', instanceId);
|
||||
body.blocks.push({
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: `${attributionText} _<${link}|n8n>_`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (context.getNode().typeVersion > 2.2 && body.blocks?.[1]?.type === 'section') {
|
||||
delete body.blocks[1].text.emoji;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user