2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2022-02-19 02:18:43 -08:00
export const incomingWebhookOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
noDataExpression : true ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Creates a message through incoming webhook (no chat bot needed)' ,
2022-07-10 13:50:51 -07:00
action : 'Create an incoming webhook' ,
2022-02-19 02:18:43 -08:00
} ,
] ,
default : 'create' ,
} ,
] ;
export const incomingWebhookFields : INodeProperties [ ] = [
/* -------------------------------------------------------------------------- */
/* incomingWebhook:create */
/* -------------------------------------------------------------------------- */
{
2022-08-17 08:50:24 -07:00
displayName :
'See <a href="https://developers.google.com/chat/how-tos/webhooks" target="_blank">Google Chat Guide</a> To Webhooks' ,
2022-02-19 02:18:43 -08:00
name : 'jsonNotice' ,
type : 'notice' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Incoming Webhook URL' ,
name : 'incomingWebhookUrl' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
default : '' ,
description : 'URL for the incoming webhook' ,
} ,
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
default : false ,
description : 'Whether to pass the message object as JSON' ,
} ,
{
displayName : 'Message' ,
name : 'messageUi' ,
type : 'collection' ,
required : true ,
placeholder : 'Add Options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
jsonParameters : [ false ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
2022-08-17 08:50:24 -07:00
default : { text : '' } ,
2022-02-19 02:18:43 -08:00
description : 'The message object' ,
options : [
{
displayName : 'Text' ,
name : 'text' ,
type : 'string' ,
default : '' ,
description : 'The message text' ,
} ,
] ,
} ,
{
2022-08-17 08:50:24 -07:00
displayName :
'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages' ,
2022-02-19 02:18:43 -08:00
name : 'jsonNotice' ,
type : 'notice' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
jsonParameters : [ true ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Message (JSON)' ,
name : 'messageJson' ,
type : 'json' ,
required : true ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
jsonParameters : [ true ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
default : '' ,
description : 'Message input as JSON Object or JSON String' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'incomingWebhook' ] ,
operation : [ 'create' ] ,
2022-02-19 02:18:43 -08:00
} ,
} ,
options : [
{
displayName : 'Thread Key' ,
name : 'threadKey' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Thread identifier which groups messages into a single thread. Has no effect if thread field, corresponding to an existing thread, is set in message. Example: spaces/AAAAMpdlehY/threads/MZ8fXhZXGkk.' ,
2022-02-19 02:18:43 -08:00
} ,
] ,
} ,
] ;