Skip to content

Commit

Permalink
replaced formating to html
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed Feb 5, 2025
1 parent 14e39c4 commit 5312139
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ describe('Test MicrosoftTeamsV2, chatMessage => sendAndWait', () => {
{
body: {
content:
'my message\n\n[Approve](http://localhost/waiting-webhook/nodeID?approved=true)\n\n_This message was sent automatically with_ [n8n](https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_instanceId)',
contentType: 'text',
'my message<br><br><a href="http://localhost/waiting-webhook/nodeID?approved=true">Approve</a><br><br><em>This message was sent automatically with <a href="https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_instanceId">n8n</a></em>',
contentType: 'html',
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@ export const description: INodeProperties[] = getSendAndWaitProperties(

export async function execute(this: IExecuteFunctions, i: number, instanceId: string) {
const chatId = this.getNodeParameter('chatId', i, '', { extractValue: true }) as string;

const config = getSendAndWaitConfig(this);

const attributionText = '_This message was sent automatically with_';
const attributionText = 'This message was sent automatically with';
const link = `https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=${encodeURIComponent(
'n8n-nodes-base.telegram',
'n8n-nodes-base.microsoftTeams',
)}${instanceId ? '_' + instanceId : ''}`;
const attribution = `${attributionText} [n8n](${link})`;
const attribution = `<em>${attributionText} <a href="${link}">n8n</a></em>`;

const buttons: string[] = config.options.map(
(option) => `[${option.label}](${`${config.url}?approved=${option.value}`})`,
const buttons = config.options.map(
(option) => `<a href="${config.url}?approved=${option.value}">${option.label}</a>`,
);

const content = `${config.message}\n\n${buttons.join(' ')}\n\n${attribution}`;
const content = `${config.message}<br><br>${buttons.join(' ')}<br><br>${attribution}`;

const body = {
body: {
contentType: 'text',
contentType: 'html',
content,
},
};
Expand Down

0 comments on commit 5312139

Please sign in to comment.