Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Being a heavy Slack user, I have for some time thought about the possibility to integrate Slack and Sense.
Turns out it isn't hard at all..
Oh, never heard of Slack? Check it out - it's a really good instant messaging/group communication tool.
Being able to post Slack messages from the Sense load script opens up all sorts of possibilities, for example
Full writeup here.
Should be noted that the approach described in the post above may introduce security risks in a Sense server setting - so do read the Sense help pages for the "execute" command before deploying this in a production setting.
I'll post an alternative solution in the next few days too, where security can be kept on default (=higher) levels.
Which one should be used depends on your use case - if you are running Sense desktop you can probably use the approach described above. In a setup with sensitive data you might want to go with the proxy based setup described in the coming post (need a few days to wrap it up..).
Adding to the previous post, at the link below is a write-up on how to use Node.js to create a small proxy service, which via a REST API makes it possible to post Slack messages without lowering the security settings of Sense.
Please feel free to extend the (very basic) Node proxy code - I am sure there are lots of good things that can be added there. Github pull requests always welcome!
/Göran
Update:
Added another endpoint to the proxy, for creating directories on the server where the proxy app is running.
The rationale for this is that you probably don't want to lower Sense's security settings, but those settings prevent you from (among other things) creating directories on disk.
Another option is then to have a small proxy app do this for you..
The proxy app now has two endpoints:
/slack for posting to Slack
/createDir for creating directories on disk
It is pretty easy to add additional endpoints, if/when needed.
Everything available at the GitHub repository.
I managed to do this without proxies or windows executables, by calling the REST connector and disabling error temporarily because QLIK has issues parsing the response from SLACK (which makes sense since it is not valid json or CSV)
Create a sub for posting:
sub notifySlack(labeltext)
//insert connect statement for REST connector just created below
LIB CONNECT TO 'slack (qlikcloud_qlikid_xxxx_xxxx)';
set ErrorMode=0;
let user = osuser();
let doc = DocumentTitle();
RestConnectorMasterTable:
Select
"test"
from CSV "CSV_Source"
With Connection(
BODY "{'text':'*[$(doc)]* $(labeltext)\n{$(user)','mrkdwn':'true'}"
);
set ErrorMode=1;
end sub;
Call the function:
call notifySlack('Start Loading data');
I call the function at the beginning and the end of the data-load. Hope to improve this so it can run without disabling the errors, ideas anyone?