Hi,
I have a slack webhook like below and its working fine both using REST client and curl;
curl -X POST -k -i 'https://slack.com/api/chat.postMessage?token=test_token&channel=test_channel&text=sample_text'
This request will publish message sample_text
to my channel test_channel
and can be viewed in slack app.
I tried below request from Kibana dev console;
POST _opendistro/_alerting/destinations
{
"type": "custom_webhook",
"name": "slack-destination",
"custom_webhook": {
"path": "api/chat.postMessage",
"header_params": {
"Content-Type": "application/json"
},
"scheme": "HTTPS",
"port": 443,
"query_params": {
"token": "test_token",
"channel": "test_channel",
"text": "sample_text"
},
"host": "slack.com"
}
}
when I tried this, i got 500 internal error;
{
"error" : {
"root_cause" : [
{
"type" : "alerting_exception",
"reason" : "Connection refused"
}
],
"type" : "alerting_exception",
"reason" : "Connection refused",
"caused_by" : {
"type" : "exception",
"reason" : "java.net.ConnectException: Connection refused"
}
},
"status" : 500
}
Below is the Kibana trace;
Alerting - DestinationService - createDestination: { Error: [alerting_exception] Connection refused
at respond (/kibana/node_modules/elasticsearch/src/lib/transport.js:349:15)
at checkRespForFailure (/kibana/node_modules/elasticsearch/src/lib/transport.js:306:7)
at HttpConnector.<anonymous> (/kibana/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)
at IncomingMessage.wrapper (/kibana/node_modules/lodash/lodash.js:4949:19)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
status: 500,
displayName: 'InternalServerError',
message: '[alerting_exception] Connection refused',
path: '/_opendistro/_alerting/destinations?refresh=wait_for',
query: {},
body:
{ error:
{ root_cause: [Array],
type: 'alerting_exception',
reason: 'Connection refused',
caused_by: [Object] },
status: 500 },
statusCode: 500,
response:
'{"error":{"root_cause":[{"type":"alerting_exception","reason":"Connection refused"}],"type":"alerting_exception","reason":"Connection refused","caused_by":{"type":"exception","reason":"java.net.ConnectException: Connection refused"}},"status":500}',
toString: [Function],
toJSON: [Function] }
Why is this happening? is there any relation with -k
parameter of curl? Can somebody please tell me how to fix this?
Thanks.