DEV Community

Cover image for Setup travis CI builds directly from the API
Tanisha for Canonic Inc.

Posted on • Updated on

Setup travis CI builds directly from the API

Executing a CI Build using an API built with no-code backend platform! These truly are craziest of times. The need for APIs triggering Builds actually eliminates a lot of hassle that often come with using tools like jenkins or travis. They offer a lot more CI features but are often difficult to setup & maintain for smaller projects.

If you have a SPA website hosted that depends on the content of your backend, well, you're in luck because you can attach a webhook to your API endpoint, which will trigger a build everytime the API is called.

Creating project on low-code tool

  1. We head over to Canonic and sign in using our social accounts. Next, we click on Create New to create a project for our application. Click on next, then click on create to complete the process.

    Create new project screen

  2. A popup asking your first table name will appear. If not, you can click on the + icon in the header to create a new table. Let's name our first & only table for this project - RepoBuilds.

  3. We create a text field named "Repo Branch" as we need the branch name against which we want to trigger the build.

  4. We hit deploy on the top right, and we'll be provided with a hosted backend. a database & basic CRUD endpoints per table.

  5. Click on the API tab on the left to start adding the Travis CI webhook. We select + button that's attached to the createRepoBuilds block in mutations. It'll open up a new webhook settings on the right hand side.

  6. Select Build type → Choose Travis CI from the list of providers & you'll be provided with fields for settings.

  7. API Key → This is the API key of Travis account.

  8. Repo Url → Git URL for the Repo we want to trigger the build

  9. Repo Branch → Branch to be selected for building

  10. For Repo Branch → We want to trigger the build against the text found in the repo branch field of the API payload. So we can make use of Handlebars templates & simply write {{repoBranch}} in that field. This will extract the repoBranch field from the API payload and forward it to Travis.

And we're ready with our API to start triggering builds. Managing an API access is easier than managing CI access, so you can directly start consuming this API both by yourself & teammates.

Integrating our existing app with this API:

This will require a combination of things that we need for securely connecting our application with this API.

  • Access token for our API
  • Documentation for the API

Access Tokens

  1. Click on Settings using left side menu. Go to Access tokens tab.

  2. Click on Create a new token, and provide it a suitable name and permissions. Click on Create.

  3. You've successfully generated an access token for your API. Copy it & save it some place safe as you won't be able to see it again.


Head over to the docs tab using the left-hand side, and you'll find documentation for createRepoBuilds API (the API block where we added our Travis webhook).


After completing all the necessary steps, we're finally ready to deliver our first SMS using our Travis-connected API.

  1. Let's copy the CURL command that was mentioned in the documentation. Fill in your access token and paste it into the terminal.
  2. Our curl command will look something like this.

    ➜  ~ curl '' \
      --request POST \
      --header "Content-type: application/json" \
      --header "Authorization: xxxxxx-xxxxx-xxxx" \
      --data '{
        "input": {
          "repoBranch": "newFixes",

    A successful response will look like this:


You should check on Travis, and you'll find the latest build in progress. Having an API saves a lot of trouble of maintenance and boilerplate setup while leaving plenty of room for rapid innovation. Find more information about this feature here -

You also add other integrations depending on your business needs like sending a message on slack, etc. Check out the slack guide here.

Top comments (4)

muzammilaalpha profile image

Keep sharing!

kartik0709 profile image
Kartik Grewal

Thank you! Do let me know if there's any specific guide you would want me to make. Would love to help out. :)

wparad profile image
Warren Parad

So it's an ad for canonic?

kartik0709 profile image
Kartik Grewal • Edited

Not really. It's a step-by-step guide on how you can trigger travis-builds without coding. I would be more than happy to cover any other platform, if it's this simple ^.