Batch Save ChatGPT to Notion
This is a guide on how to save multiple ChatGPT responses to Notion in a batch.
Tools You'll Need:
* ChatGPT: An AI chatbot that can generate text.
* Notion: A note-taking and project management tool.
* Python: A programming language.
* Requests Library: A Python library for making HTTP requests.
Steps:
1. Get Your Notion API Token:
- Go to your Notion workspace settings.
- Navigate to the "Integrations" tab.
- Click "Create new integration" and choose "API Token".
- Copy your API token.
2. Install Python Libraries:
- Open your terminal or command prompt.
- Type `pip install requests` and press Enter.
3. Write Python Script:
- Create a new Python file (e.g., `save_chatgpt_to_notion.py`).
- Paste the following code into the file, replacing `YOUR_NOTION_API_TOKEN` with your actual token:
```python
import requests
def save_chatgpt_response_to_notion(response, page_id, token):
"""Saves a ChatGPT response to a Notion page."""
url = f"https://api.notion.com/v1/pages/{page_id}/children"
headers = {"Authorization": f"Bearer {token}"}
data = {
"parent": {
"page_id": page_id
},
"properties": {
"title": {
"title": [
{
"text": {
"content": "ChatGPT Response"
}
}
]
},
"content": {
"rich_text": [
{
"text": {
"content": response
}
}
]
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
Example usage
page_id = "YOUR_NOTION_PAGE_ID"
token = "YOUR_NOTION_API_TOKEN"
Get ChatGPT responses (replace with your actual ChatGPT interaction)
chatgpt_responses = [
"This is the first ChatGPT response.",
"This is the second ChatGPT response.",
"This is the third ChatGPT response."
]
Save each response to Notion
for response in chatgpt_responses:
save_chatgpt_response_to_notion(response, page_id, token)
```
4. Run the Script:
- In your terminal, navigate to the directory where you saved the Python file.
- Type `python save_chatgpt_to_notion.py` and press Enter.
5. Check Notion:
- Open your Notion workspace and go to the page specified by `page_id`.
- You should see your ChatGPT responses saved as separate blocks.
Save ChatGPT Conversations to Notion with One Click
Export your ChatGPT conversations directly to Notion with a single click.