On this page
Who can do this: a super admin, with access to the production host for the credential and the import. Prerequisite: the release that carries migrations 0261 and 0262 is deployed (ADR 0061).
The SocialTrend vendor account holds one session, so exactly one system may call the vendor at any time. MSO Cloud syncs once; every organization that holds the Social trend feed feature reads the same rows.
Before you start#
- The vendor account is set in the super-admin console: on Shared trends, press Set account, enter the email and password, and save. The password is encrypted when stored and never shown again; the page shows the masked email and who changed it last. Test connection makes one login and one list call and answers ok or a short reason; Remove account stops syncing until a new account is set. The worker reads the account at the start of every run, so a change applies at the next run without a restart.
- The environment pair
SOCIALTREND_EMAILandSOCIALTREND_PASSWORDis only a fallback, used when no account is stored. The page then reads "From the environment". Set the account on exactly one stack, and never echo it or write it to a log. - No stored account and no environment pair means "not configured": the hourly check does nothing and writes no run row, Run now is disabled with the hint "Configure the source account before running", and search answers not-available.
- The page Shared trends shows "Not configured" under Source account when neither a stored account nor the environment pair exists. Both runtimes read the same stored account; only the fallback pair is per environment.
Steps#
Enable the feed for an organization
- Open the organization in the super-admin console, then Feature packs, and switch on Social trend feed. It is off by default and has no dependency; the in-app Social trends page also needs Social Intelligence.
- Assign topics: on Shared trends, under Organizations using this source, pick Extra topics for the organization and Save. Empty means the general ranking only.
- For an app such as ContentHeat, link the app's organization to its MSO organization first. An organization that is not linked has no feed.
Read the Shared trends page
- Source account (configured, from the environment, or not configured), Last check, Last full fetch, Dataset revision and the counts per review state sit at the top.
- Recent runs lists the last 20 runs: kind (check, manual, scheduled, overdue), result (running, done, partial, empty, failed, unchanged), calls, trends seen and written, and an error code.
- Error codes:
AUTH_FAILED,PLAN_LIMITandNOT_CONFIGUREDare permanent; fix the account.VENDOR_UNAVAILABLE,RATE_FLOORandCALL_CEILINGare transient and the next hourly check retries. A run whose heartbeat is older than 600 s is closed as overdue by the next one.
Run a sync
- On Shared trends, press Set account, enter the vendor email and password, press Test connection, then save. Press Run now and confirm. It forces a full fetch and shares the vendor call budget (300 calls per 60 s for the account).
- The first full sync took 49 minutes (09:40 to 10:29) and 895 vendor calls for 445 trends, all enriched. A later check with an unchanged fingerprint is one cheap run marked unchanged. A stored account that cannot be decrypted counts as absent: the page then shows the environment pair or "Not configured"; set the account again. The vendor's ranking moves every hour, so a moved ranking is fetched in full at most once per
full_sync_min_interval_hours(default 12, a key of the state row's settings); a check inside that interval is also marked unchanged, and Run now fetches at once. - "A run is already in progress" or "already queued" means single flight held; wait and reload. A partial or failed run deletes nothing from the snapshot.
Review held rows
- Under Trends to review, filter by State: awaiting review, approved, rejected.
- After the first sync one of 445 trends was held (444 usable). Approve shows a held trend in every organization, the API and the assistant. Reject hides it for all of them even if the vendor sends it again; Undo returns it to review. Each decision raises the dataset revision.
Read a partial pull in the app
When the satellite's pull ends partial, its error_detail names the cause (since its Release 271). Read that first, then Recent runs here to see whether MSO had a sync, grant or contract problem at that time.
Cutover#
- Deploy with no account set (nothing stored, the fallback pair unset). Tables exist, routes answer, nothing syncs.
- Switch ContentHeat's vendor connector off in its AdminCP and wait until none of its runs is running. From here nobody calls the vendor.
- Export from ContentHeat's database, one file per table:
psql -Atc "copy (select row_to_json(t) from trend_cache_items t where connector='socialtrend') to stdout" > trend_cache_items.ndjson, and the same fortrend_historyandtrend_review_decisions.--print-export-sqlprints all three. - A second import after the source has synced again must replace, not add. The script only adds: history skips existing keys and an item keeps the newer
last_seen_at, so rows the source dropped in the meantime stay behind (the first cutover found 2 stale items and 779 stale history rows). Before importing again, delete the connector's rows in one transaction:delete from shared_trend_history where connector='socialtrend'; delete from shared_trend_items where connector='socialtrend';, then import. Keepshared_trend_review_decisions: decisions are the operator's and the import merges them. - Dry run, then apply, with
DATABASE_URLset explicitly to the owner or worker role (the script reads no.env):tsx scripts/maintenance/import-shared-trends.ts --dir <path>prints the source counts and date ranges and writes nothing; add--applyto import. - Reading the result: per table it compares row counts, date ranges and a digest of the keyed content. Any missing key or digest mismatch rolls the whole transaction back and exits 1. A match raises
platform_connector_state.revisionby 1. The import is idempotent: history skips existing keys, an item keeps the row with the newerlast_seen_at. On the production database, check counts read-only withdocker exec msocloud-postgres-prod psql -U yng -d yng_mso -c "<SELECT>". - Enable Social trend feed and copy the topic assignments for every organization that reads trends today. The script touches no plugin rows.
- Deploy ContentHeat; it pulls from MSO and finds the imported snapshot. Confirm its old workers are gone.
- Set the account on Shared trends (Set account, then Test connection) and press Run now. Compare the fresh snapshot with the imported one: ids in common and figures of the same ranking date.
- Run the journeys of both products and of the other live organizations.
Rollback#
- Remove the account on Shared trends (and unset the fallback pair if the environment sets one), then wait until no run is running.
- Retag ContentHeat's previous image and switch its connector back on; its vendor credential and sync rows are untouched by this change.
- Switch off Social trend feed for the organizations. The new tables are additive and can stay.
If it fails#
| Symptom | Check |
|---|---|
| Run now is disabled | No account is stored and the fallback pair is unset; press Set account on Shared trends |
| No run rows after an hour | No account is stored and the fallback pair is unset for the worker, or the worker is down |
Run ends AUTH_ |
Another system logged in with the same account, or the password changed; use Test connection after fixing it |
| An organization sees "being updated" | No full fetch has finished yet; read Recent runs |
An app gets 403 feed_ |
The feature is off for that organization |
An app gets 403 slice_ |
Assign the topic under Extra topics |