Cloud Events

Introduction

Zapp offers a way to integrate with 3rd party provider using the cloud Events protocol - https://cloudevents.io/. Using Cloud Events you can integrate your custom implementation of actions that your app users are making, without the need to write any client side code.

Once you implement cloud events and configured it in Zapp, any time a user action is triggered on the app, your cloud events server will be notified.

Note: To integrate your cloud events server in the app go to the relevant plugin configuration and set your server URL.

List of available cloud events

note

If the event doesn't define an explicit response, please use the following:

{
"specversion": "1.0",
"type": "com.applicaster.event.received.v1",
"source": "<SERVER_URL>",
"subject": "Event <EVENT_UUID> was successfully received",
"id": "<NEW_EVENT_UUID>",
"time": "<TIME_IN_RFC3339_FORMAT>",
}

Video Stopped (com.applicaster.video.stopped.v1)

Description: Triggered any time a user stops a videos

Plugin: Continue Watching (Quick Brick)

Request Payload:

{
"specversion": "1.0",
"type": "com.applicaster.video.stopped.v1",
"source": "<APP_URLSCHEME>://<BUNDLE_ID>/verions/<VERSION>",
"subject": "Watched video segment <TIME> progress:<PROGRESS> <VIDEO_ID>",
"id": "<EVENT_UUID>",
"time": "<TIME_IN_RFC3339_FORMAT>",
"datacontenttype": "applicastion/json",
"data": {
"userIdentifier": "<ACCESS_TOKEN>",
"videoId": "<UNIQUE_VIDEO_ID>",
"secondsFromStart": "<SECONDS_FROM_START>",
"progress": "<NUMBER_BETWEEN_0_TO_1>",
"status": "<EVENT_STATUS>"
}
}

data.userIdentifier

A string that represents the user. It's best to make use of the user's access_token and not the actual user id, to be able to make sure the request is authorized.

data.videoId

The unique video id. The video id is taken from the entry id set on the Pipes2 JSON Feed.

data.secondsFromStart

Indicates the second the user triggered the event.

data.progress

A number between 0 - 1 indicating the movie progress (where 0 indicates the beginning of the video and 1 indicates its end).

data.status

Can be one of the following values:

  • COMPLETED: The video is considered as completed.
  • VIDEO_STOPPED: The video was stopped without reaching the end of the video
note

Items can be considered as completed without reaching progress=1. To find out more check entry.extensions.auto_resume_completion_threshold.


Add to favorites (com.applicaster.favorites.added.v1)

Description: Triggered any time a user adds an item to her favorites list

Plugin: Favorites

Request Payload:

{
"specversion": "1.0",
"type": "com.applicaster.favorites.added.v1",
"source": "<APP_URLSCHEME>://<BUNDLE_ID>/verions/<VERSION>",
"subject": "<ENTRY_ID> added to favorites",
"id": "<EVENT_UUID>",
"time": "<TIME_IN_RFC3339_FORMAT>",
"datacontenttype": "applicastion/json",
"data": {
"userIdentifier": "<ACCESS_TOKEN>",
"entryId": "<UNIQUE_ENTRYs_ID>"
}
}

data.userIdentifier

A string that represents the user. It's best to make use of the user's access_token/id_token and not the actual user id, to be able to make sure the request is authorized.

data.entryId

The unique entry id. The entry id is taken from the entry id set on the Pipes2 JSON Feed.


Remove from favorites (com.applicaster.favorites.removed.v1)

Description:: Triggered any time a user remove an item from favorites

Plugin: Favorites

Request Payload:

{
"specversion": "1.0",
"type": "com.applicaster.favorites.removed.v1",
"source": "<APP_URLSCHEME>://<BUNDLE_ID>/verions/<VERSION>",
"subject": "<ENTRY_ID> wast removed from favorites",
"id": "<EVENT_UUID>",
"time": "<TIME_IN_RFC3339_FORMAT>",
"datacontenttype": "applicastion/json",
"data": {
"userIdentifier": "<ACCESS_TOKEN>",
"entryId": "<UNIQUE_ENTRYs_ID>"
}
}

data.userIdentifier

A string that represents the user. It's best to make use of the user's access_token/id_token and not the actual user id, to be able to make sure the request is authorized.

data.entryId

The unique entry id. The entry id is taken from the entry id set on the Pipes2 JSON Feed.


Server implementations guidelines

  • Server should return a 201 status on success.
  • According to the Cloud Event specs the time should be in rfc3339 format e.g. 2021-04-12T23:20:50.52Z. Please make sure you implement your server accordingly.