Showing
1 changed file
with
21 additions
and
25 deletions
... | @@ -58,30 +58,26 @@ function Multicast(sendMsg){ | ... | @@ -58,30 +58,26 @@ function Multicast(sendMsg){ |
58 | }); | 58 | }); |
59 | } | 59 | } |
60 | 60 | ||
61 | - | 61 | +function Broadcast(msg){ |
62 | -exports.SendMessage = function(sendMessage){ | 62 | + request.post( |
63 | - Multicast(sendMessage); | 63 | + { |
64 | + url: BROAD_TARGET_URL, | ||
65 | + headers: { | ||
66 | + 'Authorization': `Bearer ${TOKEN}` | ||
67 | + }, | ||
68 | + json: { | ||
69 | + "messages":[ | ||
70 | + { | ||
71 | + "type":"text", | ||
72 | + "text":msg | ||
73 | + } | ||
74 | + ] | ||
75 | + } | ||
76 | + },(error, response, body) => { | ||
77 | + console.log(body) | ||
78 | + }); | ||
64 | } | 79 | } |
65 | 80 | ||
66 | -// // Broadcast | ||
67 | -// request.post( | ||
68 | -// { | ||
69 | -// url: BROAD_TARGET_URL, | ||
70 | -// headers: { | ||
71 | -// 'Authorization': `Bearer ${TOKEN}` | ||
72 | -// }, | ||
73 | -// json: { | ||
74 | -// "messages":[ | ||
75 | -// { | ||
76 | -// "type":"text", | ||
77 | -// "text":"This is broadcast message." | ||
78 | -// }, | ||
79 | -// { | ||
80 | -// "type":"text", | ||
81 | -// "text":"May I help you?" | ||
82 | -// } | ||
83 | -// ] | ||
84 | -// } | ||
85 | -// },(error, response, body) => { | ||
86 | -// console.log(body) | ||
87 | -// }); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
81 | +exports.SendMessage = function(sendMessage){ | ||
82 | + Broadcast(sendMessage); | ||
83 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment