Connect Pinterest
Tasks call Pinterest through qbash.integrations.pinterest. The connector reads the signed-in account's boards, sections, Pins, followers and analytics, and finds trending searches. It also creates and deletes boards and sections, saves and deletes Pins, and uploads videos for video Pins.
Pinterest Ads is a separate connector. See Connect Pinterest Ads.
Use a Pinterest business account
Pinterest lets new apps read Pins and boards only for the business account that signed in, and some of its analytics need a business account too. A personal account can sign in, but its Pin and board calls fail with a message about pinner data access.
To switch a personal account, open Pinterest's Settings → Account management and convert it to a business account. It's free, and the account keeps its boards and Pins.
Add the credential in qbash
- Open Connectors → Pinterest → Connect.
- Name the credential, for example after the account, and select Connect Pinterest.
- Sign in to Pinterest in the popup and select Give access.
Pinterest asks for read and write access to the account's boards and Pins, secret ones included, and read access to the account itself. The credential stays connected as long as a task or chat uses it at least every 60 days, because each refresh extends Pinterest's sign-in.
Read analytics
Select the credential under your task's Tools → Integrations, then call the connector:
end = (datetime.now(timezone.utc) - timedelta(days=1)).date()
stats = qbash.integrations.pinterest.get_account_analytics(
start_date=(end - timedelta(days=29)).isoformat(),
end_date=end.isoformat(),
metric_types=["IMPRESSION", "SAVE", "OUTBOUND_CLICK"],
)
qbash.output(stats["analytics"]["all"]["summary_metrics"])
get_pin_analytics does the same for one Pin, and get_top_pins ranks the account's Pins by impressions, saves or clicks. See the SDK Reference for every method.
Boards, Pins and videos
create_boardandcreate_board_sectionadd boards and sections. A board can be public, protected or secret.save_pinsaves an existing Pin to one of the account's boards or sections.upload_videotakes a video URL or a qbash file (.mp4, .mov or .m4v) and returns amedia_id.get_video_upload_statussays when Pinterest has finished processing it.delete_boarddeletes the board and every Pin on it, and Pinterest can't restore either.
create_pin publishes a new Pin to one of the account's boards from an image URL, two to five images or an uploaded video. Pinterest refuses it until it approves qbash's Pinterest app for standard access. update_pin is a feature Pinterest turns on for each app on request, and it refuses that call for qbash's app for now.
Pinterest asks that each Pin a task publishes is one the account owner chose to post, from content they made.
Seed test data
Make a secret board in Pinterest and add a Pin or two with your own images. Secret boards stay off your profile, and list_pins only returns their Pins with pin_type="PRIVATE". A new business account shows no analytics until its Pins get impressions.
Limits
- List methods return up to 250 items a page. Pass
next_cursorback ascursorfor the next page. - Analytics cover at most 90 days and start no more than 90 days back.
- Pinterest limits how many calls qbash's Pinterest app makes each day across all accounts. A call over the limit fails with a rate limit error until the limit resets.