Bots.Business - Help
  • Welcome
  • Getting started
  • Create bot from Google Table
  • App
    • Reset or Update Your Password
  • Commands
    • Answer
    • Aliases
    • Keyboard
    • Groups
    • Wait for answer
    • Auto Retry (AR)
  • Coding: BJS
    • Variables
    • Bot functions
    • Message broadcasting and editing
    • User functions
    • Properties
    • Always running commands
    • Error command: "!"
    • Lists
      • Migration from properties to list
    • Api functions
    • BB Admin functions
    • Admin Panel
    • Send HTTP request
    • Web App
    • Caching
    • Inline Bot
    • BJS Security
    • Good coding practices
    • Top errors
  • Git
    • Import bot from Git repository
    • Export bot to Git repository
    • Repository structure
    • File: bot.json
    • Automatic importing on Git push
  • Iterations. How to reduce theys?
  • Limitations
  • Cloud
  • Reports
  • Deep Linking - pass any params on Bot starting
  • How to link chat account with BB account?
  • BB Inspection
  • Protected bot
  • VS Code
  • How to...
  • Smart Bot
    • Overview
    • Lang File
    • SmartBot
    • SmartTasker
    • Amount Dialog
  • Libs
    • What it is - Libs?
    • Libs development
    • RefferalLib
    • ResourcesLib
    • Random
    • MembershipChecker (MCL)
    • Cooldown Lib
    • CurrencyConverter
    • Lang
    • TopBoardLib
    • QiwiPayments
    • Coinbase (CB)
    • CoinPayments (CP)
    • OxaPay
    • CryptoJS
    • CurrencyQuote
    • GoogleApp
    • GoogleTableSync
    • Guard
    • Webhooks lib
    • DateTimeFormat Lib
  • Store
    • BB Point Bot
    • Welcome bot
    • Help bot
    • SRB Demo Keyboard Tools
Powered by GitBook
On this page
  • Initial setup
  • Call API methods
  • Typical errors

Was this helpful?

  1. Libs

Coinbase (CB)

PreviousQiwiPaymentsNextCoinPayments (CP)

Last updated 3 years ago

Was this helpful?

This Lib make integration with in easy way.

Initial setup

  1. Go to this and generate new key. Select needed rights:

Install lib and make /setup command with code:

Libs.Coinbase.setup();

3. Go to Admin Panel and fill Api Key and Secret Api Key:

4. If you need notifications copy Notifications url and fill it on step 2

5. Fill command to be called on notifications if you need it

Call API methods

/create command:

let account_id = "YOU ACCOUNT ID"
// you can see your all accounts in https://www.coinbase.com/accounts/
// just select needed account and copy it ID from url:
// https://www.coinbase.com/accounts/ID

Libs.Coinbase.apiCall({
  method: "POST",   // method can be GET and POST
  path: "accounts/" + account_id + "/addresses",
  body: { name: "myAddress" },
  onSuccess: "/onApi",
  // onError: "/onApiError"  // onError command
  // background: true // perform api call in background for big timeout limit
  // apiKey - if you need custom Api Key
  // secretApiKey - if you need custom Api Key
})

In body you can pass all fields from Coinbase api.

/onApi command:

Bot.inspect(options.result)

/onApiError command:

Bot.sendMessage(
  "We have error with Coinbase API. Please try later. " +
  options.error // error message from Coinbase Api
)

Bot.sendMessage(
  options.http_status + " " + JSON.stringify(options.result)
)

if you do not have onError command error will be tracked in Eror Tab.

Typical errors

All Coinbase API method available .

For example for method we need 2 commands: /create and /onCreate

You need to setup Api key. Please see step 3 in .

here
create new address
setup
coinbase.com
Register
page