List HubSpot invoices
Automatically list HubSpot invoices on app.hubspot.com. List the billing invoices on a HubSpot account, taken from Account & Billing → Transactions: each invoice's number, date, amount, status, and a link to its PDF. The PDF link is tied to the signed-in session, so it only opens while that session is still active. Sign in to HubSpot in the browser this runs against before using it — signed out, the script says so rather than returning an empty list. Pass portalId to target a specific portal when the account has more than one.
Input
portalId optionalHubSpot portal/hub id (e.g. 147691106). Omit to auto-detect from the logged-in session.
Output
count requiredinvoices requiredportalId requiredFAQ
HubSpot login (Google SSO)
Log into HubSpot (app.hubspot.com) with Google SSO: submits your email, signs in through Google, and handles the account chooser and first-time consent. HubSpot then shows a new-device email-verification step: pass the 6-digit code as `code`, or sign in once manually so HubSpot trusts the device — that confirmation is reliable only on a trusted device, so in practice this re-logs you in after one manual sign-in. `email` is required for a fresh sign-in: HubSpot's login is identifier-first, so the Google option only appears once an email is submitted, and it also selects which Google account to use.
Create or update a HubSpot contact
Create a HubSpot contact from an email address, or update the existing one's first and last name when that email is already on the account — never a duplicate. Reports created, updated or unchanged (nothing saved when the values already match), and re-reads the contact afterwards to confirm. On accounts with GDPR features on, creating needs legalBasis (the caller chooses it; it is never defaulted). dry_run fills everything in and stops before saving. Finds the right account and regional host automatically.
HubSpot whoami (signed-in account)
Report which HubSpot account this browser is signed in as: the numeric user id, email, first name and last name. Being signed out is reported as a normal answer (loggedIn false), not an error, so it can be used to check a session before running other HubSpot scripts.
