steamship.experimental.transports package#
Submodules#
steamship.experimental.transports.steamship_widget module#
steamship.experimental.transports.telegram module#
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
Module contents#
- class steamship.experimental.transports.TelegramTransport(bot_token: str, client: Steamship)[source]#
Bases:
Transport
Experimental base class to encapsulate a Telegram communication channel.