
Interacting with PocketSmith using a CustomGPT
This is a follow up article for for Leveraging LLMs in SAAS: How ChatGPT & PocketSmith Became My Personal CFO
Quick Overview
I am an avid user of Pocket Smith, but increasingly becoming lazy to open the app and check my budget, especially before buying something expensive. At the same time, I am integrating ChatGPT into my daily life more than before so I explored a way to bring PocketSmith data to ChatGPT through a CustomGPT implementation.
Chat GPT translate all my human phrased requests to relevant API calls. Also sometimes the vision comes in handy
The Set Up
Get the API key from PocketSmith
In PocketSmith, go to Profile → Security & Integrations
Head over to “Manage Developer Keys” and create a new Key, give it a name you like
Copy the API key to somewhere safe, we’ll be using this in two places
Get the user id from PocketSmith
Using the API key now we need to grab the user id, this is easier to do through PocketSmith API docs. Visit https://developers.pocketsmith.com/reference/get_me-1
Creating the Custom GPT
Create a new CustomGPT
Set the name, description and instructions as follows
Instructions text as follows (replace user id with the user id you got earlier)
You are a strict budget controller helping me to be in budget. Check if I am able to afford a particular activity/service/product against my budget. I will mention the activity/service/product with the cost. Identify a suitable category from the pocket smith budget for the given activity/service/product, then check the remaining balance for that category and evaluate if I am able to afford it. Pocketsmith user id to use <USER ID>
Scroll down and set capabilities as follows, then create a new action. I found myself asking gpt to visualise spending that’s why I am using Code Interpreter & Data Analysis.
Set the type to “API Key” and paste the API key from PocketSmith, then set a custom header called “X-Developer-Key”
Finally set the schema
The API schema is as follows
openapi: 3.1.0
info:
title: PocketSmith API
description: API for retrieving budget summaries for a user.
version: 1.0.0
servers:
- url: https://api.pocketsmith.com/v2
paths:
/users/{id}/budget_summary:
get:
summary: Retrieve budget summary for a user
description: Retrieves a budget summary for a user based on specified time period and interval.
operationId: getUserBudgetSummary
parameters:
- name: id
in: path
required: true
description: The unique identifier of the user.
schema:
type: integer
example: 431530
- name: period
in: query
required: true
description: |
The period to analyze, which can be one of `weeks`, `months`, or `years`.
Additionally, `event` is supported but requires aligned budget events to be feasible.
schema:
type: string
enum: [weeks, months, years, event]
example: months
- name: interval
in: query
required: true
description: |
The interval for the specified period. For example, an interval of `2` with
a `period` of `weeks` will analyze the budget fortnightly.
schema:
type: integer
example: 1
- name: start_date
in: query
required: true
description: |
The start date to begin analyzing the budget. This date may be adjusted to align with full periods.
schema:
type: string
format: date
example: 2024-10-01
- name: end_date
in: query
required: true
description: |
The end date to stop analyzing the budget. This date may also be adjusted to align with full periods.
schema:
type: string
format: date
example: 2024-10-31
responses:
'200':
description: Successful response with the budget summary data.
content:
application/json:
schema:
type: object
properties:
summary:
type: object
description: The budget summary details.
# Define additional response properties here as per actual response structure
'400':
description: Invalid request parameters.
'404':
description: User not found.
'500':
description: Internal server error.
If the schema is setup property, you should see available actions as follows
You are all set! Save the CustomGPT and start interacting