The Heroku API offers programmatic access to Heroku's cloud platform, enabling developers to automate, extend, and integrate their app's lifecycle events with other services. With Pipedream, you can harness the Heroku API for powerful automation, such as managing apps, dynos, add-ons, and configuring scaling operations. Pipedream's ability to connect with multiple services allows for creating complex workflows, such as syncing your development pipeline with external project management tools or triggering alerts based on app metrics.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
heroku: {
type: "app",
app: "heroku",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.heroku.com/account`,
headers: {
Authorization: `Bearer ${this.heroku.$auth.oauth_access_token}`,
"accept": `application/vnd.heroku+json; version=3`,
},
})
},
})
Continuous Deployment Workflow: Use GitHub actions to push code to a repository, then trigger a Pipedream workflow that automatically deploys the latest code to a Heroku app. Integrate Slack to send notifications to your team once the deployment is successful.
Database Backup Automation: Schedule a recurring Pipedream workflow that takes a backup of your Heroku Postgres database and uploads it to Amazon S3 or Dropbox. Use this to ensure regular backups and maintain a secure offsite copy of your data.
Dynos Management and Scaling: Create a workflow that monitors your application's response times or other critical performance metrics using Prometheus or Datadog. If certain thresholds are crossed, the workflow can scale your Heroku dynos up or down and inform you via email or SMS with Twilio.
Emit new event on each webhook event. See the documentation
Heroku uses OAuth authentication. When you connect your Heroku account, Pipedream will open a popup window where you can sign into Heroku and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Heroku API.
Pipedream requests the following authorization scopes when you connect your account:
global
GET
https://id.heroku.com/oauth/authorize
?
client_id={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
https://id.heroku.com/oauth/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
redirect_uri={{oauth.redirect_uri}}
&
grant_type=authorization_code
&
code={{oauth.code}}
POST
https://id.heroku.com/oauth/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}