ClickUp Toolkit
ClickUp is an all-in-one productivity platform that provides small and large teams across industries with flexible and customizable work management solutions, tools, and functions.
It is a cloud-based project management solution for businesses of all sizes featuring communication and collaboration tools to help achieve organizational goals.
%pip install -qU langchain-community
%reload_ext autoreload
%autoreload 2
from datetime import datetime
from langchain.agents import AgentType, initialize_agent
from langchain_community.agent_toolkits.clickup.toolkit import ClickupToolkit
from langchain_community.utilities.clickup import ClickupAPIWrapper
from langchain_openai import OpenAI
Initializingโ
Get Authenticatedโ
- Create a ClickUp App
- Follow these steps to get your
client_id
andclient_secret
.- Suggestion: use
https://google.com
as the redirect_uri. This is what we assume in the defaults for this toolkit.
- Suggestion: use
- Copy/paste them and run the next cell to get your
code
# Copilot Sandbox
oauth_client_id = "ABC..."
oauth_client_secret = "123..."
redirect_uri = "https://google.com"
print("Click this link, select your workspace, click `Connect Workspace`")
print(ClickupAPIWrapper.get_access_code_url(oauth_client_id, redirect_uri))
Click this link, select your workspace, click `Connect Workspace`
https://app.clickup.com/api?client_id=ABC...&redirect_uri=https://google.com
The url should change to something like this https://www.google.com/?code=THISISMYCODERIGHTHERE.
Next, copy/paste the CODE
(THISISMYCODERIGHTHERE) generated in the URL in the cell below.
code = "THISISMYCODERIGHTHERE"
Get Access Tokenโ
Then, use the code below to get your access_token
.
Important: Each code is a one time code that will expire after use. The access_token
can be used for a period of time. Make sure to copy paste the access_token
once you get it!
access_token = ClickupAPIWrapper.get_access_token(
oauth_client_id, oauth_client_secret, code
)
Error: {'err': 'Code already used', 'ECODE': 'OAUTH_014'}
You already used this code once. Go back a step and generate a new code.
Our best guess for the url to get a new code is:
https://app.clickup.com/api?client_id=B5D61F8EVO04PR0JX0U73984LLS9GI6P&redirect_uri=https://google.com
# Init toolkit
clickup_api_wrapper = ClickupAPIWrapper(access_token=access_token)
toolkit = ClickupToolkit.from_clickup_api_wrapper(clickup_api_wrapper)
print(
f"Found team_id: {clickup_api_wrapper.team_id}.\nMost request require the team id, so we store it for you in the toolkit, we assume the first team in your list is the one you want. \nNote: If you know this is the wrong ID, you can pass it at initialization."
)
Found team_id: 9011010153.
Most request require the team id, so we store it for you in the toolkit, we assume the first team in your list is the one you want.
Note: If you know this is the wrong ID, you can pass it at initialization.
Create Agentโ
llm = OpenAI(temperature=0, openai_api_key="")
agent = initialize_agent(
toolkit.get_tools(), llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True
)
Use an Agentโ
# helper function for demo
def print_and_run(command):
print("\033[94m$ COMMAND\033[0m")
print(command)
print("\n\033[94m$ AGENT\033[0m")
response = agent.run(command)
print("".join(["-"] * 80))
return response