mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -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: '',
|
||||
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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
@ -262,18 +262,27 @@ export class MicrosoftTeams implements INodeType {
|
|||
}
|
||||
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-messagereply?view=graph-rest-beta&tabs=http
|
||||
if (operation === 'create') {
|
||||
const teamId = this.getNodeParameter('teamId', i) as string;
|
||||
const channelId = this.getNodeParameter('channelId', i) as string;
|
||||
const messageType = this.getNodeParameter('messageType', i) as string;
|
||||
const message = this.getNodeParameter('message', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
|
||||
const body: IDataObject = {
|
||||
body: {
|
||||
contentType: messageType,
|
||||
content: message,
|
||||
},
|
||||
};
|
||||
responseData = await microsoftApiRequest.call(this, 'POST', `/beta/teams/${teamId}/channels/${channelId}/messages`, body);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=http
|
||||
if (operation === 'getAll') {
|
||||
|
|
Loading…
Reference in a new issue