You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/create/aws/bidding-on-aws/index-bidding-on-aws.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Ready to get started? Ok, let’s dive straight in.
33
33
-[NodeJS](https://developer.redis.com/develop/node): used as an open-source, cross-platform, backend JavaScript runtime environment that executes Javascript code outside a web browser.
34
34
-[Amazon Cognito](https://aws.amazon.com/cognito/): used to securely manage and synchronize app data for users on mobile.
35
35
-[Redis Enterprise Cloud](https://developer.redis.com/create/rediscloud): used as a real-time database, cache, and message broker.
36
-
-[RedisJSON](https://developer.redis.com/howtos/redisjson/getting-started): used to store, update and fetch JSON values from Redis.
36
+
-[Redis Stack](https://developer.redis.com/quick-start): used to store, update and fetch JSON values from Redis.
37
37
-[Socket.IO](https://socket.io/): used as a library that provides real-time, bi-directional, and event-based communication between the browser and the server.
38
38
-[AWS Lambda](https://aws.amazon.com/lambda/): used as a serverless compute service that runs your code in response events and manages the underlying compute service automatically for you.
39
39
-[Amazon SNS/Amazon SES](https://aws.amazon.com/sns/): a fully managed messaging service for both application-to-application (A2A) and application-to-person (A2P) communication.
@@ -173,7 +173,7 @@ npm start
173
173
174
174
### How data is stored
175
175
176
-
The Redis Enterprise Cloud Database with RedisJSON module is what you’ll use to install the data.
176
+
The [Redis Enterprise Cloud](https://redis.com/try-free) database with Redis Stack is what you’ll use to install the data.
177
177
178
178
### Auctions
179
179
@@ -252,7 +252,7 @@ You’ll then be taken to the sign-up page. Enter your details and click ‘sign
252
252
253
253
### Placing a bid
254
254
255
-
Go to the homepage to have access to view all of the items and their auction details. All of the data here is being populated by RedisJSON and Redis Cloud. Scroll through the page and click on the item that you want to place a bid for.
255
+
Go to the homepage to have access to view all of the items and their auction details. All of the data here is being populated by Redis Stack and Redis Cloud. Scroll through the page and click on the item that you want to place a bid for.
We are using a stringified JSON to keep the message structure and simplify the implementation details for this demo-app. You may choose to use a Hash or RedisJSON
156
+
We are using a stringified JSON to keep the message structure and simplify the implementation details for this demo-app. You may choose to use a Hash or JSON
157
157
158
158
### Populate the "General" room with messages
159
159
@@ -176,7 +176,7 @@ When a WebSocket connection is established, we can start to listen for events:
176
176
A global set with online_users key is used for keeping the online state for each user. So on a new connection, a user ID is written to that set:
177
177
178
178
```bash
179
-
SADD online_users 1
179
+
SADD online_users 1
180
180
```
181
181
182
182
Here we have added user with id 1 to the set online_users
@@ -226,7 +226,7 @@ User data is stored in a hash set where each user entry contains the next values
Copy file name to clipboardExpand all lines: docs/create/aws/slackbot/index-slackbot.mdx
+37-39Lines changed: 37 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
id: index-slackbot
3
-
title: How to Build a Slack Bot to Retrieve Lost Files Using AWS S3 and RediSearch
4
-
sidebar_label: Building a Slack Bot using AWS S3 and RediSearch from scratch
3
+
title: How to Build a Slack Bot to Retrieve Lost Files Using AWS S3 and Redis Search and Query Engine
4
+
sidebar_label: Building a Slack Bot using AWS S3 and Redis Search and Query Engine
5
5
slug: /create/aws/slackbot
6
6
authors: [ajeet]
7
7
---
@@ -40,13 +40,13 @@ Ready to get started? OK, let’s dive straight in.
40
40
41
41
### Step 2. What will you need?
42
42
43
-
-[Slack:](https://slack.com/intl/en-gb/): used as an instant messaging app that connects employees with one another.
43
+
-[Slack](https://slack.com/intl/en-gb/): used as an instant messaging app that connects employees with one another.
44
44
-[Slack Block Kit](https://api.slack.com/block-kit): used as a UI framework for Slack apps that offers a balance of control and flexibility when building experiences.
45
-
-[Python:](https://www.python.org/): the preferred programming language to connect Redis in the application.
46
-
-[RediSearch](https://redis.com/modules/redis-search/): Provides querying, secondary indexing, and full-text search for Redis.
47
-
-[S3 bucket](https://aws.amazon.com/es/s3/): Used as a public cloud storage resource in Amazon Web Services (AWS).
48
-
-[AWS Textract](https://aws.amazon.com/es/textract/): Used as a machine learning service that automatically extracts text.
49
-
-[Nodejs](https://nodejs.org/en/): Responsible for image generation.
45
+
-[Python](https://www.python.org/): the preferred programming language to connect Redis in the application.
46
+
-[Redis Stack](https://redis.io/docs/stack/): includes a built-in Search and Query feature that provides querying, secondary indexing and full-text search.
47
+
-[S3 bucket](https://aws.amazon.com/es/s3/): used as a public cloud storage resource in Amazon Web Services (AWS).
48
+
-[AWS Textract](https://aws.amazon.com/es/textract/): used as a machine learning service that automatically extracts text.
49
+
-[Nodejs](https://nodejs.org/en/): responsible for image generation.
50
50
51
51
### Step 3. Architecture
52
52
@@ -57,36 +57,36 @@ Let’s look at each of the components that creates the Reeko-Slack bot:
57
57
#### 1. file_shared
58
58
59
59
- When a new file is shared in any public slack channel the file_share event is sent to the Slack Bot app.
60
-
- The file name is added as a suggestion using the <code>[FT.SUGADD](https://oss.redis.com/redisearch/Commands/)</code> command in RediSearch.
61
-
- All file data is added using the <code>[JSON.SET](https://oss.redis.com/redisjson/commands/#jsonset)</code> command.
60
+
- The file name is added as a suggestion using the [`FT.SUGADD`](https://redis.io/commands/?group=search) command in Redis.
61
+
- All file data is added using the [`JSON.SET`](https://redis.io/commands/?group=json) command.
62
62
- The file is then stored on the S3 bucket as an object with the key as the filename.
63
63
64
64
#### 2. S3-get
65
65
66
-
- The <code>[JSON.GET](https://oss.redis.com/redisjson/commands/#jsonget)</code>command checks whether the desired file exists.
66
+
- The [`JSON.GET`](https://redis.io/commands/?group=json)command checks whether the desired file exists.
67
67
- The file will then be retrieved from the S3 bucket if found.
68
68
69
69
#### 3. S3-search
70
70
71
-
- The <code>[FT.SEARCH](https://oss.redis.com/redisearch/Commands/#ftsearch)</code>command uses RediSearch to look for documents in the S3 bucket- Users are presented will be prompted with different file name suggestions based on what they’ve typed in the search bar.
71
+
- The [`FT.SEARCH`](https://redis.io/commands/?group=search)command uses the Redis Search and Query engine to look for documents in the S3 bucket- Users are presented will be prompted with different file name suggestions based on what they’ve typed in the search bar.
72
72
- Once the user chooses one of the file suggestions, it is then downloaded and sent back to Slack.
73
73
74
74
#### 4. S3-delete
75
75
76
-
- User types the file name from the<strong> command["text']</strong> parameter
77
-
- The file data is deleted from RedisJson using the <code>[JSON.DEL](https://oss.redis.com/redisjson/commands/#jsondel)</code> command and is also removed from RediSearch's suggestions using the <code>FT.SUGDEL</code> command.
76
+
- User types the file name from the<strong> command['text']</strong> parameter
77
+
- The file data is deleted from Redis using the [`JSON.DEL`](https://redis.io/commands/?group=json) command and is also removed from Redis's suggestions using the `FT.SUGDEL` command.
78
78
79
79
#### 5. Summarise-document
80
80
81
81
- The file name is identified from the <strong>command['text']</strong> parameter.
82
-
- It is then retrieved from the S3 bucket through the[JSON.GET](https://oss.redis.com/redisjson/commands/#jsonget) command.
82
+
- It is then retrieved from the S3 bucket through the[JSON.GET](https://redis.io/commands/?group=json) command.
83
83
- Users can either download the pdf or png file locally from the S3 bucket.
84
-
- The text is extracted using [AWS Textract](https://aws.amazon.com/textract/).
85
-
- The extracted text is then summarised using Hugging face transformers summarization pipeline. The text summary is also added back to the <code>JSON</code> document using[JSON.SET](https://oss.redis.com/redisjson/commands/#jsonset)<code> </code>command.
84
+
- The text is extracted using [AWS Textract](https://aws.amazon.com/textract/).
85
+
- The extracted text is then summarised using Hugging face transformers summarization pipeline. The text summary is also added back to the `JSON` document using[`JSON.SET`](https://redis.io/commands/?group=json)command.
86
86
- A post request is then sent to the /create-image on the NodeJS backend with the file name and summary text.
87
87
- An image is generated using a base template.
88
88
- The image that is returned is saved to the S3 bucket and sent back to Slack.
89
-
- The image URL is also added to the <code>JSON</code> document using <code>[JSON.SET](https://oss.redis.com/redisjson/commands/#jsonset)</code>command.
89
+
- The image URL is also added to the `JSON` document using [`JSON.SET`](https://redis.io/commands/?group=json)command.
1. Make sure you have followed the steps in [Cloning the repo t](https://github.com/redis-developer/Reeko-Slack-Bot/tree/master/python-backend#Cloning-the-repo)o start the bolt app. The HTTP server is using a built-in development adapter, which is responsible for handling and parsing incoming events from Slack on port 3000.
200
+
1. Make sure you have followed the steps in [Cloning the repo](https://github.com/redis-developer/Reeko-Slack-Bot/tree/master/python-backend#Cloning-the-repo) to start the bolt app. The HTTP server is using a built-in development adapter, which is responsible for handling and parsing incoming events from Slack on port 3000.
201
201
202
202
```
203
203
python3 app.py
204
204
```
205
205
206
206

207
207
208
-
Open a new terminal and ensure that you've installed [ngrok. Make sure to](https://github.com/redis-developer/Reeko-Slack-Bot/tree/master/python-backend#ngrok) tell ngrok to use port 3000 (which Bolt for Python uses by default):
208
+
Open a new terminal and ensure that you've installed [ngrok](https://github.com/redis-developer/Reeko-Slack-Bot/tree/master/python-backend#ngrok). Make sure to tell ngrok to use port 3000 (which Bolt for Python uses by default):
209
209
210
210
```
211
211
ngrok http 3000
@@ -216,16 +216,15 @@ ngrok http 3000
216
216
For local slack development, we'll use your ngrok URL from above, so copy it to your clipboard.
217
217
218
218
```
219
-
For example: https://your-own-url.ngrok.io (copy to clipboard)
220
-
219
+
https://your-own-url.ngrok.io
221
220
```
222
221
223
222
1. Now we’re going to subscribe to events. Your app can listen to all sorts of events that are happening around your workspace - messages being posted, files being shared and more. On your app configuration page, select the _Event Subscriptions_ sidebar. You'll be presented with an input box to enter a Request URL, which is where Slack sends the events your app is subscribed to. Hit the _save_ button.
224
223
225
-
By default Bolt for Python listens for all incoming requests at the /slack/events route, so for the Request URL you can enter your ngrok URL appended with /slack/events.
224
+
By default Bolt for Python listens for all incoming requests at the /slack/events route, so for the Request URL you can enter your ngrok URL appended with /slack/events:
If the challenge was successful, you’ll get “verified” right next to the Request URL.
@@ -245,18 +244,18 @@ Add the following scopes
245
244
246
245

247
246
248
-
1. Select the _Interactivity & Shortcuts_ sidebar and toggle the switch as on. Again, for the Request URL, enter your ngrok URL appended with /slack/events.
247
+
1. Select the _Interactivity & Shortcuts_ sidebar and toggle the switch as on. Again, for the Request URL, enter your ngrok URL appended with /slack/events:
This command involves deleting files from the S3 bucket. To achieve this you simply need to type in the file name in the search bar and Reeko will pull up the file as demonstrated below.
354
353
355
-
You’ll have the option to permanently delete the file from the S3 bucket. The file data is deleted from RedisJson using the JSON.DEL command and is removed from RediSearch's suggestions using the `FT.SUGDEL` command. You’ll be informed when the file is deleted.
354
+
You’ll have the option to permanently delete the file from the S3 bucket. The file data is deleted from Redis using the JSON.DEL command and is removed from RediSearch's suggestions using the `FT.SUGDEL` command. You’ll be informed when the file is deleted.
@@ -383,7 +382,6 @@ In this step, Reeko will extract all of the text from the documents and summariz
383
382
384
383
```
385
384
JSON.GET amazonshareholderletterpdf
386
-
387
385
```
388
386
389
387
3. Download the pdf or png file locally from S3 bucket
@@ -407,18 +405,18 @@ Below we’ve used the [Amazon 2020 shareholder letter](https://s2.q4cdn.com/299
407
405
408
406
#### 5. How it works
409
407
410
-
The Slack app is built using Bolt for Python framework. To connect the AWS S3 bucket and AWS Textract, use their respective [boto3](https://github.com/boto/boto3)clients.
408
+
The Slack app is built using Bolt for Python framework. To connect the AWS S3 bucket and AWS Textract, use their respective [boto3](https://github.com/boto/boto3)clients.
411
409
412
410
Slack is receptive to all events around your workspace such as messages being posted, files being shared, users joining the team, and more. To listen to events, Slack uses the Events API. And to enable custom interactivity, you can use the Block Kit.
413
411
414
412
Slash commands work in the following way. First they consider the text you enter after the command itself and then send it to a URL. They then accept whatever the script returns and post it as a Slackbot message to the person who issued the command. There’s a set of 4 slash commands that make the slackbot.
415
413
416
414
In the application there are two Redis Modules:
417
415
418
-
-[RedisJSON](https://oss.redislabs.com/redisjson/) - store file information like filename, summary and image url.
419
-
-[RediSearch](https://oss.redislabs.com/redisearch/) - searches for files in the S3 bucket
416
+
-[Redis JSON](https://redis.io/docs/stack/json/) - store file information like filename, summary and image url.
417
+
-[Redis Search and Query](https://redis.io/docs/stack/search/) - searches for files in the S3 bucket
420
418
421
-
The code below is used to initialize RediSearch in redisearch_connector.py. This is done by creating an index with the name `file_index.`
419
+
The code below is used to initialize Redis in redisearch_connector.py. This is done by creating an index with the name `file_index.`
422
420
423
421
```
424
422
from redisearch import Client, TextField, AutoCompleter, Suggestion
@@ -440,15 +438,15 @@ class RedisJsonConnector():
440
438
self.rj = Client(decode_responses=True)
441
439
```
442
440
443
-
And the code below is used to create an index on RediSearch
441
+
And the code below is used to create an index in Redis
444
442
445
443
```
446
444
FT.CREATE file-index ON HASH SCHEMA file_name TEXT SORTABLE file_id TEXT created TEXT timestamp TEXT mimetype TEXT filetype TEXT user_id TEXT size
447
445
```
448
446
449
447
### Conclusion: preventing lost files with Redis
450
448
451
-
The advanced capabilities of Redis allowed this Launchpad App to create an invaluable asset to remote workers - to never lose a file again on Slack. RediSearch offered a simple yet effective way of transmitting data to and from the S3 bucket with no lags, no pauses and no delays whatsoever. You can discover more about the ins and outs of how this app was made by simply [clicking here](https://launchpad.redis.com/?id=project%3AReeko-Slack-Bot).
449
+
The advanced capabilities of Redis allowed this Launchpad App to create an invaluable asset to remote workers - to never lose a file again on Slack. Redis Stack offered a simple yet effective way of transmitting data to and from the S3 bucket with no lags, no pauses and no delays whatsoever. You can discover more about the ins and outs of how this app was made by simply [clicking here](https://launchpad.redis.com/?id=project%3AReeko-Slack-Bot).
452
450
453
451
Reeko is an innovative application that joins our _exciting_ collection of apps that we currently have on the [Redis Launchpad](https://launchpad.redis.com/). By using Redis, programmers from all over the world are creating breakthrough applications that are having an impact on daily lives… _and you can too_.
454
452
@@ -467,5 +465,5 @@ To discover more about his work and his activity on GitHub, you can [check out h
467
465
### References
468
466
469
467
-[Create Redis database on AWS](/create/aws/redis-on-aws)
470
-
-[Connecting to the database using RedisInsight](/explore/redisinsight/)
471
-
-[How to list & search Movies database using Redisearch](/howtos/moviesdatabase/getting-started/)
468
+
-[Connecting to a Redis database using RedisInsight](/explore/redisinsight/)
469
+
-[How to build an IMDB clone with the Redis Search and Query engine](/howtos/moviesdatabase/getting-started/)
0 commit comments