-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
35 lines (34 loc) · 1.02 KB
/
index.js
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
module.exports = (...params) => class infobip extends require('ut-port-http')(...params) {
get defaults() {
return {
namespace: 'infobip',
drainSend: 50000
};
}
handlers() {
return {
'drainSend.event.receive'(msg, $meta) {
$meta.mtid = 'notification';
$meta.method = 'notice.message.process';
return {
port: this.config.id,
method: this.config.namespace + '.exec',
length: msg.length
};
},
[`${this.config.namespace}.exec.request.send`]: (msg, $meta) => {
return {
payload: {
from: msg.from,
to: msg.to,
text: msg.body
},
json: true
};
},
receive: (msg, $meta) => {
return msg.payload;
}
};
}
};