Publish usage events

The Productiv platform is powered by recording real-time usage events for a customer per an application. These usage events represent different activity or actions that a given user performs on an app. Events like starting a video call on a conferencing app, sending a message on a chat app, sending an email, uploading a file, downloading a file are all examples of different usage events that can be tracked and shown in product. Every Event pushed to Productiv will be uniquely identified by the timestamp, email, and eventName combination.

This API can be used to push all usage events for an app to Productiv.

Prerequisites

  • Before this API can be queried, you should have already set up the application for which you will be publishing usage events. Once thats done you should have a unique appId that can be used to query these APIs. Visit the Set up an Application section to see how to do so.

  • In order to query this API, you would also need to send an access_token as part of the Authorization header. To see the steps for generating an access token check out Authorization.

Endpoint

POST https://public-api.productiv.com/services/push/v1/customer/apps/{applicationInstanceId}/events
Required Scope https://api.productiv.com/connector.write

Request headers

Parameter Value
content-type application/json
Authorization Bearer access_token

Path params

Parameter Description
applicationInstanceId applicationInstanceId represents the Application Instance for which the usage events are being pushed. (See Set up an Application)

Request body

Property Datatype Description Optional
events array List of UsageEvent objects (see definition below) No

Example request body

{
  "events": {
    "timestamp": 1566340678676,
    "email": "testuser@random.com",
    "eventName": "opened_file"
  }
}

Response

If the request is successful, a JSON response will be returned. This JSON object will contain the following parameters:

Parameter Description
success Will be set to true in case of a successful response.

Example response

{
  "success": true
}

API limitations

  • A maximum of 1000 events can be pushed at a time.

SLA

  • Only events pushed to Productiv within 12 hours of their occurrence are guaranteed to be aggregated and shown on the product page.

Objects

UsageEvent

Property Datatype Description Optional
timestamp Number Unix timestamp in milliseconds of the event. No
email String Email of the user associated to the event. No
eventName String Name of the event provided in mapping during application definition. No
targetApp String Application instance ID for the instance being logged into. Required if Event Type Category is "Login" (See App Usage Events)
targetAppName String Application name for the instance being logged into. Yes