File size: 2,115 Bytes
3206347 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Send message',
key: 'sendMessage',
description: 'Sends a message to a topic you specify.',
arguments: [
{
label: 'Topic',
key: 'topic',
type: 'string',
required: true,
description: 'Target topic name.',
variables: true,
},
{
label: 'Message body',
key: 'message',
type: 'string',
required: true,
description:
'Message body to be sent, set to triggered if empty or not passed.',
variables: true,
},
{
label: 'Title',
key: 'title',
type: 'string',
required: false,
description: 'Message title.',
variables: true,
},
{
label: 'Email',
key: 'email',
type: 'string',
required: false,
description: 'E-mail address for e-mail notifications.',
variables: true,
},
{
label: 'Click URL',
key: 'click',
type: 'string',
required: false,
description: 'Website opened when notification is clicked.',
variables: true,
},
{
label: 'Attach file by URL',
key: 'attach',
type: 'string',
required: false,
description: 'URL of an attachment.',
variables: true,
},
{
label: 'Filename',
key: 'filename',
type: 'string',
required: false,
description: 'File name of the attachment.',
variables: true,
},
{
label: 'Delay',
key: 'delay',
type: 'string',
required: false,
description:
'Timestamp or duration for delayed delivery. For example, 30min or 9am.',
variables: true,
},
],
async run($) {
const { topic, message, title, email, click, attach, filename, delay } =
$.step.parameters;
const payload = {
topic,
message,
title,
email,
click,
attach,
filename,
delay,
};
const response = await $.http.post('/', payload);
$.setActionItem({
raw: response.data,
});
},
});
|