mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
✨ Add field to reply to message - Microsoft Team (#1479)
* Add replyTo feature to Microsoft Teams * consolidate create and replyTo channel message in Microsoft Teams Node * ⚡ Improvements to #1451 Co-authored-by: Sebastian Vogel <s.vogel@sachsenkabel.de>
This commit is contained in:
parent
66f6b7dfeb
commit
61903efaed
|
@ -129,6 +129,32 @@ export const channelMessageFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The content of the item.',
|
description: 'The content of the item.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'channelMessage',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Make Reply',
|
||||||
|
name: 'makeReply',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'An optional ID of the message you want to reply to.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* channelMessage:getAll */
|
/* channelMessage:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -262,19 +262,28 @@ export class MicrosoftTeams implements INodeType {
|
||||||
}
|
}
|
||||||
if (resource === 'channelMessage') {
|
if (resource === 'channelMessage') {
|
||||||
//https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=http
|
//https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=http
|
||||||
|
//https://docs.microsoft.com/en-us/graph/api/channel-post-messagereply?view=graph-rest-beta&tabs=http
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
const teamId = this.getNodeParameter('teamId', i) as string;
|
const teamId = this.getNodeParameter('teamId', i) as string;
|
||||||
const channelId = this.getNodeParameter('channelId', i) as string;
|
const channelId = this.getNodeParameter('channelId', i) as string;
|
||||||
const messageType = this.getNodeParameter('messageType', i) as string;
|
const messageType = this.getNodeParameter('messageType', i) as string;
|
||||||
const message = this.getNodeParameter('message', i) as string;
|
const message = this.getNodeParameter('message', i) as string;
|
||||||
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
|
|
||||||
const body: IDataObject = {
|
const body: IDataObject = {
|
||||||
body: {
|
body: {
|
||||||
contentType: messageType,
|
contentType: messageType,
|
||||||
content: message,
|
content: message,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (options.makeReply) {
|
||||||
|
const replyToId = options.makeReply as string;
|
||||||
|
responseData = await microsoftApiRequest.call(this, 'POST', `/beta/teams/${teamId}/channels/${channelId}/messages/${replyToId}/replies`, body);
|
||||||
|
} else {
|
||||||
responseData = await microsoftApiRequest.call(this, 'POST', `/beta/teams/${teamId}/channels/${channelId}/messages`, body);
|
responseData = await microsoftApiRequest.call(this, 'POST', `/beta/teams/${teamId}/channels/${channelId}/messages`, body);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//https://docs.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=http
|
//https://docs.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=http
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const teamId = this.getNodeParameter('teamId', i) as string;
|
const teamId = this.getNodeParameter('teamId', i) as string;
|
||||||
|
|
Loading…
Reference in a new issue