Make a Bitcoin Chatbot
Getting Started
The methods will slightly differ depending on where you want to do it, here are some tutorials to get you started:
General Hooks
Some is some example code using the to get you started, using the mempool API
import requests
def getBlockheight():
url = "https://mempool.space/api/blocks/tip/height"
try:
r = requests.get(url)
print("The current block height is: ", r.content.decode('utf-8'))
except requests.ConnectionError:
print("There was an error getting this.")
import requests
import json
def getFees():
url = "https://mempool.space/api/v1/fees/recommended"
try:
r = requests.get(url)
nl = '\n'
fees = json.loads(r.text)
print(f"The Current Fees are: {nl}Fast: {fees['fastestFee']} sat/byte,{nl}1-hour: {fees['hourFee']} sat/byte, {nl}Minimum: {fees['minimumFee']} sat/byte")
except requests.ConnectionError:
print("There was an error getting this.")