mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Merge 439fb29fa6
into d2dd1796a8
This commit is contained in:
commit
e70b11219f
|
@ -80,6 +80,7 @@ export function addAdditionalFields(
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', index);
|
const additionalFields = this.getNodeParameter('additionalFields', index);
|
||||||
|
|
||||||
if (operation === 'sendMessage') {
|
if (operation === 'sendMessage') {
|
||||||
|
// [ria] && SEND_AND_WAIT ?
|
||||||
const attributionText = 'This message was sent automatically with ';
|
const attributionText = 'This message was sent automatically with ';
|
||||||
const link = createUtmCampaignLink('n8n-nodes-base.telegram', instanceId);
|
const link = createUtmCampaignLink('n8n-nodes-base.telegram', instanceId);
|
||||||
|
|
||||||
|
@ -260,14 +261,17 @@ export function createSendAndWaitMessageBody(context: IExecuteFunctions) {
|
||||||
const config = getSendAndWaitConfig(context);
|
const config = getSendAndWaitConfig(context);
|
||||||
let text = config.message;
|
let text = config.message;
|
||||||
|
|
||||||
const instanceId = context.getInstanceId();
|
if (config.appendAttribution) {
|
||||||
const attributionText = 'This message was sent automatically with ';
|
const instanceId = context.getInstanceId();
|
||||||
const link = createUtmCampaignLink('n8n-nodes-base.telegram', instanceId);
|
const attributionText = 'This message was sent automatically with ';
|
||||||
text = `${text}\n\n_${attributionText}_[n8n](${link})`;
|
const link = createUtmCampaignLink('n8n-nodes-base.telegram', instanceId);
|
||||||
|
text = `${text}\n\n_${attributionText}_[n8n](${link})`;
|
||||||
|
}
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
chat_id,
|
chat_id,
|
||||||
text,
|
text,
|
||||||
|
|
||||||
disable_web_page_preview: true,
|
disable_web_page_preview: true,
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
reply_markup: {
|
reply_markup: {
|
||||||
|
|
|
@ -29,6 +29,7 @@ export type SendAndWaitConfig = {
|
||||||
message: string;
|
message: string;
|
||||||
url: string;
|
url: string;
|
||||||
options: Array<{ label: string; value: string; style: string }>;
|
options: Array<{ label: string; value: string; style: string }>;
|
||||||
|
appendAttribution?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type FormResponseTypeOptions = {
|
type FormResponseTypeOptions = {
|
||||||
|
@ -231,7 +232,17 @@ export function getSendAndWaitProperties(
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add option',
|
placeholder: 'Add option',
|
||||||
default: {},
|
default: {},
|
||||||
options: [limitWaitTimeOption],
|
options: [
|
||||||
|
limitWaitTimeOption,
|
||||||
|
{
|
||||||
|
displayName: 'Append n8n Attribution',
|
||||||
|
name: 'appendAttribution',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
description:
|
||||||
|
'Whether to include the phrase "This message was sent automatically with n8n" to the end of the message',
|
||||||
|
},
|
||||||
|
],
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
responseType: ['approval'],
|
responseType: ['approval'],
|
||||||
|
@ -272,6 +283,14 @@ export function getSendAndWaitProperties(
|
||||||
default: 'Submit',
|
default: 'Submit',
|
||||||
},
|
},
|
||||||
limitWaitTimeOption,
|
limitWaitTimeOption,
|
||||||
|
{
|
||||||
|
displayName: 'Append n8n Attribution',
|
||||||
|
name: 'appendAttribution',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
description:
|
||||||
|
'Whether to include the phrase "This message was sent automatically with n8n" to the end of the message',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
|
@ -448,11 +467,18 @@ export function getSendAndWaitConfig(context: IExecuteFunctions): SendAndWaitCon
|
||||||
buttonDisapprovalStyle?: string;
|
buttonDisapprovalStyle?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const appendAttribution = context.getNodeParameter(
|
||||||
|
'options.appendAttribution',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
) as boolean;
|
||||||
|
|
||||||
const config: SendAndWaitConfig = {
|
const config: SendAndWaitConfig = {
|
||||||
title: subject,
|
title: subject,
|
||||||
message,
|
message,
|
||||||
url: `${resumeUrl}/${nodeId}`,
|
url: `${resumeUrl}/${nodeId}`,
|
||||||
options: [],
|
options: [],
|
||||||
|
appendAttribution,
|
||||||
};
|
};
|
||||||
|
|
||||||
const responseType = context.getNodeParameter('responseType', 0, 'approval') as string;
|
const responseType = context.getNodeParameter('responseType', 0, 'approval') as string;
|
||||||
|
|
Loading…
Reference in a new issue