You need to set up an active application or service as an event receiver so that you can receive the server events. Samples on how to set these up can be found on Smart Community. For more information, see Find sample data on Smart Community.
In order to interact with the application and react to the sent events, you need to obtain an OAuth token from the authorization server used by your server site. After obtaining the token you can make OData requests using CRUD operations to perform the desired action.