Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝Slack test : update Readme with new Oauth Configuration #3620

Merged
merged 2 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 26 additions & 1 deletion integration-tests/slack/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,32 @@ By default the Slack integration tests use WireMock to stub the API interactions

To run the `camel-quarkus-Slack` integration tests against the real API, you must first create a Slack account and workspace https://slack.com/get-started#/create.

Then configure Slack custom configurations for 'Incoming Webhooks' & the 'Slack API Tester' on your workspace.
Create a channel named `test-channel`.

You’ll need to create a Slack app and use it on your workspace.

Use the 'User OAuth Token' as token for the producer and consumer endpoints. Set the corresponding scopes for Bot Token:

* `channels:history`
* `groups:history`
* `im:history`
* `mpim:history`
* `channels:read`
* `groups:read`
* `im:read`
* `mpim:read`
* `chat:write`

Install your app for the channel `test-channel`.

Add an `Incoming Webhook` for you app.

Invite the bot in the channel `test-channel`.

[source]
----
/invite @BOT_NAME
----

Next set the following environment variables:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class SlackResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getSlackMessages() throws Exception {
Message message = consumerTemplate.receiveBody("slack://general?maxResults=1&" + getSlackAuthParams(),
Message message = consumerTemplate.receiveBody("slack://test-channel?maxResults=1&" + getSlackAuthParams(),
5000L, Message.class);
return message.getText();
}
Expand All @@ -61,7 +61,7 @@ public String getSlackMessages() throws Exception {
@POST
@Consumes(MediaType.TEXT_PLAIN)
public Response createSlackMessage(String message) throws Exception {
producerTemplate.requestBody("slack://general?" + getSlackAuthParams(), message);
producerTemplate.requestBody("slack://test-channel?" + getSlackAuthParams(), message);
return Response
.created(new URI("https://camel.apache.org/"))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url" : "/api/chat.postMessage",
"method" : "POST",
"bodyPatterns" : [ {
"equalTo" : "channel=general&text=Hello%20Camel%20Quarkus%20Slack&link_names=0&mrkdwn=1&unfurl_links=0&unfurl_media=0&reply_broadcast=0",
"equalTo" : "channel=test-channel&text=Hello%20Camel%20Quarkus%20Slack&link_names=0&mrkdwn=1&unfurl_links=0&unfurl_media=0&reply_broadcast=0",
"caseInsensitive" : false
} ]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url" : "/api/conversations.history",
"method" : "POST",
"bodyPatterns" : [ {
"equalTo" : "channel=test&limit=1&inclusive=0",
"equalTo" : "channel=test-channel&limit=1&inclusive=0",
"caseInsensitive" : false
} ]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"response" : {
"status" : 200,
"body" : "{\"ok\":true,\"channels\":[{\"id\":\"test\",\"name\":\"java-development\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904170,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"java-development\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":false,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"purpose\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"previous_names\":[],\"num_members\":1},{\"id\":\"test\",\"name\":\"random\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904169,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"random\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":false,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"Non-work banter and water cooler conversation\",\"creator\":\"test\",\"last_set\":1571904169},\"purpose\":{\"value\":\"A place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber you'd prefer to keep out of more focused work-related channels.\",\"creator\":\"test\",\"last_set\":1571904169},\"previous_names\":[],\"num_members\":1},{\"id\":\"test\",\"name\":\"general\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904169,\"is_archived\":false,\"is_general\":true,\"unlinked\":0,\"name_normalized\":\"general\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":true,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"Company-wide announcements and work-based matters\",\"creator\":\"test\",\"last_set\":1571904169},\"purpose\":{\"value\":\"This channel is for workspace-wide communication and announcements. All members are in this channel.\",\"creator\":\"test\",\"last_set\":1571904169},\"previous_names\":[],\"num_members\":2}],\"response_metadata\":{\"next_cursor\":\"\"}}",
"body" : "{\"ok\":true,\"channels\":[{\"id\":\"test\",\"name\":\"java-development\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904170,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"java-development\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":false,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"purpose\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"previous_names\":[],\"num_members\":1},{\"id\":\"test\",\"name\":\"random\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904169,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"random\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":false,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"Non-work banter and water cooler conversation\",\"creator\":\"test\",\"last_set\":1571904169},\"purpose\":{\"value\":\"A place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber you'd prefer to keep out of more focused work-related channels.\",\"creator\":\"test\",\"last_set\":1571904169},\"previous_names\":[],\"num_members\":1},{\"id\":\"test\",\"name\":\"general\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904169,\"is_archived\":false,\"is_general\":true,\"unlinked\":0,\"name_normalized\":\"general\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":true,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"Company-wide announcements and work-based matters\",\"creator\":\"test\",\"last_set\":1571904169},\"purpose\":{\"value\":\"This channel is for workspace-wide communication and announcements. All members are in this channel.\",\"creator\":\"test\",\"last_set\":1571904169},\"previous_names\":[],\"num_members\":2},{\"id\":\"test-channel\",\"name\":\"test-channel\",\"is_channel\":true,\"is_group\":false,\"is_im\":false,\"created\":1571904170,\"is_archived\":false,\"is_general\":false,\"unlinked\":0,\"name_normalized\":\"test-channel\",\"is_shared\":false,\"parent_conversation\":null,\"creator\":\"test\",\"is_ext_shared\":false,\"is_org_shared\":false,\"shared_team_ids\":[\"test\"],\"pending_shared\":[],\"pending_connected_team_ids\":[],\"is_pending_ext_shared\":false,\"is_member\":false,\"is_private\":false,\"is_mpim\":false,\"topic\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"purpose\":{\"value\":\"\",\"creator\":\"\",\"last_set\":0},\"previous_names\":[],\"num_members\":3}],\"response_metadata\":{\"next_cursor\":\"\"}}",
"headers" : {
"date" : "Wed, 10 Mar 2021 12:02:58 GMT",
"server" : "Apache",
Expand Down