# Deploy fly apps using custom made bot

**URL:** <https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873>\
**Category:** Questions / Help\
**Created:** [July 5, 2022, 8:18am UTC](https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873 "2022-07-05T08:18:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilrock](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@ilrock](https://community.fly.io/u/ilrock)\
**Post date:** [July 5, 2022, 8:18am UTC](https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873/1 "2022-07-05T08:18:31Z")

</div>

We’re switching our infrastructure from Heroku to Fly.

We have built a small chatbot that allows us to deploy to production apps easily. That is done via Heroku API calls such as

`POST https://api.heroku.com/pipeline-promotions`

I’ve been searching for something that would allow us to do the same thing using fly, however, all I can find is `flyctl`. Is there any publicly available API we could use to achieve this?

---

<div class="post-metadata">

**Author:** ![DAlperin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dalperin/32/51176_2.png) [@DAlperin](https://community.fly.io/u/DAlperin)\
**Post date:** [July 5, 2022, 2:53pm UTC](https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873/2 "2022-07-05T14:53:51Z")

</div>

There are apis but they are loosely documented. I recommend reading through how flyctl [GitHub - superfly/flyctl: Command line tools for fly.io services](https://github.com/superfly/flyctl) and the terraform provider [GitHub - fly-apps/terraform-provider-fly: Terraform provider for the Fly.io API](https://github.com/fly-apps/terraform-provider-fly) do things. Also check out [GraphQL Playground](https://api.fly.io/graphql) particularly the docs tab you can access on the far right of the screen. The machines references is also helpful [Machines · Fly Docs](https://fly.io/docs/reference/machines/).

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [July 5, 2022, 2:56pm UTC](https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873/3 "2022-07-05T14:56:13Z")

</div>

This is going to sound silly, but the best way to automate Fly deploys is probably to just run `flyctl` from your bot code.

Heroku pipeline promotions basically work by deploying the result of a previous build. The basic process of this on Fly is:

1. Build your Docker image, probably with a CI tool
2. Tag image with `registry.fly.io/<app>:<tag>`
3. Push to [registry.fly.io](http://registry.fly.io)
4. `flyctl deploy -i registry.fly.io/<app>:<tag>`

You _can_ use our GraphQL API to replicate this logic but it’s more work. And `flyctl` is designed to be easy to run, you can just bundle it with your bot and shell out to it directly.

---

<div class="post-metadata">

**Author:** ![ilrock](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@ilrock](https://community.fly.io/u/ilrock)\
**Post date:** [July 6, 2022, 6:50am UTC](https://community.fly.io/t/deploy-fly-apps-using-custom-made-bot/5873/4 "2022-07-06T06:50:38Z")

</div>

Thank you so much! Will explore both solutions then. The `flyctl` method definitely feels the easier to work with
