mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Add option to send message directly to phone number AWS SNS
This commit is contained in:
parent
6dd90c8764
commit
3271c8d78b
|
@ -101,6 +101,32 @@ export class AwsSns implements INodeType {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Target',
|
||||||
|
name: 'target',
|
||||||
|
type: 'options',
|
||||||
|
noDataExpression: true,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Topic',
|
||||||
|
value: 'topic',
|
||||||
|
description: 'Publish to a topic',
|
||||||
|
action: 'Publish to a topic',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Phone',
|
||||||
|
value: 'phone',
|
||||||
|
description: 'Publish to a phone number',
|
||||||
|
action: 'Publish to a phone number',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'topic',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: ['publish'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Topic',
|
displayName: 'Topic',
|
||||||
name: 'topic',
|
name: 'topic',
|
||||||
|
@ -159,9 +185,24 @@ export class AwsSns implements INodeType {
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
operation: ['publish', 'delete'],
|
operation: ['publish', 'delete'],
|
||||||
|
target: ['topic'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Number',
|
||||||
|
name: 'number',
|
||||||
|
type: 'string',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
target: ['phone'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
placeholder: '+123456789',
|
||||||
|
required: true,
|
||||||
|
description: 'The number where the message is published to',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Subject',
|
displayName: 'Subject',
|
||||||
name: 'subject',
|
name: 'subject',
|
||||||
|
@ -300,13 +341,23 @@ export class AwsSns implements INodeType {
|
||||||
const topic = this.getNodeParameter('topic', i, undefined, {
|
const topic = this.getNodeParameter('topic', i, undefined, {
|
||||||
extractValue: true,
|
extractValue: true,
|
||||||
}) as string;
|
}) as string;
|
||||||
|
const number = this.getNodeParameter('number', i, undefined, {
|
||||||
|
extractValue: true,
|
||||||
|
}) as string;
|
||||||
|
const target = this.getNodeParameter('mode', 0);
|
||||||
|
|
||||||
const params = [
|
const params = [
|
||||||
'TopicArn=' + topic,
|
|
||||||
'Subject=' + encodeURIComponent(this.getNodeParameter('subject', i) as string),
|
'Subject=' + encodeURIComponent(this.getNodeParameter('subject', i) as string),
|
||||||
'Message=' + encodeURIComponent(this.getNodeParameter('message', i) as string),
|
'Message=' + encodeURIComponent(this.getNodeParameter('message', i) as string),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (target === 'topic') {
|
||||||
|
params.push('TopicArn=' + topic)
|
||||||
|
}
|
||||||
|
if (target === 'phone') {
|
||||||
|
params.push('PhoneNumber=' + number)
|
||||||
|
}
|
||||||
|
|
||||||
const responseData = await awsApiRequestSOAP.call(
|
const responseData = await awsApiRequestSOAP.call(
|
||||||
this,
|
this,
|
||||||
'sns',
|
'sns',
|
||||||
|
|
Loading…
Reference in a new issue