# Spinoko and tablrr Integration

[tablrr](https://tablrr.app) is a centralized platform for casino affiliates
managing multiple websites. You keep each casino's details in one dashboard,
and every connected website reads from it.

Spinoko's integration syncs **operator data** in both directions:

* **Push** — **Publish Casinos to tablrr** sends your existing Spinoko
  casinos to your tablrr account as operators, so you don't re-enter them.
* **Pull** — **Operator Sync** copies operator data from tablrr back
  onto the matching casino pages, every hour or on demand.

Both are controlled from the **tablrr** menu in your WordPress admin, which
is added by the tablrr plugin.

***

## Requirements

* **Spinoko 3.0.0 or later.** With an older Spinoko, the plugin doesn't show
  the **Operator Sync** and **Publish Casinos to tablrr** sections at all.
  A child theme of Spinoko works, since the plugin checks the parent theme.
* The **tablrr WordPress plugin**, installed, activated and connected to
  your tablrr account.
* **A tablrr plan with custom fields** (Hobby or higher). Bonuses, licenses,
  payout speed, geo links and most other casino data travel as custom fields.

***

## Setup

1. Install and activate the tablrr plugin, then connect your site. In the
   plugin's **Domain Verification** section, enter the verification code from
   your tablrr account and click **Verify Domain**. See the
   [tablrr sites guide](https://docs.tablrr.app/sites).
2. Open the **tablrr** menu in WordPress. Expand **Publish Casinos to
   tablrr** and click the button to send your casinos to tablrr (see
   [Publish Casinos to tablrr](https://docs.affkraft.com/spinoko/integrations/tablrr#publish-casinos-to-tablrr)).
3. Expand **Operator Sync**, tick **Enable operator sync** (“Sync
   operator data from tablrr to your site”) and click **Save**.

Once sync is enabled, the **Sync Schedule** and **Operator mapping**
areas appear in the same section. If you disable sync later, the hourly
schedule is removed; the saved mapping is kept.

***

## Publish Casinos to tablrr

Expand **Publish Casinos to tablrr** under the **tablrr** menu and click the
**Publish Casinos to tablrr** button. It sends every casino with the status
**Published** (drafts and other statuses are not sent).

### What is sent

| Spinoko                                     | tablrr operator field                    |
| ------------------------------------------- | ---------------------------------------- |
| Name (falls back to the post title)         | Name                                     |
| Post slug                                   | Slug                                     |
| (type)                                      | Type: always `casino`                    |
| Tagline                                     | Description                              |
| Overall Rating (0–10)                 | Rating (0–5), see below            |
| First bonus of type `welcome`: bonus text   | Bonus                                    |
| That bonus's full terms, or short terms if full is empty | Terms and conditions        |
| That bonus's terms link                     | Terms link                               |
| That bonus's affiliate URL, or the casino's Affiliate URL if empty | Affiliate link    |
| Logo (the image URL)                        | Logo                                     |
| Pros (text of each item)                    | Features                                 |
| Countries (restricted countries)            | Restricted countries                     |
| Currencies                                  | Supported currencies                     |
| Payment Methods                             | Payment methods                          |
| Game Providers                              | Software providers                       |
| Casino Games                                | Games                                    |

Rating is converted from Spinoko's 0–10 scale to tablrr's 0–5
scale by dividing by two (rounded to two decimals; values outside 0–10
are clamped first).

Countries are matched by name to a country code. A country name the plugin
can't match to a code is left out. Payment methods, game providers, games
and the categories and tags below are sent with the term's name and its
WordPress slug as the code, so the same term is found again on the way back.

### Custom fields and groups

Everything else is sent as custom fields on the operator. You don't need to
create them in tablrr first: the push includes their definitions, and tablrr
creates any that don't exist yet, organized into field groups.

| Group                         | Custom field (tablrr name)                                                    |
| ----------------------------- | ----------------------------------------------------------------------------- |
| Spinoko: Main Info            | Blacklisted, Blacklist Reason                                                 |
| Spinoko: Casino Facts         | Licenses, Established Year, Payout Speed, Min Deposit, Min Withdrawal, Customer Support, KYC Speed |
| Spinoko: Pros & Cons          | Cons                                                                          |
| Spinoko: Bonuses              | Bonuses (repeatable: Type, Bonus Text, Bonus Code, Terms (Short), Terms (Full), Terms Link, Affiliate URL) |
| Spinoko: Geo Affiliate Links  | Geo Affiliate Links (repeatable: Country, URL)                                |

Two custom relationships are created as well, **Spinoko Categories** and
**Spinoko Tags**, holding the casino's Casino Categories and Casino Tags.

The Licenses value is stored in Spinoko as one comma-separated string, and
is split into separate entries on tablrr. All bonuses are sent, not only the
welcome bonus; the welcome bonus is additionally copied to the operator's
own Bonus, Terms and Affiliate link fields.

Definitions are only created when missing. An existing custom field with
the same key is left as it is.

### Background batches and progress

The push runs in the background in batches of 20 casinos, so large sites
are fine. The status line next to the button shows
**Publishing casinos... X of Y** while it runs.

When it finishes, the line reads, for example, **Published 18 of 20 casinos
to tablrr. 1 already existed and was skipped. 1 failed.** A failed count
comes with an expandable **item(s) need attention** list showing each
casino's name and the reason.

### Skipping and auto-mapping

* **Skip by name.** tablrr matches on name and type. A casino whose name
  already exists on your tablrr account as a casino operator is skipped, and
  never duplicated or overwritten. This includes operators you deleted on
  tablrr if they are still in its trash. Names are compared as written, so
  a different spelling is treated as a different casino.
* **Auto-mapping.** Every operator the push creates is mapped to the
  casino it came from. A skipped casino is mapped to the operator that
  already exists, so the same casinos on a second website are linked too.
  You don't have to do anything in **Operator mapping** for these. Existing
  mappings are never overwritten, and operators in tablrr's trash are not
  mapped.

### Running it again

It is safe to run again whenever you add casinos. Casinos already on
tablrr are skipped, so the push **does not update** existing operators. To
change an operator that is already on tablrr, edit it on tablrr and let
sync bring it back.

***

## Sync: Spinoko pulling from tablrr

### Schedule

When **Enable operator sync** is on, the plugin checks tablrr **every hour**
using a WordPress scheduled event. The **Sync Schedule** table shows **Last
synced** (or **never**) and **Next scheduled run**. Click **Sync now** to
run it immediately; it reports **Sync completed successfully.** when done.

Each run asks tablrr for operators **changed since the last successful
sync** (24 hours back on the very first run) and applies those that are
mapped. Operators mapped since the last run, by the push or with **Save
mapping**, are pulled in full on the next run, whether or not they changed
on tablrr.

### What is synced and where it lands

| tablrr operator                 | Spinoko casino                                                      |
| ------------------------------- | ------------------------------------------------------------------- |
| Name                            | Name (**Casino Details**; the post title isn't changed)             |
| Description                     | Tagline                                                             |
| Affiliate link                  | Affiliate URL                                                       |
| Rating (0–5)              | Overall Rating (0–10), see below                              |
| Features                        | Pros                                                                |
| Cons                            | Cons                                                                |
| Licenses                        | License (entries joined with a comma)                               |
| Established Year                | Established year                                                    |
| Payout Speed                    | Payout speed                                                        |
| Min Deposit                     | Minimum deposit                                                     |
| Min Withdrawal                  | Minimum withdrawal                                                  |
| Customer Support                | Customer support                                                    |
| KYC Speed                       | KYC speed                                                           |
| Blacklisted, Blacklist Reason   | Blacklisted toggle, Blacklist reason                                |
| Bonuses                         | Bonuses (see below)                                                 |
| Geo Affiliate Links             | Geo Affiliate Links                                                 |
| Logo                            | Logo (see below)                                                    |
| Restricted countries            | Countries                                                           |
| Supported currencies            | Currencies                                                          |
| Payment methods                 | Payment Methods                                                     |
| Software providers              | Game Providers                                                      |
| Games                           | Casino Games                                                        |
| Spinoko Categories              | Casino Categories                                                   |
| Spinoko Tags                    | Casino Tags                                                         |

Fields not in the table (the post content, featured image, rating
breakdown and so on) aren't touched, and aren't pushed either.

### Rating

tablrr stores 0–5; Spinoko stores 0–10. The sync multiplies by
two and keeps the result between 0 and 10. A 4.5 on tablrr becomes 9 in
Spinoko.

### Bonuses

If the operator has any **Bonuses** custom-field entries, that list is
treated as complete and **replaces** the casino's bonuses (type, text, code,
short and full terms, terms link and affiliate URL for each entry).

If the operator has none, but it has a Bonus text, the sync creates a single
**welcome** bonus from the operator's Bonus, Terms and conditions and Terms
link. With neither, the casino's bonuses are cleared.

Geo Affiliate Links are replaced the same way, with the list from tablrr.

The Affiliate URL is written from the operator's Affiliate link, and the
push fills that link from the welcome bonus's own affiliate URL when it has
one. After a round trip, the casino's main Affiliate URL can therefore
carry the welcome bonus's link.

### Logo

The logo is downloaded into the Media Library only when the casino **has no
logo yet** and the operator's logo URL is a valid URL. If the casino already
has a logo, whether from an earlier sync or set by hand, sync leaves it
alone. To refresh it from tablrr, remove the logo on the casino first. If
the download fails, the casino simply stays without a logo; there's no
error message.

### Taxonomy terms

Currencies, Payment Methods, Game Providers, Casino Games, Casino
Categories, Casino Tags and Countries are **replaced** with the terms from
tablrr: a term that tablrr no longer lists is removed from that casino
(the term itself stays in WordPress).

For each term from tablrr:

1. It is matched to an existing term by slug (the code), then by name.
   Countries are matched by name, after translating the country code to
   Spinoko's own country name.
2. If none exists, a new term is created.

So the sync can add terms to your site that you hadn't created yet. Term
icons and logos are not synced; set them on the term as usual (see
[Data Import](https://docs.affkraft.com/spinoko/data-import)).

### Custom mapping file

The three simple fields in the table (Name, Description, Affiliate link)
can be remapped to different meta keys by placing a JSON file at
`tablrr/operator-mapping-spinoko.json` in the active (child) theme. This
affects only those three fields; everything else always lands where the
table says.

***

## Behavior and limits

* **tablrr overwrites local edits.** For a mapped casino, a sync writes
  every field in the table, including empty values. If tablrr has a blank
  tagline, the tagline on your site is cleared. Make your edits on tablrr.
  Edits to fields not in the table are untouched.
* **Sync never creates posts.** It updates casinos that already exist and
  are mapped. A new operator on tablrr doesn't create a casino on your
  site; create the casino first (or push it from WordPress), then map it.
* **Only mapped casinos sync.** An operator without a casino selected in
  **Operator mapping** is ignored.
* **URLs don't change.** The casino's slug is never changed by sync, even
  if the operator's slug on tablrr differs.
* **Deleting an operator on tablrr.** Deleted operators stop appearing in
  tablrr's responses, so nothing arrives for them. The casino on your site
  is **not** deleted or changed; it keeps the last synced data. The
  operator is removed from the mapping table the next time you click
  **Load operators**.
* **Deleting a casino on WordPress.** If the post is permanently deleted,
  the sync skips that operator. It doesn't recreate the casino, and
  the operator on tablrr is unchanged.

***

## Mapping

**Operator mapping** (inside **Operator Sync**) links each tablrr operator
to a Spinoko casino. The link is stored on your site.

### Automatic: from the push

Casinos created by **Publish Casinos to tablrr** are mapped for you.

### Manual: Load operators

For anything else, such as a casino whose name differs from its operator
on tablrr, map by hand:

1. In **Operator Sync → Operator mapping**, click **Load operators**.
   The plugin fetches every operator on your tablrr account and lists them
   with their name, type and slug.
2. Next to each operator, choose the matching casino from the dropdown. The
   dropdown lists the **published** casinos on this site by title, so create
   the casinos first.
3. Click **Save mapping**. You'll see **Mapping saved successfully.**

Once a mapping exists, the button reads **Reload operators**. Reloading
refreshes the list from tablrr and keeps your existing choices (as long as
the casino still exists), adds new operators and drops those that are gone
from tablrr.

### Example: a second website

You push your casinos from site A. Later you build site B with the same
casinos:

1. Connect site B to tablrr and enable operator sync there.
2. Click **Publish Casinos to tablrr**. Casinos already on tablrr are
   skipped and mapped to their existing operators; any new ones are sent
   and mapped.
3. Click **Sync now**. The mapped casinos are pulled in full.

Casinos are matched by name, as written. Map any that are named
differently by hand (see above). From then on, an edit on tablrr reaches
both sites on their next sync.

### Unmapping

Choose **—** for the operator in the dropdown and click **Save
mapping**. The operator stays listed but isn't synced.

***

## Troubleshooting

* **No Operator Sync or Publish section.** The sections only appear when
  the active theme is Spinoko 3.0.0 or later. **Publish Casinos to tablrr**
  appears only with Spinoko. **Sync Schedule** and **Operator mapping**
  appear only after you've enabled sync and saved.
* **“Publishing casinos... X of Y” doesn't move.** Each batch is
  queued as a WordPress scheduled event. If WordPress cron isn't running
  (for example because it's disabled on the site), batches don't run.
* **Failed items after a push.** Open the **item(s) need attention** list.
  A casino with no name is reported as **Casino has no name.** A casino
  tablrr rejects is listed with tablrr's validation message. If tablrr
  can't be reached or returns an invalid response, every casino in that
  batch is marked failed with the error. Fix the cause and run the push
  again; successfully published casinos are skipped.
* **Sync now shows an error.** The message is the error returned when the
  plugin asked tablrr for operators (a connection or authentication
  problem, or an invalid response). Last synced is not updated, so the next
  run retries from the same point.
* **Sync now says it completed, but nothing changed.** Check, in order:
  sync is enabled; the casino is selected in **Operator mapping** and saved;
  the operator was changed on tablrr after **Last synced** (newly mapped
  operators are always pulled). With nothing mapped, a run only updates
  **Last synced**.
* **Casino has no logo after sync.** Sync only sets a logo when there's none,
  and only if the logo URL is valid and can be downloaded.
