Repo with all the related scripts/jsons to test TokBox sessions data pulled via the API on a vacuum. The official TokBox API documentation can be found at https://tokbox.com/developer/guides/insights/
- Run
gem install bundlerandbundle install. This will install the required libraries to run theget_params.rbscript - In the
get_params.rbfile, replacePROJECT_KEYon line 18 for theUsernameas string andPROJECT_SECRETon line 24 for thePassword, these credentials can be found in the Data Team LastPass vault under the name ofTokbox Insights API Creds - Consumer Production Project.
- Change the
START_TIMEandEND_TIMEto specify the period for which you want the sessionsIds for. DO NOT change the.iso8601.to_spart, that's the format specified in the TokBok API documentation, it also supports datetimes as integers so you can also do.iso8601.to_i. - Run
ruby ./get_params.rbto get thestart_time,end_timeandTokenrequired for posting the TokBox API, keep in mind that the token has a lifetime of three minutes.
- If you don't have the Postman app installed, you can find it here: https://www.postman.com/.
- In Postman:
- Set the POST url as https://insights.opentok.com/graphql
- In the Headers section, set Content-Type as application/json, and paste the generated token in the X-OPENTOK-AUTH field.
- In the Body section, paste the content of the get_sessions.json file with
PROJECT_KEYreplaced for the project key as an integer,START_TIMEandEND_TIMEwith the ones generated with the script. NOTE: For the way the TokBox API works it will only return the first 1000 sessionIds for the specified period, so if you want to get more you will need to keep posting specifying aendCursoron thesessionSummariesfield (after the first:1000) withendCursorof the last respond each time until thehasNextPagefield of the response isfalse.
In Postman:
- Set the POST url as https://insights.opentok.com/graphql.
- In the Headers section, set
Content-Typeasapplication/jsonand paste the generated token in theX-OPENTOK-AUTHfield. - In the Body section, paste the content of the
get_sessions_details.jsonfile withPROJECT_KEYreplaced for the project key as an integer and in the sessionIds section paste the sessionIds you want to get the details from. NOTE: For the way the TokBox API works, it will only return the details for the first 50 sessionIds specified, so don't do more than 50 at a time.