Integrate External Services with the CTO.ai API
It’s possible to collect Insights Events data from any external platform via our Workflow Events API. If your team doesn’t use GitHub, wants to start collecting Events from other CI/CD systems, or needs more control over how Events are sent to the CTO.ai platform, our API lets you build an event collection system that meets your requirements.
Before you begin, you may want to review our documentation on Insights Events to better understand the concepts implemented by our API.
You need an API token to use this feature. Before you can generate your API token, you must contact support for a
ClientSecret. Store the credentials you receive from us somewhere safe.
Using the CTO.ai CLI, sign in to your existing CTO.ai user account by running the
ops account:signin command (or
ops account:signup if you don’t already have an account with us). After you have signed in, you can generate a new API token using the credentials you received from CTO.ai support:
When prompted by the CLI, enter your
ClientSecret, and CTO.ai account password. Your new token will then be generated.
Copy the newly-generated API token returned by the CLI and store it somewhere safe, as anyone with this token can use it to access the CTO.ai API on your behalf.
Sending data to the CTO.ai platform requires you to specify which CTO.ai team should receive the data, via its UUID.
ops team:switch command of the CTO.ai CLI, switch to the team that should be receiving events from your external application:
Then, run the
ops team:info command to get your team’s UUID:
This will print out information about your current team, including the team UUID.
The Workflow Events API endpoint is located at:
It can accept the Deployment Events defined in our Insights Events documentation.
This is an example HTTP request for posting data to the CTO.ai Workflow Events API. Please note a few important points about this command line snippet:
your_api_tokenshould be replaced with the API token you retrieved with the CTO.ai CLI.
YOUR_TEAM_ID_HEREshould be replaced with the team UUID you retrieved with the CTO.ai CLI.
- The value for the key
event_actionshould be either
failure, depending on the actual deployment status.
- The values for
metaare all specific to each deployment.
Review our Deployment Events documentation on the Insights Events page for more information about events that are accepted by our API.