steamship.experimental.transports package#

Submodules#

steamship.experimental.transports.steamship_widget module#

class steamship.experimental.transports.steamship_widget.SteamshipWidgetTransport(client)[source]#

Bases: Transport

Experimental base class to encapsulate a Steamship web widget communication channel.

steamship.experimental.transports.telegram module#

class steamship.experimental.transports.telegram.TelegramTransport(bot_token: str, client: Steamship)[source]#

Bases: Transport

Experimental base class to encapsulate a Telegram communication channel.

api_root: str#
bot_token: str#

steamship.experimental.transports.transport module#

class steamship.experimental.transports.transport.Transport(client)[source]#

Bases: ABC

client#

Experimental base class to encapsulate a communication channel

Intended use is:

class MyBot(PackageService):

transport: Transport

def __init__(self):

self.transport = TelegramTransport(bot_token=self.config.telegram_bot_token)

def instance_init(self):

webhook_url = self.context.invocable_url + ‘respond’ self.transport.instance_init(webhook_url=webhook_url)

def respond(self):

self.transport.send(blocks=[Block(text=”Got it!”)], chat_id=”abc”)

Note that this experimental sketch is just a first draft. Among its quirks:

  • The idea of re-using Blocks as the medium of message format, which aligns chatting with the rest of our code. - For example, to send back an image, one would do so via a block.

  • It doesn’t yet try to model inbound messages or chat_ids. That’s an encapsulation leak left for future exploration.

alias of Steamship

info() dict[source]#
instance_deinit(*args, **kwargs)[source]#
instance_init(*args, **kwargs)[source]#
parse_inbound(payload: dict, context: Optional[dict] = None) Optional[Block][source]#
send(blocks: List[Block], metadata: Dict[str, Any])[source]#

Module contents#

class steamship.experimental.transports.TelegramTransport(bot_token: str, client: Steamship)[source]#

Bases: Transport

Experimental base class to encapsulate a Telegram communication channel.

api_root: str#
bot_token: str#
class steamship.experimental.transports.Transport(client)[source]#

Bases: ABC

client#

alias of Steamship

info() dict[source]#
instance_deinit(*args, **kwargs)[source]#
instance_init(*args, **kwargs)[source]#
parse_inbound(payload: dict, context: Optional[dict] = None) Optional[Block][source]#
send(blocks: List[Block], metadata: Dict[str, Any])[source]#