> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.toolkits.slack toolkit

<a id="camel.toolkits.slack_toolkit" />

<a id="camel.toolkits.slack_toolkit.SlackToolkit" />

## SlackToolkit

```python theme={"system"}
class SlackToolkit(BaseToolkit):
```

A class representing a toolkit for Slack operations.

This class provides methods for Slack operations such as creating a new
channel, joining an existing channel, leaving a channel.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.__init__" />

### **init**

```python theme={"system"}
def __init__(self, timeout: Optional[float] = None):
```

Initializes a new instance of the SlackToolkit class.

**Parameters:**

* **timeout** (Optional\[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:`None`)

<a id="camel.toolkits.slack_toolkit.SlackToolkit._login_slack" />

### \_login\_slack

```python theme={"system"}
def _login_slack(
    self,
    slack_token: Optional[str] = None,
    ssl: Optional[SSLContext] = None
):
```

Authenticate using the Slack API.

**Parameters:**

* **slack\_token** (str, optional): The Slack API token. If not provided, it attempts to retrieve the token from the environment variable SLACK\_BOT\_TOKEN or SLACK\_USER\_TOKEN.
* **ssl** (SSLContext, optional): SSL context for secure connections. Defaults to `None`.

**Returns:**

WebClient: A WebClient object for interacting with Slack API.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.create_slack_channel" />

### create\_slack\_channel

```python theme={"system"}
def create_slack_channel(self, name: str, is_private: Optional[bool] = True):
```

Creates a new slack channel, either public or private.

**Parameters:**

* **name** (str): Name of the public or private channel to create.
* **is\_private** (bool, optional): Whether to create a private channel instead of a public one. Defaults to `True`.

**Returns:**

str: JSON string containing information about Slack
channel created.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.join_slack_channel" />

### join\_slack\_channel

```python theme={"system"}
def join_slack_channel(self, channel_id: str):
```

Joins an existing Slack channel. When use this function you must
call `get_slack_channel_information` function first to get the
`channel id`.

**Parameters:**

* **channel\_id** (str): The ID of the Slack channel to join.

**Returns:**

str: A string containing the API response from Slack.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.leave_slack_channel" />

### leave\_slack\_channel

```python theme={"system"}
def leave_slack_channel(self, channel_id: str):
```

Leaves an existing Slack channel. When use this function you must
call `get_slack_channel_information` function first to get the
`channel id`.

**Parameters:**

* **channel\_id** (str): The ID of the Slack channel to leave.

**Returns:**

str: A string containing the API response from Slack.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.get_slack_channel_information" />

### get\_slack\_channel\_information

```python theme={"system"}
def get_slack_channel_information(self):
```

**Returns:**

str: A JSON string representing a list of channels. Each channel
object in the list contains 'id', 'name', 'created', and
'num\_members'. Returns an error message string on failure.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.get_slack_channel_message" />

### get\_slack\_channel\_message

```python theme={"system"}
def get_slack_channel_message(self, channel_id: str):
```

Retrieve messages from a Slack channel. When use this function you
must call `get_slack_channel_information` function first to get the
`channel id`.

**Parameters:**

* **channel\_id** (str): The ID of the Slack channel to retrieve messages from.

**Returns:**

str: A JSON string representing a list of messages. Each message
object contains 'user', 'text', and 'ts' (timestamp).

<a id="camel.toolkits.slack_toolkit.SlackToolkit.send_slack_message" />

### send\_slack\_message

```python theme={"system"}
def send_slack_message(
    self,
    message: str,
    channel_id: str,
    file_path: Optional[str] = None,
    user: Optional[str] = None
):
```

Send a message to a Slack channel. When use this function you must
call `get_slack_channel_information` function first to get the
`channel id`. If use user, you must use `get_slack_user_list`
function first to get the user id.

**Parameters:**

* **message** (str): The message to send.
* **channel\_id** (str): The ID of the channel to send the message to.
* **file\_path** (Optional\[str]): The local path of a file to upload with the message.
* **user** (Optional\[str]): The ID of a user to send an ephemeral message to (visible only to that user).

**Returns:**

str: A confirmation message indicating success or an error
message.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.delete_slack_message" />

### delete\_slack\_message

```python theme={"system"}
def delete_slack_message(self, time_stamp: str, channel_id: str):
```

Delete a message from a Slack channel. When use this function you
must call `get_slack_channel_information` function first to get the
`channel id`.

**Parameters:**

* **time\_stamp** (str): The 'ts' value of the message to be deleted. You can get this from the `get_slack_channel_message` function.
* **channel\_id** (str): The ID of the channel where the message is. Use `get_slack_channel_information` to find the `channel_id`.

**Returns:**

str: A string containing the API response from Slack.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.get_slack_user_list" />

### get\_slack\_user\_list

```python theme={"system"}
def get_slack_user_list(self):
```

**Returns:**

str: A JSON string representing a list of users. Each user
object contains 'id', 'name'.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.get_slack_user_info" />

### get\_slack\_user\_info

```python theme={"system"}
def get_slack_user_info(self, user_id: str):
```

Retrieve information about a specific user in the Slack workspace.
normally, you don't need to use this method, when you need to get a
user's detailed information, use this method. Use `get_slack_user_list`
function first to get the user id.

**Parameters:**

* **user\_id** (str): The ID of the user to retrieve information about.

**Returns:**

str: A JSON string representing the user's information.

<a id="camel.toolkits.slack_toolkit.SlackToolkit.get_tools" />

### get\_tools

```python theme={"system"}
def get_tools(self):
```

**Returns:**

List\[FunctionTool]: A list of FunctionTool objects
representing the functions in the toolkit.
