Gigya's commenting service can generate callbacks to a customer-defined URL when a new comment is posted or when a pending comment is published.
Comment notifications can be registered in the Gigya Platform's Settings tab, select Comment Settings and then page down to the Notifications. Comment notification can also be registered using the comments.setCategoryInfo API (in the categorySettings parameter).
The Notification Format
Notifications are sent as an HTTP/HTTPS post request with the following parameters:
- event - newComment, commentEdited or commentStatusChanged. Comment statuses can be "published", "pending" or "rejected".
- eventData - a JSON object containing the following fields:
- categoryID - taken from the StreamInfo object
- streamID - taken from the StreamInfo object
- comment - contains the comment object
- oldValue and newValue - these fields appear only in commentStatusChanged events. The fields hold the old and new statuses, respectively.
- isModerator- this field appears only in commendEdited events, and only for comments that have been edited by a moderator. It is set to "true".
- nonce - a cryptographic number that is unique for each post.
- timestamp - the GMT time of the callback in UNIX time format (the number of seconds since January 1st 1970).
- signature - the callback is signed using HMAC-SHA1 digital signature. The signature's base string is built from the event, eventData, nonce and timestamp.
URL encoding is used for the data sent. In the example below the eventData is shown in its raw format, unencoded.
- Generate a signature using the values in the callback (i.e. event, eventData, nonce and timestamp) in their URL-encoded form. Note - if you are using one of our SDKs, you may use the SigUtils.calcSignature method to generate the signature.
- Compare the generated signature with the signature received in the callback URL. Make sure both signatures are identical.