The script reads the real messages of your account. It changes nothing. Messages carry handles and message text: the script prints ids, statuses and error codes only.
The script
list-messages.ts
Run it
Install the SDK, andtypescript and @types/node as development dependencies. Set "type": "module" in the package.json of the project, then save the script as list-messages.ts with the tsconfig.json of the overview, and set ISNAP_API_KEY in the environment. The line id is optional.
What it does
Each page is one request. It counts against the request-rate limit, and a page of
messages.list also counts against the message-operations limit: 60 requests per rolling 60 seconds for GET and POST /v1/messages together. See Rate limits. GET /v1/messages lists the filters, and Message statuses lists the statuses the script counts.
Errors it handles
An error is thrown from the loop. The messages already received stay counted, and the iterator cannot be resumed: to resume a walk, page by hand and store the cursor.
When a page request exceeds the request-rate limit or the message-operations limit, the API returns
429 rate_limit_exceeded, and the SDK waits 60 seconds and retries by itself: the loop pauses. How long a call can last explains the wait and how to shorten it.