Skip to content

Commit a665404

Browse files
authored
Merge branch 'redis-developer:master' into master
2 parents 7434061 + bc3393f commit a665404

File tree

96 files changed

+628
-1170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+628
-1170
lines changed

docs/create/aws/bidding-on-aws/index-bidding-on-aws.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Ready to get started? Ok, let’s dive straight in.
3333
- [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.
3434
- [Amazon Cognito](https://aws.amazon.com/cognito/): used to securely manage and synchronize app data for users on mobile.
3535
- [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.
3737
- [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.
3838
- [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.
3939
- [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
173173

174174
### How data is stored
175175

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.
177177

178178
### Auctions
179179

@@ -252,7 +252,7 @@ You’ll then be taken to the sign-up page. Enter your details and click ‘sign
252252

253253
### Placing a bid
254254

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.
256256

257257
![placing](images/image_9.png)
258258

docs/create/aws/chatapp/index-chatapp.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The demo data initialization is handled in multiple steps:
118118

119119
We create a new user id: INCR total_users. Then we set a user ID lookup key by user name: e.g.
120120

121-
```
121+
```bash
122122
SET username:nick user:1
123123
```
124124

@@ -127,14 +127,14 @@ And finally, the rest of the data is written to the hash set:
127127
Example:
128128

129129
```bash
130-
HSET user:1 username "nick" password "bcrypt_hashed_password".
130+
HSET user:1 username "nick" password "bcrypt_hashed_password".
131131
```
132132

133133
Additionally, each user is added to the default "General" room.
134134
For handling rooms for each user, we have a set that holds the room ids. Here's an example command of how to add the room:
135135

136136
```bash
137-
SADD user:1:rooms "0"
137+
SADD user:1:rooms "0"
138138
```
139139

140140
#### Populating private messages between users
@@ -144,16 +144,16 @@ First, private rooms are created: if a private room needs to be established, for
144144
E.g. Create a private room between 2 users:
145145

146146
```bash
147-
SADD user:1:rooms 1:2 and SADD user:2:rooms 1:2
147+
SADD user:1:rooms 1:2 and SADD user:2:rooms 1:2
148148
```
149149

150150
Then we add messages for each conversation to this room by writing to a sorted set:
151151

152152
```bash
153-
ZADD room:1:2 1615480369 "{'from': 1, 'date': 1615480369, 'message': 'Hello', 'roomId': '1:2'}"
153+
ZADD room:1:2 1615480369 "{'from': 1, 'date': 1615480369, 'message': 'Hello', 'roomId': '1:2'}"
154154
```
155155

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 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
157157

158158
### Populate the "General" room with messages
159159

@@ -176,7 +176,7 @@ When a WebSocket connection is established, we can start to listen for events:
176176
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:
177177

178178
```bash
179-
SADD online_users 1
179+
SADD online_users 1
180180
```
181181

182182
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
226226
Get User HGETALL user:{id}.
227227

228228
```bash
229-
HGETALL user:2
229+
HGETALL user:2
230230
```
231231

232232
where we get data for the user with id: 2.

docs/create/aws/redis-on-aws/index-redis-on-aws.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Click "Activate" and wait for few seconds till it gets activated. Once fully act
7070
### Next Steps
7171

7272
- [Connecting to the database using RedisInsight](/explore/redisinsight/)
73-
- [How to list & search Movies database using Redisearch](/howtos/moviesdatabase/getting-started/)
73+
- [How to build an IMDB clone with the Redis Search and Query engine](/howtos/moviesdatabase/getting-started/)
7474

7575
##
7676

docs/create/aws/slackbot/index-slackbot.mdx

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
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
55
slug: /create/aws/slackbot
66
authors: [ajeet]
77
---
@@ -40,13 +40,13 @@ Ready to get started? OK, let’s dive straight in.
4040

4141
### Step 2. What will you need?
4242

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.
4444
- [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.
5050

5151
### Step 3. Architecture
5252

@@ -57,36 +57,36 @@ Let’s look at each of the components that creates the Reeko-Slack bot:
5757
#### 1. file_shared
5858

5959
- 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.
6262
- The file is then stored on the S3 bucket as an object with the key as the filename.
6363

6464
#### 2. S3-get
6565

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.
6767
- The file will then be retrieved from the S3 bucket if found.
6868

6969
#### 3. S3-search
7070

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.
7272
- Once the user chooses one of the file suggestions, it is then downloaded and sent back to Slack.
7373

7474
#### 4. S3-delete
7575

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.
7878

7979
#### 5. Summarise-document
8080

8181
- 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.
8383
- 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.
8686
- A post request is then sent to the /create-image on the NodeJS backend with the file name and summary text.
8787
- An image is generated using a base template.
8888
- 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.
9090

9191
### What is the S3 bucket?
9292

@@ -197,15 +197,15 @@ SLACK_SIGNING_SECRET=your-signing-secret
197197

198198
![alt_text](images/image8.png)
199199

200-
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.
201201

202202
```
203203
python3 app.py
204204
```
205205

206206
![alt_text](images/image6.png)
207207

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):
209209

210210
```
211211
ngrok http 3000
@@ -216,16 +216,15 @@ ngrok http 3000
216216
For local slack development, we'll use your ngrok URL from above, so copy it to your clipboard.
217217

218218
```
219-
For example: https://your-own-url.ngrok.io (copy to clipboard)
220-
219+
https://your-own-url.ngrok.io
221220
```
222221

223222
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.
224223

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:
226225

227226
```
228-
Request URL: https://your-own-url.ngrok.io/slack/events
227+
https://your-own-url.ngrok.io/slack/events
229228
```
230229

231230
If the challenge was successful, you’ll get “verified” right next to the Request URL.
@@ -245,18 +244,18 @@ Add the following scopes
245244

246245
![alt_text](images/image26.png)
247246

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:
249248

250249
```
251-
Request URL: https://your-own-url.ngrok.io/slack/events
250+
https://your-own-url.ngrok.io/slack/events
252251
```
253252

254253
![alt_text](images/image16.png)
255254

256-
1. Scroll down to the _Select Menus_ section in the Options Load URL and enter your ngork URL appended with /slack/events.
255+
1. Scroll down to the _Select Menus_ section in the Options Load URL and enter your ngork URL appended with /slack/events:
257256

258257
```
259-
Options Load URL: https://your-own-url.ngrok.io/slack/events
258+
https://your-own-url.ngrok.io/slack/events
260259
```
261260

262261
![alt_text](images/image32.png)
@@ -327,7 +326,7 @@ Install all the packages and run the server.
327326

328327
```
329328
npm install
330-
npm run start
329+
npm start
331330
```
332331

333332
![alt_text](images/image18.png)
@@ -352,7 +351,7 @@ JSON.GET amazonshareholderletterpdf
352351

353352
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.
354353

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.
356355

357356
```
358357
FT.SUGDEL file-index "amazon-shareholder-letter.pdf"
@@ -383,7 +382,6 @@ In this step, Reeko will extract all of the text from the documents and summariz
383382

384383
```
385384
JSON.GET amazonshareholderletterpdf
386-
387385
```
388386

389387
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
407405

408406
#### 5. How it works
409407

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.
411409

412410
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.
413411

414412
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.
415413

416414
In the application there are two Redis Modules:
417415

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
420418

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.`
422420

423421
```
424422
from redisearch import Client, TextField, AutoCompleter, Suggestion
@@ -440,15 +438,15 @@ class RedisJsonConnector():
440438
self.rj = Client(decode_responses=True)
441439
```
442440

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
444442

445443
```
446444
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
447445
```
448446

449447
### Conclusion: preventing lost files with Redis
450448

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).
452450

453451
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_.
454452

@@ -467,5 +465,5 @@ To discover more about his work and his activity on GitHub, you can [check out h
467465
### References
468466

469467
- [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/)

docs/create/heroku/herokujava/index-herokujava.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ Open https://hidden-woodland-03996.herokuapp.com/ to see your application
115115
### Next Steps
116116

117117
- [Connecting to the database using RedisInsight](/explore/redisinsight/)
118-
- [How to list & search Movies database using Redisearch](/howtos/moviesdatabase/getting-started/)
118+
- [How to build an IMDB clone with the Redis Search and Query engine](/howtos/moviesdatabase/getting-started/)

0 commit comments

Comments
 (0)