---
title: Can I automatically sync my schedules into ActivityHero?
description: Yes! You can use the ActivityHero Schedule API to keep your external schedules in sync with the ActivityHero database. You can call this webhook whenever new schedules are added or when there are upda
---

[Skip to content](https://help.activityhero.com/can-i-sync-my-activity-schedules-into-activityhero#main-content)

[![](https://help.activityhero.com/hs-fs/hubfs/ActivityHero%20Logo.png?width=200&height=151&name=ActivityHero%20Logo.png)](https://www.activityhero.com/)

Open main navigation

Close main navigation

- [School District Support](https://support.activityhero.com/?utm_source=activityherohelp&utm_medium=referral&utm_content=button)

[School District Support](https://support.activityhero.com/?utm_source=activityherohelp&utm_medium=referral&utm_content=button)

 How can we help?

- There are no suggestions because the search field is empty.

1. [Help Center](https://help.activityhero.com/?hsLang=en)
2. [API](https://help.activityhero.com/api?hsLang=en)
3. [API for Activity Schedules](https://help.activityhero.com/api?hsLang=en#api-for-activity-schedules)

# Can I automatically sync my schedules into ActivityHero?

Yes! You can use the ActivityHero **Schedule API** to keep your external schedules in sync with the ActivityHero database. You can call this webhook whenever new schedules are added or when there are updates to existing schedules.

![Schedule Data Transfer](https://help.activityhero.com/hs-fs/hubfs/sched%20data.png?width=688&height=387&name=sched%20data.png)*How the API moves data from your system to ActivityHero*

 

This webhook is implemented using the **SHA256** webhook signature verification method.

### Sender’s End

(Generating Signature and sending your schedule data to ActivityHero)

You are the **Sender** (Provider) and will need to implement the following code for generating the signature.

```
def generate_hmac(key, data)   Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', key, data))end
```

*This code is written in Ruby*

The custom data for this code is automatically generated for you and can be found in the API section of your ActivityHero dashboard.

![](https://help.activityhero.com/hs-fs/hubfs/image-png-Dec-22-2022-11-08-53-1867-PM.png?width=300&height=225&name=image-png-Dec-22-2022-11-08-53-1867-PM.png)

![](https://help.activityhero.com/hs-fs/hubfs/image-png-Dec-22-2022-11-47-59-6484-PM.png?width=171&height=112&name=image-png-Dec-22-2022-11-47-59-6484-PM.png)

#### Parameters

**Key** - This is the value in the “secret” box

![](https://help.activityhero.com/hs-fs/hubfs/image-png-Dec-22-2022-11-50-24-5908-PM.png?width=634&height=294&name=image-png-Dec-22-2022-11-50-24-5908-PM.png)

**Data** - This string is your unique *Provider ID#* and the request timestamp (in seconds) joined by an underscore.

Your *Provider ID#* can be found in the URL when you are logged in to your ActivityHero dashboard, and the request timestamp you can get from the payload in the “time” key *(see sample Payload below)*.

![](https://help.activityhero.com/hs-fs/hubfs/image-png-Dec-22-2022-11-58-44-5722-PM.png?width=436&height=181&name=image-png-Dec-22-2022-11-58-44-5722-PM.png)

***Example**: This Provider ID# is “12345" and the request timestamp in seconds is “1671040686”. The combined data string will be “12345\_1671040686".*

\*\* This function will return a secret signature which will need to be passed in the headers as a value of the secret key.

```
headers = {       'Accept': 'application/json',       'Content-Type': 'application/json',       'Signature': generate_hmac(‘secret column from schedule_webhook table’, ‘providerId_timestamp )}Sender
```

*Sample of the header data code*

 

---

### Receiver’s End

(Validating the Signature and Storing the Data)

The **Receiver** of the data (ActivityHero) will implement the following code for validating the signature. Below is the code implemented in Ruby language-

```
def verify_webhook(data, api_secret_key, hmac_signature)   calculated_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', api_secret_key, data))   ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac_signature)end
```

*This code is written in Ruby*

#### Parameters

**Data** - This string is your unique *Provider ID#* and the request timestamp (in seconds) joined by an underscore.

Your *Provider ID#* can be found in the URL when you are logged in to your ActivityHero dashboard, and the request timestamp you can get from the payload in the “time” key *(see sample Payload below)*.

![](https://help.activityhero.com/hs-fs/hubfs/image-png-Dec-22-2022-11-58-44-5722-PM.png?width=436&height=181&name=image-png-Dec-22-2022-11-58-44-5722-PM.png)

***Example**: This Provider ID# is “12345" and the request timestamp in seconds is “1671040686”. The combined data string will be “12345\_1671040686".*

‘hmac\_signature’ param’s value will be the value of “secret” key from the header’s data (Sample below). “Api\_secret\_key” is the secret shared and “data” can be generated from payload using provider\_id and time field of json.

**(“provider\_id}\_{time}")**

```
headers = {       'Accept': 'application/json',       'Content-Type': 'application/json',       'Signature': 'Signature' // generated at Sender’s end}
```

### Sample Payload

Once the API is in place, the following data is what will be exchanged between your external system and ActivityHero:

```
{   "time": 1671040686,   "provider_id": 123,   "data":[ {   "activity_schedule_id": "",   "location_name": "Cubberley Grass Field",   "activity_name": "Coach Ken Soccer Camps",   "session_type": "series",   "session_name": "DR",   "start_date": "12/10/2022",   "end_date": "12/14/2022",   "start_time": "09:00 AM",   "end_time": "01:00 PM",   "days_of_week": "mon,thur,fri",   "min_age_in_months": 48,   "min_age_in_years": 4,   "max_age_in_months": 144,   "max_age_in_years": 12,   "min_grade": 1,   "max_grade": 3,   "price": "",   "price_label": "",   "single_day_price": 51,   "single_day_alt_price": "",   "alt_price": "",   "alt_price_label": "",   "price_type": "per_session",   "status": "Published",   "num_of_openings": 51,   "external_schedule_id": "",   "registration_start_timezone": "Pacific Time (US & Canada)",   "registration_start_date": "",   "registration_start_time": "",   "registration_ends": "when the session ends",   "registration_cutoff_days": "",   "registration_cutoff_date": "10/10/2022 11:59 PM",   "single_day_registration_cutoff_days": "",   "allow_proration": "FALSE",   "num_of_scholarship_spots": "",   "lowest_scholarship_price": "",   "meeting_url": "",   "meeting_details": "",   "payment_plan_names": "",   "extended_care_am_time": "",   "extended_care_pm_time": "",   "extended_care_am_price": "",   "extended_care_pm_price": "",   "extended_care_overall_price": "",   "extended_care_overnight_price": "",   "extended_care_am_per_day_price": "",   "extended_care_pm_per_day_price": "",   "extended_care_per_day_price": "",   "extended_care_per_hour_price": "",   "teacher_name": "",   "room_num": "",   "activity_id": "",   "provider_location_id": "",   "external_activity_id": 10020,   "external_location_id": 2032,   "flexible_schedule": "",   "Additional Hours": "",   "Additional Days (beyond first 2 days)": "" }]}
```

 

**NOTE**: If the total number of sessions to be exchanged exceeds 100, the API will fail, and you will receive an error. To import more than 100 sessions, consider a manual [CSV import](https://help.activityhero.com/hc/en-us/articles/360061447891-importing-activities-locations-and-sessions?hsLang=en) instead.

---

Refer to this link for webhook signature verification:  
[https://hookdeck.com/webhooks/guides/how-to-implement-sha256-webhook-signature-verification](https://hookdeck.com/webhooks/guides/how-to-implement-sha256-webhook-signature-verification)

- [Getting Started](https://help.activityhero.com/getting-started?hsLang=en#main-content)

    - [Prospective Activity Providers](https://help.activityhero.com/getting-started?hsLang=en#prospective-activity-providers)
    - [Completing your Business Listing](https://help.activityhero.com/getting-started?hsLang=en#completing-your-business-listing)
- [Help for Families](https://help.activityhero.com/help-for-families?hsLang=en#main-content)

    - [Signing Up for ActivityHero FAQ](https://help.activityhero.com/help-for-families?hsLang=en#signing-up-for-activityhero-faq)
    - [Navigating ActivityHero](https://help.activityhero.com/help-for-families?hsLang=en#navigating-activityhero)
    - [Account Management](https://help.activityhero.com/help-for-families?hsLang=en#account-management)
    - [Activity Registration](https://help.activityhero.com/help-for-families?hsLang=en#activity-registration)
    - [Writing a Review](https://help.activityhero.com/help-for-families?hsLang=en#writing-a-review)
    - [Payments & Invoices](https://help.activityhero.com/help-for-families?hsLang=en#payments-invoices)
    - [Hero Rewards Loyalty Program](https://help.activityhero.com/help-for-families?hsLang=en#hero-rewards-loyalty-program)
    - [Gift Cards](https://help.activityhero.com/help-for-families?hsLang=en#gift-cards)
    - [Referrals & Affiliate](https://help.activityhero.com/help-for-families?hsLang=en#referrals-affiliate)
- [Help for Activity Providers](https://help.activityhero.com/help-for-activity-providers?hsLang=en#main-content)

    - [Activity Setup - In-Person & Online](https://help.activityhero.com/help-for-activity-providers?hsLang=en#activity-setup-in-person-online)
    - [Prices, Discounts & Payment Plans](https://help.activityhero.com/help-for-activity-providers?hsLang=en#prices-discounts-payment-plans)
    - [Managing Sessions](https://help.activityhero.com/help-for-activity-providers?hsLang=en#managing-sessions)
    - [Reviews](https://help.activityhero.com/help-for-activity-providers?hsLang=en#reviews)
    - [Listing On-Demand Activities](https://help.activityhero.com/help-for-activity-providers?hsLang=en#listing-on-demand-activities)
    - [Registration Forms & Deadlines](https://help.activityhero.com/help-for-activity-providers?hsLang=en#registration-forms-deadlines)
    - [ActivityHero Services, Business Marketing & Analytics](https://help.activityhero.com/help-for-activity-providers?hsLang=en#activityhero-services-business-marketing-analytics)
    - [Communication Tools](https://help.activityhero.com/help-for-activity-providers?hsLang=en#communication-tools)
    - [Payments, Refunds & Receipts](https://help.activityhero.com/help-for-activity-providers?hsLang=en#payments-refunds-receipts)
    - [Managing Activity Registrations](https://help.activityhero.com/help-for-activity-providers?hsLang=en#managing-activity-registrations)
    - [Registration Links & Widgets](https://help.activityhero.com/help-for-activity-providers?hsLang=en#registration-links-widgets)
    - [Payments & Adjustments](https://help.activityhero.com/help-for-activity-providers?hsLang=en#payments-adjustments)
    - [Stripe](https://help.activityhero.com/help-for-activity-providers?hsLang=en#stripe)
- [API](https://help.activityhero.com/api?hsLang=en#main-content)

    - [API for Registrations](https://help.activityhero.com/api?hsLang=en#api-for-registrations)
    - [API for Activity Schedules](https://help.activityhero.com/api?hsLang=en#api-for-activity-schedules)
- [Contact Support](https://help.activityhero.com/contact-support?hsLang=en)

[![Help on ActivityHero](https://help.activityhero.com/hs-fs/hubfs/ah_logo.png?width=24&height=24&name=ah_logo.png "Help on ActivityHero")](https://www.activityhero.com)

[Submit a Ticket ↗](https://cgcag.share.hsforms.com/2cz7UyPgsStmXxM9oGoM2Uw)   
[List your Business ↗](https://activityhero.com/business-wizard)   
[School District Support↗](https://support.activityhero.com?utm_source=activityherohelp&utm_medium=referral&utm_content=footer)

<https://www.facebook.com/activityhero> <https://www.instagram.com/activity_hero>