Skip to main content

Provides Node, Hook and PostRequests that follow the btProtocol.

Project description

Blackout Nexus Node for Python

Blackout logo

Author Adrian Lubitz
Author Marc Fiedler
Required Instance versions >= 3.0
Runs on Python 2.7+ or Python 3.6+
State Stable


  • Python installed (either 2.7+ or Python 3.6+)
  • Owner of a btNexus instance or a btNexus account

Install btnexus-node-python

pip install btnexus-node-python

If you need to install a specific version use

pip install btnexus-node-python==[VERSION]

API Documentation

You find an API Documentation our GitHub Page


The nexus by Blackout Technologies is a platform to create Digital Assistants and to connect them via the internet to multiple platforms. Those platforms can be websites, apps or even robots. The nexus consists of two major parts, first being the btNexus and second the nexusUi. The btNexus is the network that connects the A.I. with the nexusUi and the chosen interfaces. The nexusUi is the user interface, that allows the user to create their own A.I.-based Digital Assistant. Those Digital Assistants can be anything, support chatbots or even robot personalities.
Every user has one or multiple nexusUi instances or short nexus instances, which means, it's their workspace. One nexusUi / nexus instance can host multiple personalities.

Every part of the btNexus is a Node. These Nodes can react on messages and send messages through the btNexus. To understand how Nodes work the following key concepts need to be clear.


Nodes are essentially little programs. It is not important in which language these programs are implemented. More important is that they share Messages between them in certain Groups and Topics. So every node has its very unique purpose. It reacts on Messages with a Callback which is subscribed to a Group and a Topic and also sends Messages to the same and/or other Group and Topic to inform other Nodes, what is happening.


Messages are the media of communication between Nodes. A Message contains a name for a Callback and the corresponding parameters. A Message is send on a specific Group and Topic, so only Callbacks that subscribed to this Group and Topic will react.


Callbacks are functions which serves as the reaction to a Message on a specific Topic in a specific Group. Every Callback returns a Message to the btNexus with the name of the origin Callback + _response. So a Node can also subscribe to the response of the Message send out.

Topics & Groups

Topics and Groups help to organize Messages. A Callback can only be mapped to one Group and Topic.

Example Nodes

Following you will see an example of a Node which sends out the current minute and second every five seconds.

"""Example for a Node that sends out messages"""
# System imports
from threading import Thread
import datetime
import time
import os
# 3rd party imports
from btNode import Node

# local imports

class SendingNode(Node):
    This Node shows how to implement an active Node which sends different Messages
    def onConnected(self):
        This will be executed after a the Node is succesfully connected to the btNexus
        Here you need to subscribe and set everything else up.

        :returns: None
        self.shouldRun = True
        self.subscribe(group="exampleGroup",topic="example", callback=self.fuseTime_response) # Here we subscribe to the response of messages we send out to fuseTime
        self.thread = Thread(target=self.mainLoop)
        self.thread.start() # You want to leave this method so better start everything which is actively doing something in a thread.
    def fuseTime_response(self, orignCall ,originParams, returnValue):
        Reacting to the fused Time with a print in a specific shape.
        responseCallbacks always have the following parameters.

        :param orignCall: The name of the orignCall
        :type orignCall: String
        :param originParams: The parameters given to the orignCall
        :type originParams: List or keywordDict
        :param returnValue: The returned Value from the orignCall
        :type returnValue: any
        :returns: None
        print("[{}]: {}".format(self.__class__.__name__, returnValue))

    def mainLoop(self):
        Sending currenct minute and second to the ListeningNode on the printMsg and fuse callback.

        :returns: Never
        #Make sure the thread terminates, when reconnecting
        #otherwise onConnected will spawn another
        #and you will end up with n threads, where n is the number of connects
            now =
            self.publish(group="exampleGroup", topic="example", funcName="printTime", params=[now.minute, now.second])
            self.publish(group="exampleGroup", topic="example", funcName="fuseTime", params={"min":now.minute, "sec":now.second})

    def cleanUp(self):
        Make sure the thread terminates, when reconnecting
        otherwise onConnected will spawn another
        and you will end up with n threads, where n is the number of connects
        super(SendingNode, self).cleanUp()
        self.shouldRun = False
        except AttributeError:
            pass # This only happens if onConnected was never called before - Node was never connected correctly and therefore closes the connection and calls the cleanUp

if( __name__ == "__main__" ):
    #Here you initialize your Node and run it.
    sendingNode = SendingNode() # CONNECT_HASH needs to be in .btnexusrc or environment variable CONNECT_HASH
    sendingNode.connect() # This call is blocking

The ListeningNode and all further examples can be seen in the examples folder.

Implement your own Node

First you need know the purpose of your Node. Nodes should be small and serve only one purpose. To implement your own Node you need to inherit from the Node class, implement your callbacks and if you are actively doing something implement your Threads, that for example read in sensor data. See the examples to get started ;) Keep in mind, that you need to set the CONNECT_HASH in your .btnexusrc or the environment variable CONNECT_HASH. If you are using Anaconda you can integrate those into your virtual environment(


  • Since Version 4 the protocol was changed to completely use socketIO - Therefore it only works with Dynamic Davinci (Instance Version 2.2)

  • Since Version 5, Nodes and all inheriting classes (Hooks, Integrations) use a CONNECT_HASH which can be obtained from the Instance and should be given in the file .btnexusrc or the environment variable CONNECT_HASH (The latter overwrites the first). Additionally a package.json file is needed. It should be minimal the following:

        "name": "test",
        "title": "Test",
        "description": "This is just a test",
        "type": "integration",
        "keywords": [
        "version": "0.2.3",
        "nexusVersion": "2.2",
        "license": "See attached LICENSE file",
        "author": {
            "name": "Adrian Lubitz",
            "url": "",
            "email": ""
  • Since Version 6 all Nodes are able to connect to 3.0 Instances

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for btnexus-node-python, version 6.3.233
Filename, size File type Python version Upload date Hashes
Filename, size btnexus-node-python-6.3.233.tar.gz (29.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page