This is a Personium's Engine extension for sending Slack message to specified channel.
Please see Setup Engine Extensions.
Ext_Slack.jar
by maven command mvn package -DskipTests=true
.Ext_Slack.jar
into the Engine Extension directory in Personium application server. Default directory is /personium/personium-engine/extensions/
.Sample script is below.
function(request) {
var token = "xoxb-xxxx";
var defaultChannel = "random";
var slack = new _p.extension.Slack();
slack.setConfig(token, defaultChannel);
slack.sendMessage("Hello, I am persoinum slack bot in default channel");
slack.sendMessageToUser("Hello, I am persoinum slack bot: ", "${user}");
slack.sendMessageToChannel("Hello, I am persoinum slack bot: ", "${channel}");
// with proxy
// var slack = new _p.extension.Slack();
// var proxyConf = {
// host: "your.proxy.host",
// port: "8080",
// user: "proxy.user",
// password: "proxy.password",
// };
// slack.setConfig(token, defaultChannel, proxyConf);
// slack.sendMessage("Hello, I am persoinum slack bot in random channel with proxy");
return {
status : 200,
headers : {"Content-Type":"application/json"},
body : ['Complete to send slack message!']
};
}
D:exec
privilege to using role and call Engine Execution API by the user who has this role.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.