Execute a bot
import botfleet
botfleet.api_key = "YOUR_API_KEY"
bot = botfleet.Bot.retrieve(id="15d19ca3-26f1-4adb-9cea-3955b73d9b4e")
bot.execute(wait=True, payload={"foo": "bar"})
If wait
is set to True
, the method will wait for the bot to finish executing and return a Execution
object. If wait
is set to False
, the method will return a BotExecutorJob
object immediately.
payload
is an optional parameter that can be used to pass data to the bot. The bot can access the payload via the request
parameter:
def main(request, store):
print(request.payload["foo"]) # prints "bar"