Webhooks
You can set a webhook based on actions in Modern Campus CMS, including Modern Campus CMS calendar actions. When the action occurs, Modern Campus CMS sends a message to the URL that you set up to receive incoming HTTP requests. The request is HTTP POST containing JSON data about the action.
Format of Webhooks MessageLink to this section
When enabled in account settings and allowed for site(s), file(s), or folder(s), Modern Campus CMS sends webhook messages using a uuid
(set in the JSON object associated with the CMS action).
Actions trigger webhooks, whether completed successfully or if the action causes an error. Modern Campus CMS webhook messages use the following formats:
JSON key | Data Type | Description |
---|---|---|
account | string | Modern Campus CMS account where the action was initiated |
site | string | Modern Campus CMS site where the action was initiated |
user | string | Modern Campus CMS user who initiated the action |
type | string |
Type of action initiated. Possible values: Modern Campus CMS
* For asset publish to trigger a webhook, webhooks must be turned on in site access settings. Modern Campus CMS Calendar
|
success | array of site/calendar objects |
Each successful type of action will be listed here. The success object is split up by Modern Campus CMS site and/or calendar module. Each Site object will contain an array of Page objects with the root relative staging path and live URL for each published item. Each calendar module contains one or more calendars (categories). |
failed | array of site/calendar objects |
Each failed type of action will be listed here. The failed object is split up by Modern Campus CMS site and/or calendar module. Each Site object will contain an array of Page objects with the root relative staging path and reason for failure. Each calendar module contains one or more calendars (categories). |
errors | array of site/calendar objects |
Each error encountered during the type of action will be listed here. The error object is split up by Modern Campus CMS site and/or calendar module. Each Site object will contain an array of strings detailing the reason(s) for the error. Each calendar module contains one or more calendars (categories). |
success_count | number | Count of the number of successful actions. |
failed_count | number | Count of the number of failed actions. |
uuid | string | Unique identifier for this type of action. The uuid will match on the notification webhook message and the final status webhook message. |
began | string | Date and time the action began, according to the staging server. |
completed | string | Date and time the action completed, according to the staging server. |
origin | array of strings |
File(s) specifically chosen by the user which initiated the publish action. For example, if an asset was published, that asset's name would appear here and all of the pages which republished as a result would appear in the |
total_time | number | Time duration for publish action to complete. Measured in seconds. |
msg | string | Description of whether the publish action "has begun", "has completed", or "has failed." |
events | string |
Lists the IDs of Modern Campus CMS Calendar events that were affected by this action. If only one event was affected, extended information is provided for this event. |
category_id | number | Unique ID of a calendar [category] that was modified. |
category_name | string | Name of a calendar [category] that was modified. |
location_id | number |
Unique ID of a location attribute in Modern Campus CMS Calendar that was modified |
location_name | string |
Name of a location attribute in Modern Campus CMS Calendar that was modified. |
organizer_id | number |
Unique ID of an organizer attribute in Modern Campus CMS Calendar that was modified |
organizer_name | string |
Name of an organizer attribute in Modern Campus CMS Calendar that was modified. |
Listening URL ScriptLink to this section
The script you place at the webhooks URL can be configured to take any actions you see fit based upon the data provided by the webhook message. The exact language and server-side code required at the webhooks URL is dependent upon the language your server is running as well as the resulting actions you'd like to occur.
For example, you could configure your script to create a reporting view for individuals who are not Modern Campus CMS users (zip file with example PHP script). Or you could hit an Modern Campus CMS API Documentation as a reaction to the publication of specific sections or pages (for example causing your faculty listing page to republish whenever a profile page in that section is published).