# How to Set Up the EGYM Integration

HTML version: [How to Set Up the EGYM Integration](https://support.gladstonesoftware.cloud/api-integrations/how-to-set-up-the-egym-integration)

## Problem
You want your members to be created and kept up to date in EGYM, with one EGYM API key per site and a date of your choosing for the first sync, so that members can use EGYM at the sites you select.

## Resolution

1. **Check that EGYM is available to you**
   - In Operator, go to `Configuration > Integrations`. If there is an **EGYM** tile alongside Endurance Zone and SSO, continue to step 2.
   - If there is no EGYM tile, EGYM synchronisation has not been enabled for your environment. It is a paid add-on, switched on by Gladstone per environment, and is hidden until then. Contact Gladstone to arrange it.
   - Once Gladstone has enabled it, sign out of Operator and sign back in. The EGYM tile does not appear in a session that started before the add-on was enabled.

2. **Gather what you need**
   - An EGYM API key for each site you want to sync, issued by EGYM.
   - The membership type groups whose members should be sent to EGYM. These are the same groups you already use to group membership types; create any new ones before you start.

3. **Open the EGYM page**
   - Go to `Configuration > Integrations > EGYM`. The **EGYM Integration** page has three sections: **Enable Sites**, **Enable Membership Groups** and **Sync Errors**.
   - There is no **Save** button on this page. Each change you confirm in a dialog is saved straight away.

4. **Enable membership groups**
   - In **Enable Membership Groups**, select **Add Groups**.
   - In the **Membership Groups** dialog, search for and tick each group whose members should sync, then select **Add Groups**.
   - Do this before the first site's initial sync date. Only members with an active membership in one of these groups are sent to EGYM, and the groups apply to every EGYM site, so a site has nothing to sync until at least one group is enabled.

5. **Choose the sites**
   - In **Enable Sites**, select **Add Sites**.
   - In the **Sites** dialog, tick each site to sync. Use the search box, or **Filter** by **Site Groups**, to narrow the list. Sites already enabled for EGYM are not listed.
   - Select **Next**.

6. **Enter each site's API key and initial sync date**
   - For each site, enter its **API Key** from EGYM and pick an **Initial Sync Date**. The earliest date you can pick is tomorrow.
   - **Add Sites** stays unavailable until every site has both an API key and a date. Select **Back** to change your site selection without losing what you have entered.
   - Select **Add Sites**. All the sites are added together: if any one of them is rejected, none are added and the message explains why.

7. **Confirm the sites were added**
   - Each site now appears in **Enable Sites** with its **Site Name**, **API Key** and **Initial Sync Date**. The API key shows only its last four characters, for example `****4821`. The full key is never shown again.
   - **Sync Errors** now shows "All members synced correctly", even though the initial sync date has not yet arrived. That message means only that there are no outstanding errors.

## Notes

- **What the initial sync does.** From midnight, in your organisation's time zone, at the start of the initial sync date, every member who then holds an active membership at that site in an enabled group is sent to EGYM. It is not a "changes since" date. Historical attendance is not sent.
- **After the initial sync.** Once a site's initial sync has finished, new members and changes to existing members at that site are sent to EGYM as they happen. Nothing is sent for a site before its initial sync date.
- **Members at more than one EGYM site.** A member has one EGYM account across your organisation. A member who qualifies at two EGYM sites is created at whichever site syncs them first.
- **EGYM API URL setting.** Adding a site fails with the message "An EGYM base URL is required for site … and no Integration_EGymApiUrl fallback is configured." if the **EGYM API URL** setting is empty. It is in the **Integration** group at `Configuration > Modules > Configure > Integration`.
- **Ongoing sync settings.** The **Third-Party Notifications** settings in the same **Integration** group control whether member changes are sent on to third parties such as EGYM. They appear only once EGYM is enabled for your environment.
- **Changing a site's API key.** A configured site's API key cannot be edited on this page.
- **If the add-on is switched off.** The EGYM page and its settings are hidden again, but this alone does not stop members syncing. Ask Gladstone to confirm syncing is stopped as part of switching it off.
- Who can open the EGYM page depends on staff permissions in Operator.
- To review members who failed to sync, see [How to Review EGYM Sync Errors](how-to-review-egym-sync-errors.md). To stop syncing a site or a membership group, see [How to Remove a Site or Membership Group from EGYM](how-to-remove-a-site-or-membership-group-from-egym.md).
- Integrators can manage the same settings through the API, starting from [List EGYM sites](../reference/configuration/list-egym-sites.md).
