-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slack : fix native support for Webhook URL + add test coverage
Fixes #3541
- Loading branch information
Showing
12 changed files
with
322 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...src/main/java/org/apache/camel/quarkus/component/slack/it/model/SlackMessageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.apache.camel.quarkus.component.slack.it.model; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection | ||
public class SlackMessageResponse { | ||
String text; | ||
int nbBlocks; | ||
|
||
public SlackMessageResponse() { | ||
} | ||
|
||
public SlackMessageResponse(String text, int nbBlocks) { | ||
this.text = text; | ||
this.nbBlocks = nbBlocks; | ||
} | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public void setText(String text) { | ||
this.text = text; | ||
} | ||
|
||
public int getNbBlocks() { | ||
return nbBlocks; | ||
} | ||
|
||
public void setNbBlocks(int nbBlocks) { | ||
this.nbBlocks = nbBlocks; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
integration-tests/slack/src/test/resources/mappings/slackChatPostMessageWithBlocks.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"id" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"name" : "chatpostmessage", | ||
"request" : { | ||
"url" : "/api/chat.postMessage", | ||
"method" : "POST", | ||
"bodyPatterns" : [ { | ||
"equalTo" : "channel=test-channel&text=Hello%20Camel%20Quarkus%20Slack%20using%20Blocks&link_names=0&mrkdwn=1&blocks=%5B%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22Hello%20Camel%20Quarkus%20Slack%20using%20Blocks%22%7D%7D%2C%7B%22type%22%3A%22section%22%2C%22fields%22%3A%5B%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*Testing%20Camel%20Quarkus%20blocks*%22%7D%2C%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*You%20should%20be%20able%20to%20see%20these%20blocks%22%7D%5D%7D%2C%7B%22type%22%3A%22divider%22%7D%5D&unfurl_links=0&unfurl_media=0&reply_broadcast=0", | ||
"caseInsensitive" : false | ||
} ] | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"ok\":true,\"channel\":\"test\",\"ts\":\"1615377778.002900\",\"message\":{\"bot_id\":\"test\",\"type\":\"message\",\"text\":\"Hello Camel Quarkus Slack\",\"user\":\"test\",\"ts\":\"1615377778.002900\",\"team\":\"test\",\"bot_profile\":{\"id\":\"test\",\"deleted\":false,\"name\":\"API Test\",\"updated\":1615375056,\"app_id\":\"test\",\"icons\":{\"image_36\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_36.png\",\"image_48\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_48.png\",\"image_72\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/service_72.png\"},\"team_id\":\"test\"}}}", | ||
"headers" : { | ||
"date" : "Wed, 10 Mar 2021 12:02:58 GMT", | ||
"server" : "Apache", | ||
"x-xss-protection" : "0", | ||
"pragma" : "no-cache", | ||
"cache-control" : "private, no-cache, no-store, must-revalidate", | ||
"strict-transport-security" : "max-age=31536000; includeSubDomains; preload", | ||
"x-slack-req-id" : "f353e4e5fc6450a0ca4a32ed0ad4e203", | ||
"x-content-type-options" : "nosniff", | ||
"referrer-policy" : "no-referrer", | ||
"x-slack-backend" : "r", | ||
"x-oauth-scopes" : "incoming-webhook,chat:write,channels:read,groups:read,mpim:read,im:read,channels:history,groups:history,mpim:history,im:history", | ||
"x-accepted-oauth-scopes" : "chat:write", | ||
"expires" : "Mon, 26 Jul 1997 05:00:00 GMT", | ||
"vary" : "Accept-Encoding", | ||
"content-type" : "application/json; charset=utf-8", | ||
"x-envoy-upstream-service-time" : "61", | ||
"x-backend" : "main_normal main_canary_with_overflow main_control_with_overflow", | ||
"x-server" : "slack-www-hhvm-main-iad-au28", | ||
"x-via" : "envoy-www-iad-yrq3, haproxy-edge-lhr-ubwz", | ||
"x-slack-shared-secret-outcome" : "shared-secret", | ||
"via" : "envoy-www-iad-yrq3" | ||
} | ||
}, | ||
"uuid" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"persistent" : true, | ||
"insertionIndex" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
integration-tests/slack/src/test/resources/mappings/slackChatPostMessageWithWebhook.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"id" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"name" : "chatpostmessage", | ||
"request" : { | ||
"url" : "/services/webhook", | ||
"method" : "POST", | ||
"bodyPatterns" : [ { | ||
"equalTo" : "{\"text\":\"Hello Camel Quarkus Slack using Webhook URL\",\"channel\":\"test-channel\"}", | ||
"caseInsensitive" : false | ||
} ] | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"ok\":true,\"channel\":\"test\",\"ts\":\"1615377778.002900\",\"message\":{\"bot_id\":\"test\",\"type\":\"message\",\"text\":\"Hello Camel Quarkus Slack\",\"user\":\"test\",\"ts\":\"1615377778.002900\",\"team\":\"test\",\"bot_profile\":{\"id\":\"test\",\"deleted\":false,\"name\":\"API Test\",\"updated\":1615375056,\"app_id\":\"test\",\"icons\":{\"image_36\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_36.png\",\"image_48\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_48.png\",\"image_72\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/service_72.png\"},\"team_id\":\"test\"}}}", | ||
"headers" : { | ||
"date" : "Wed, 10 Mar 2021 12:02:58 GMT", | ||
"server" : "Apache", | ||
"x-xss-protection" : "0", | ||
"pragma" : "no-cache", | ||
"cache-control" : "private, no-cache, no-store, must-revalidate", | ||
"strict-transport-security" : "max-age=31536000; includeSubDomains; preload", | ||
"x-slack-req-id" : "f353e4e5fc6450a0ca4a32ed0ad4e203", | ||
"x-content-type-options" : "nosniff", | ||
"referrer-policy" : "no-referrer", | ||
"x-slack-backend" : "r", | ||
"x-oauth-scopes" : "incoming-webhook,chat:write,channels:read,groups:read,mpim:read,im:read,channels:history,groups:history,mpim:history,im:history", | ||
"x-accepted-oauth-scopes" : "chat:write", | ||
"expires" : "Mon, 26 Jul 1997 05:00:00 GMT", | ||
"vary" : "Accept-Encoding", | ||
"content-type" : "application/json; charset=utf-8", | ||
"x-envoy-upstream-service-time" : "61", | ||
"x-backend" : "main_normal main_canary_with_overflow main_control_with_overflow", | ||
"x-server" : "slack-www-hhvm-main-iad-au28", | ||
"x-via" : "envoy-www-iad-yrq3, haproxy-edge-lhr-ubwz", | ||
"x-slack-shared-secret-outcome" : "shared-secret", | ||
"via" : "envoy-www-iad-yrq3" | ||
} | ||
}, | ||
"uuid" : "c86380a0-2c6e-41ec-8183-467013109f96", | ||
"persistent" : true, | ||
"insertionIndex" : 2 | ||
} |
42 changes: 42 additions & 0 deletions
42
...ration-tests/slack/src/test/resources/mappings/slackGetConversationHistoryWithBlocks.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"id" : "e4c0ada4-54e1-45fa-b15a-d186df310279", | ||
"name" : "conversationshistory", | ||
"request" : { | ||
"url" : "/api/conversations.history", | ||
"method" : "POST", | ||
"bodyPatterns" : [ { | ||
"equalTo" : "channel=test-channel&limit=1&oldest=1615377778.002901&inclusive=0", | ||
"caseInsensitive" : false | ||
} ] | ||
}, | ||
"response" : { | ||
"status" : 200, | ||
"body" : "{\"ok\":true,\"messages\":[{\"bot_id\":\"test\",\"type\":\"message\",\"text\":\"Hello Camel Quarkus Slack using Blocks\",\"user\":\"test\",\"ts\":\"1615377778.002900\",\"team\":\"test\",\"bot_profile\":{\"id\":\"test\",\"deleted\":false,\"name\":\"API Test\",\"updated\":1615375056,\"app_id\":\"test\",\"icons\":{\"image_36\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_36.png\",\"image_48\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/bot_48.png\",\"image_72\":\"https:\\/\\/a.slack-edge.com\\/80588\\/img\\/plugins\\/app\\/service_72.png\"},\"team_id\":\"test\"},\"blocks\":[{\"type\":\"section\",\"block_id\":\"NqtD2\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Hello Camel Quarkus Slack using Blocks b7b238a1-23f2-4006-a608-693ca4e85e44\",\"verbatim\":false}},{\"type\":\"section\",\"block_id\":\"6+e\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Testing Camel Quarkus blocks*\",\"verbatim\":false},{\"type\":\"mrkdwn\",\"text\":\"*You should be able to see these blocks\",\"verbatim\":false}]},{\"type\":\"divider\",\"block_id\":\"jzX\"}]}],\"has_more\":true,\"pin_count\":0,\"channel_actions_ts\":null,\"channel_actions_count\":0,\"response_metadata\":{\"next_cursor\":\"bmV4dF90czoxNjE1Mzc3Njk4MDAyODAw\"}}", | ||
"headers" : { | ||
"date" : "Wed, 10 Mar 2021 12:03:00 GMT", | ||
"server" : "Apache", | ||
"x-xss-protection" : "0", | ||
"pragma" : "no-cache", | ||
"cache-control" : "private, no-cache, no-store, must-revalidate", | ||
"strict-transport-security" : "max-age=31536000; includeSubDomains; preload", | ||
"x-slack-req-id" : "259fe0f01847f6464ccf232065351a82", | ||
"x-content-type-options" : "nosniff", | ||
"referrer-policy" : "no-referrer", | ||
"x-slack-backend" : "r", | ||
"x-oauth-scopes" : "incoming-webhook,chat:write,channels:read,groups:read,mpim:read,im:read,channels:history,groups:history,mpim:history,im:history", | ||
"x-accepted-oauth-scopes" : "channels:history,groups:history,mpim:history,im:history,read", | ||
"expires" : "Mon, 26 Jul 1997 05:00:00 GMT", | ||
"vary" : "Accept-Encoding", | ||
"content-type" : "application/json; charset=utf-8", | ||
"x-envoy-upstream-service-time" : "37", | ||
"x-backend" : "main_normal main_canary_with_overflow main_control_with_overflow", | ||
"x-server" : "slack-www-hhvm-main-iad-8pvg", | ||
"x-via" : "envoy-www-iad-ntq9, haproxy-edge-lhr-ubwz", | ||
"x-slack-shared-secret-outcome" : "shared-secret", | ||
"via" : "envoy-www-iad-ntq9" | ||
} | ||
}, | ||
"uuid" : "e4c0ada4-54e1-45fa-b15a-d186df310279", | ||
"persistent" : true, | ||
"insertionIndex" : 4 | ||
} |
Oops, something went wrong.