Add docs for slack and add missing datatype (#1023)
This commit is contained in:
@@ -9,15 +9,33 @@ title: '🤖 Slack'
|
|||||||
- Make sure your slack user token includes [search](https://api.slack.com/scopes/search:read) scope.
|
- Make sure your slack user token includes [search](https://api.slack.com/scopes/search:read) scope.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
### Get Started
|
||||||
|
|
||||||
|
This will automatically retrieve data from the workspace associated with the user's token.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import os
|
||||||
|
from embedchain import Pipeline as App
|
||||||
|
|
||||||
|
os.environ["SLACK_USER_TOKEN"] = "xoxp-xxx"
|
||||||
|
app = App()
|
||||||
|
|
||||||
|
app.add("in:general", data_type="slack")
|
||||||
|
|
||||||
|
result = app.query("what are the messages in general channel?")
|
||||||
|
|
||||||
|
print(result)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Customize your SlackLoader
|
||||||
1. Setup the Slack loader by configuring the Slack Webclient.
|
1. Setup the Slack loader by configuring the Slack Webclient.
|
||||||
```Python
|
```Python
|
||||||
from embedchain.loaders.slack import SlackLoader
|
from embedchain.loaders.slack import SlackLoader
|
||||||
|
|
||||||
os.environ["SLACK_USER_TOKEN"] = "xoxp-*"
|
os.environ["SLACK_USER_TOKEN"] = "xoxp-*"
|
||||||
|
|
||||||
loader = SlackLoader()
|
|
||||||
|
|
||||||
"""
|
|
||||||
config = {
|
config = {
|
||||||
'base_url': slack_app_url,
|
'base_url': slack_app_url,
|
||||||
'headers': web_headers,
|
'headers': web_headers,
|
||||||
@@ -25,7 +43,6 @@ config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loader = SlackLoader(config)
|
loader = SlackLoader(config)
|
||||||
"""
|
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: you can also pass the `config` with `base_url`, `headers`, `team_id` to setup your SlackLoader.
|
NOTE: you can also pass the `config` with `base_url`, `headers`, `team_id` to setup your SlackLoader.
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class DataFormatter(JSONSerializable):
|
|||||||
DataType.RSSFEED: "embedchain.loaders.rss_feed.RSSFeedLoader",
|
DataType.RSSFEED: "embedchain.loaders.rss_feed.RSSFeedLoader",
|
||||||
DataType.BEEHIIV: "embedchain.loaders.beehiiv.BeehiivLoader",
|
DataType.BEEHIIV: "embedchain.loaders.beehiiv.BeehiivLoader",
|
||||||
DataType.DIRECTORY: "embedchain.loaders.directory_loader.DirectoryLoader",
|
DataType.DIRECTORY: "embedchain.loaders.directory_loader.DirectoryLoader",
|
||||||
|
DataType.SLACK: "embedchain.loaders.slack.SlackLoader",
|
||||||
}
|
}
|
||||||
|
|
||||||
if data_type == DataType.CUSTOM or loader is not None:
|
if data_type == DataType.CUSTOM or loader is not None:
|
||||||
@@ -118,6 +119,7 @@ class DataFormatter(JSONSerializable):
|
|||||||
DataType.RSSFEED: "embedchain.chunkers.rss_feed.RSSFeedChunker",
|
DataType.RSSFEED: "embedchain.chunkers.rss_feed.RSSFeedChunker",
|
||||||
DataType.BEEHIIV: "embedchain.chunkers.beehiiv.BeehiivChunker",
|
DataType.BEEHIIV: "embedchain.chunkers.beehiiv.BeehiivChunker",
|
||||||
DataType.DIRECTORY: "embedchain.chunkers.common_chunker.CommonChunker",
|
DataType.DIRECTORY: "embedchain.chunkers.common_chunker.CommonChunker",
|
||||||
|
DataType.SLACK: "embedchain.chunkers.common_chunker.CommonChunker",
|
||||||
}
|
}
|
||||||
|
|
||||||
if chunker is not None:
|
if chunker is not None:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class IndirectDataType(Enum):
|
|||||||
RSSFEED = "rss_feed"
|
RSSFEED = "rss_feed"
|
||||||
BEEHIIV = "beehiiv"
|
BEEHIIV = "beehiiv"
|
||||||
DIRECTORY = "directory"
|
DIRECTORY = "directory"
|
||||||
|
SLACK = "slack"
|
||||||
|
|
||||||
|
|
||||||
class SpecialDataType(Enum):
|
class SpecialDataType(Enum):
|
||||||
@@ -71,3 +72,4 @@ class DataType(Enum):
|
|||||||
RSSFEED = IndirectDataType.RSSFEED.value
|
RSSFEED = IndirectDataType.RSSFEED.value
|
||||||
BEEHIIV = IndirectDataType.BEEHIIV.value
|
BEEHIIV = IndirectDataType.BEEHIIV.value
|
||||||
DIRECTORY = IndirectDataType.DIRECTORY.value
|
DIRECTORY = IndirectDataType.DIRECTORY.value
|
||||||
|
SLACK = IndirectDataType.SLACK.value
|
||||||
|
|||||||
Reference in New Issue
Block a user