File tree Expand file tree Collapse file tree 11 files changed +518
-4
lines changed Expand file tree Collapse file tree 11 files changed +518
-4
lines changed Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send Audio" ,
5+ description : "Send an audio file to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/audio)" ,
6+ key : "ultramsg-send-audio" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ audio : {
18+ type : "string" ,
19+ label : "Audio" ,
20+ description : "Public URL of your audio file" ,
21+ } ,
22+ } ,
23+ async run ( { $ } ) {
24+ const {
25+ to,
26+ audio,
27+ } = this ;
28+
29+ const data = {
30+ to,
31+ audio,
32+ } ;
33+ const res = await this . ultramsg . sendAudio ( data , $ ) ;
34+ $ . export ( "$summary" , `Audio successfully sent to "${ to } "` ) ;
35+
36+ return res ;
37+ } ,
38+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send a Document" ,
5+ description : "Send a document to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/document)" ,
6+ key : "ultramsg-send-document" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ document : {
18+ type : "string" ,
19+ label : "Document" ,
20+ description : "Public URL of your document" ,
21+ } ,
22+ filename : {
23+ type : "string" ,
24+ label : "Filename" ,
25+ description : "The name of your file" ,
26+ } ,
27+ } ,
28+ async run ( { $ } ) {
29+ const {
30+ to,
31+ document,
32+ filename,
33+ } = this ;
34+
35+ const data = {
36+ to,
37+ document,
38+ filename,
39+ } ;
40+ const res = await this . ultramsg . sendDocument ( data , $ ) ;
41+ $ . export ( "$summary" , `Document successfully sent to "${ to } "` ) ;
42+
43+ return res ;
44+ } ,
45+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send an Image" ,
5+ description : "Send an image to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/image)" ,
6+ key : "ultramsg-send-image" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ image : {
18+ type : "string" ,
19+ label : "Image" ,
20+ description : "Public URL of your image" ,
21+ } ,
22+ caption : {
23+ type : "string" ,
24+ label : "Caption" ,
25+ description : "Image Caption" ,
26+ optional : true ,
27+ } ,
28+ } ,
29+ async run ( { $ } ) {
30+ const {
31+ to,
32+ image,
33+ caption,
34+ } = this ;
35+
36+ const data = {
37+ to,
38+ image,
39+ caption : caption || "" ,
40+ } ;
41+ const res = await this . ultramsg . sendImage ( data , $ ) ;
42+ $ . export ( "$summary" , `Image successfully sent to "${ to } "` ) ;
43+
44+ return res ;
45+ } ,
46+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send a Link" ,
5+ description : "Send a link to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/link)" ,
6+ key : "ultramsg-send-link" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ link : {
18+ type : "string" ,
19+ label : "Link" ,
20+ description : "Link to be sent. (e.g., `https://example.com/`)" ,
21+ } ,
22+ } ,
23+ async run ( { $ } ) {
24+ const {
25+ to,
26+ link,
27+ } = this ;
28+
29+ const data = {
30+ to,
31+ link,
32+ } ;
33+ const res = await this . ultramsg . sendLink ( data , $ ) ;
34+ $ . export ( "$summary" , `Link successfully sent to "${ to } "` ) ;
35+
36+ return res ;
37+ } ,
38+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send a Location" ,
5+ description : "Send a location to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/location)" ,
6+ key : "ultramsg-send-location" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ address : {
18+ type : "string" ,
19+ label : "Address" ,
20+ description : "The address of your location. It will be used as a label" ,
21+ } ,
22+ lat : {
23+ type : "string" ,
24+ label : "Lat" ,
25+ description : "The latitude of your location. (e.g., `25.197197`)" ,
26+ } ,
27+ lng : {
28+ type : "string" ,
29+ label : "Lng" ,
30+ description : "The longitude of your location. (e.g., `55.2721877`)" ,
31+ } ,
32+ } ,
33+ async run ( { $ } ) {
34+ const {
35+ to,
36+ address,
37+ lat,
38+ lng,
39+ } = this ;
40+
41+ const data = {
42+ to,
43+ address,
44+ lat,
45+ lng,
46+ } ;
47+ const res = await this . ultramsg . sendLocation ( data , $ ) ;
48+ $ . export ( "$summary" , `Location successfully sent to "${ to } "` ) ;
49+
50+ return res ;
51+ } ,
52+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+ import options from "../../common/options.mjs" ;
3+
4+ export default {
5+ name : "Send a Message" ,
6+ description : "Send a message to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/chat)" ,
7+ key : "ultramsg-send-message" ,
8+ version : "0.0.1" ,
9+ type : "action" ,
10+ props : {
11+ ultramsg,
12+ to : {
13+ propDefinition : [
14+ ultramsg ,
15+ "to" ,
16+ ] ,
17+ } ,
18+ body : {
19+ type : "string" ,
20+ label : "Body" ,
21+ description : "Message content" ,
22+ } ,
23+ priority : {
24+ type : "integer" ,
25+ label : "priority" ,
26+ description : "Priority on internal queue of your message" ,
27+ default : 10 ,
28+ options : options . priorities ,
29+ } ,
30+ } ,
31+ async run ( { $ } ) {
32+ const {
33+ to,
34+ body,
35+ priority,
36+ } = this ;
37+
38+ const data = {
39+ to,
40+ body,
41+ priority,
42+ } ;
43+ const res = await this . ultramsg . sendMessage ( data , $ ) ;
44+ $ . export ( "$summary" , `Message successfully sent to "${ to } "` ) ;
45+
46+ return res ;
47+ } ,
48+ } ;
Original file line number Diff line number Diff line change 1+ import ultramsg from "../../ultramsg.app.mjs" ;
2+
3+ export default {
4+ name : "Send a Video" ,
5+ description : "Send a video to a specified number. [See the docs here](https://docs.ultramsg.com/api/post/messages/video)" ,
6+ key : "ultramsg-send-video" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ ultramsg,
11+ to : {
12+ propDefinition : [
13+ ultramsg ,
14+ "to" ,
15+ ] ,
16+ } ,
17+ video : {
18+ type : "string" ,
19+ label : "Video" ,
20+ description : "Public URL of your video" ,
21+ } ,
22+ } ,
23+ async run ( { $ } ) {
24+ const {
25+ to,
26+ video,
27+ } = this ;
28+
29+ const data = {
30+ to,
31+ video,
32+ } ;
33+ const res = await this . ultramsg . sendVideo ( data , $ ) ;
34+ $ . export ( "$summary" , `Video successfully sent to "${ to } "` ) ;
35+
36+ return res ;
37+ } ,
38+ } ;
Original file line number Diff line number Diff line change 1+ export default {
2+ priorities : [
3+ {
4+ label : "0: for High priority like OTP messages." ,
5+ value : 0 ,
6+ } ,
7+ {
8+ label : "5: used with general messages." ,
9+ value : 5 ,
10+ } ,
11+ {
12+ label : "10: Non-urgent promotional offers and notifications to your customers" ,
13+ value : 10 ,
14+ } ,
15+ ] ,
16+ } ;
You can’t perform that action at this time.
0 commit comments