Get your DigitalOcean Billing Info in Slack with Nimbella Commander
Tags: devops, slack, servers, digitalocean
Published: 2020-03-23 13:02:04

Have you ever wanted an easy way of displaying your DigitalOcean billing info on Slack? With [Nimbella Commander](https://nimbella.com/product/commander), you can have your current bill and next month's projected bill displayed using one command to your [Slack workspace](https://nimbella.com/slack/). This conveniently integrated DigitalOcean billing functionality will allow developers to have cost-visibility without having to navigate complex billing systems, which will benefit the entire organization in the long run.

![DigitalOcean bill in slack with monthly projections](https://dev-to-uploads.s3.amazonaws.com/i/0b1vcirs7d5g0eoaybos.png)

By following these 7 simple steps, you can add Nimbella Commander to Slack and set it up for running this DigitalOcean billing command. Later on, I'll show you how to restrict the access for this command, so that it is available only for the relevant people within your Slack workspace.

<hr>

1. Goto your [DigitalOcean's API](https://cloud.digitalocean.com/account/api/tokens) section and generate a new token with the name of __digitaloceanApiKey__. Copy this API token, you will be required to use this later.

    ![DigitalOcean API Key setup page](https://dev-to-uploads.s3.amazonaws.com/i/2vvq0p95t6k37aarkckd.png)

2. Add Nimbella Commander to your Slack workspace. Search 'Nimbella Commander' in Slack's app search section and proceed with it.

    ![Add Nimbella Commander app in Slack](https://dev-to-uploads.s3.amazonaws.com/i/opaftebi6veoeh0ixem9.png)

    Alternatively, You can visit [our official website](https://nimbella.com/) and click the "Add to Slack" button.

    ![Nimbella Commander app add to slack via direct link](https://dev-to-uploads.s3.amazonaws.com/i/m0lbnps5c4uejl1056gq.png)

3. In order to get your DigitalOcean billing details, you'll need to install the [billing Command Set](
https://github.com/nimbella/command-sets/tree/master/billing) into your Nimbella app. Command Sets are a packaging specification for Slack commands, and a convenient way to share commands via GitHub or open source. Type __/nc csm_install billing__ in your slack's channel or direct message.

    `/nc csm_install billing`
    
    ![Nimbella Commander DigitalOcean billing commandset](https://dev-to-uploads.s3.amazonaws.com/i/5n2q5n65eox6f6gbfapi.png)

4. Next, we need to bind some secrets to the billing commands. Specifically, the API keys you generated earlier for the DigitalOcean API will be encrypted (outside of Slack) and attached to the slash command. To do this, type __/nc secret_create__ to bring up the Nimbella Secret Creator. We're creating the secrets outside of Slack so that Slack will only see encrypted strings and not your API keys.

    `/nc secret_create`

    When you run the secrets command, you will see an output that looks like this:

    ![Nimbella Commander secret creator command](https://dev-to-uploads.s3.amazonaws.com/i/n7io86bttk7n3aqe5ppi.png)

5. Click on the Secret Creator link to be redirected to the page which encrypts your API keys.

    ![Nimbella Commander api key  setup page](https://dev-to-uploads.s3.amazonaws.com/i/kxhd5lao39p2i5bfzztl.png)

6. Add your Digital Ocean API Key and from Step 1 to the field in the Secret Creator as illustrated in the following figure. Next, click the "Make Secrets" button to generate the commands you'll need to copy and paste into your Slack workspace.

    ![Nimbella Commander secrets encryption page](https://dev-to-uploads.s3.amazonaws.com/i/bcg4qwm0ecin1ajfnkj0.png)

7. After clicking the "Make Secrets" button, the command you'll need to run on your Slack page will appear. Copy the command paste them into Slack. This will take your API Key to apply them to your Nimbella app.

    ![Nimbella Commander secret add command](https://dev-to-uploads.s3.amazonaws.com/i/1r9sgof5gjsn4pxye1zd.png)

8. Finally, run the billing Command Set's command __/nc dobill__ to see your DigitalOcean billing info.

    `/nc dobill`

    ![DigitalOcean bill in slack with monthly projections](https://dev-to-uploads.s3.amazonaws.com/i/0b1vcirs7d5g0eoaybos.png)

<hr>

You likely don't want everyone in your Slack team to run this command. Nimbella Commander offers a neat feature to allow only certain users to run specific commands. For example, you can restrict access to the DigitalOcean billing command to specific users using __/nc command_runners dobill + @user1 + @user2__, substituting for __"user1"__ and __"user2"__ the Slack names of your teammates that should have access to the DigitalOcean billing details.

`nc command_runners dobill + @user1 + @user2`

![Nimbella commander command runner setup](https://dev-to-uploads.s3.amazonaws.com/i/pjfpkp2tazssmnze6yfl.png)

It's worth also mentioning that you have access to an audit trail to see who's run your commands. This is useful for administrators and team oversight where appropriate. Type __/nc command_log dobill__

`/nc command_log dobill`

![Nimbella commander command log output](https://dev-to-uploads.s3.amazonaws.com/i/ridyurr9fevdc4fmje8w.png)

One last thing that's important to know is that the code for the dobill command you import into Commander is yours to edit. If you type __/nc command_code dobill__, you will receive a secure link that will allow you to edit the command.

`/nc command_code dobill`

![Nimbella commander code edit for digitalocean bill commandset](https://dev-to-uploads.s3.amazonaws.com/i/a98live7r14q1euuhm5b.png)

Using Nimbella's access control you can also limit who can view and edit the code that implements a particular command as well. The built-in Secret Creator means your sensitive data remains outside of Slack and accessible only to the code you run. And with Audit Logs, you have accountability and historical data readily available at your fingertips. These are powerful features of the Commander that don't exist in Slack otherwise. For more information about Commander, [visit our website](https://nimbella.com/product/commander). We'd also love to hear from you via our community [Slack channel](https://app.slack.com/client/TL64TJWVB/DTK6BBZGD) or on [GitHub](https://github.com/nimbella/command-sets).

If you wish to add Commander to your Slack account, then [click this link to get started](https://github.com/nimbella/command-sets)!