1. Help Center
  2. API
  3. API for Registrations

Can I sync my ActivityHero registrations into my own database?

Yes! You can use the ActivityHero Registrations API to send your ActivityHero registration data to your external registration system. ActivityHero will call this webhook whenever a new registration is added to or updated in ActivityHero.

reg_data_xfer

How the Registration API moves data from ActivityHero to your system


Sender’s End

(Generating a signature and sending ActivityHero registration data to your system)

The Sender (ActivityHero) will 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 Registration API section of your ActivityHero dashboard.

Parameters

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


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).

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 registration_webhook table’, ‘providerId_timestamp )

}

Sample of the header data code

 


Receiver’s End

(Validating the signature and storing registration data)

The Receiver (you, the provider) needs to implement the code for validating the signature.

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).

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 the “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 Registration API is in place, the following data is what will be exchanged from ActivityHero to your external registration system:

{
     "action": “enrolled/update/cancelled”,
     "provider_id": 123,
     "time": 1671040686,
     "data": [
      {
        "registration_id": ,
"activity_schedule_id": ,
        "external_schedule_id": ,
        "provider_location_id": ,
        "activity_name": "",
        "session_info": "",
        "provider_location_info": "",
        "amount": ,
        "discount_amt": ,
        "fee_description": "",
        "reg_created_at": "",
        "reg_updated_at": "",
        "enrollment_status": "",
        "participant_info": {
              "full_name": "",
           "first_name": "",
           "last_name": "",
              "dob": "",
              "grade": "",
              "gender": "",
           "school_name": "",
           "allergies": "",
           "medical_condition": ""
         },
        "parents": [
          {
            "full_name": "",
            "cell": ,
            "email": "",
            "street_address": "",
            "city": "",
            "state": "",
            "zip": ,
            "country": ""
          },
          {
            "full_name": "",
            "cell": ,
            "email": "",
            "street_address": "",
            "city": "",
            "state": "",
            "zip": ,
            "country": ""
          }
        ],
        "authorized": [
          {
            "name": "",
            "cell": ,
            "relation": ""
          },
          {
            "name": "",
            "cell": ,
            "relation": ""
          }
        ],
        "emergency": [
          {
            "name": "",
            "cell": ,
            "relation": ""
          },
          {
            "name": "",
            "cell": ,
            "relation": ""
          }
        ],
        "medical_info": {
              "hospital_name": "",
              "physician_name": "",
              "physician_phone": ,
              "insurance_company": ""
        },
        "additional_request": {
              "sibling_request": "",
              "special_request": ""
        }
      }]
}

 


Errors

In case of an error, further attempts to complete the webhook will be tried as follows:

  1. The first retry request will be sent after 5 minutes.
  2. A second attempt (if the first fails) will be sent after one hour.
  3. The final attempt (if both previous attempts fail) will be tried after 6 hours.

If there is still no success after the third attempt, you will receive an error message via email. Please check your coding and try again.