This version has been deprecated. If used with the current API version it can produce unexpected behaviour or errors.

The package shimoku-api-python is no longer maintained

To get the new version 🤖

pip install --upgrade shimoku-api-python

This is a small but very important version, as it includes the tools necessary for handling generic AI and complex tasks!


  • The SDK has been adapted to python 3.9, there was an async feature that was only available on python 3.10 >=, but now it has been resolved, so there are no compatibility issues with version 3.9.


  • The Shimoku module now includes an exciting new feature - activities and runs! This addition allows users to trigger webhooks through Shimoku's API, making it easier than ever to create complex AI and data workflows. For example, you can now create a complete lead scoring prediction page, with your data, with just a single line of code.

    The process of linking a webhook to an activity will be handled internally for the time being, but if you have a specific task in mind, don't hesitate to reach out to us!

    With this new feature, you can create multiple runs for each activity, each run being a single execution with unique settings. You can also keep track of everything with run logs. The Shimoku module provides several methods to make the most of activities and runs, including:

    • Get the activities available in your business using get_business_activities

    • Interact with a specific business using set_business

    • Create a new activity using create_activity

    • Update an existing activity using update_activity

    • Delete an activity using delete_activity

    • Create a new run from an activity and execute it using execute_activity

    • Retrieve an activity from your business using get_activity

    • Get all activities from the app using get_activities

    • Create a new run for an activity using create_run

    • Execute a run for an activity using execute_run

    • Create a new run log to keep track of everything using create_run_log

    In the next example it will be shown how to use these methods to create and manipulate runs and activities:

    s = Shimoku.Client(
    menu_path = 'test_activity'
    activity_name = 'test_activity'
    # To create an activity the location and the activity name is needed,
    # the returned value is a dictionary
    activity = s.activity.create_activity(menu_path, activity_name)
    # To create a run just pass the location, the activity name and its settings
    # the returned value is a dictionary
    settings = {'Test': 'settings', 'Settings': 'test'}
    run = s.activity.create_run(menu_path, activity_name, settings)
    # When creating a run you can copy the settings of another run by passing the id
    run_1 = s.activity.create_run(menu_path, activity_name, settings=run['id'])
    # For the creation a log you have to provide the path, the activity, the run id
    # and the information that you want to store.
    # the severity parameter can only have so many values (['INFO', 'DEBUG', 'ERROR', 'CRITICAL'])
    log = s.activity.create_run_log(menu_path, activity_name, run_id=run['id'],
        message='test message', severity='INFO', tags=['tag1', 'tag2', 'tag3'])
    # to retrieve an activity that already exists use the method get_activity, passing
    # the same parameters as for create_activity
    # you can specify how many runs to get, by default it will retrieve one run
    activity = s.activity.get_activity(menu_path, activity_name, how_many_runs=2)
    # the runs are returned by ascending order of their last log
    [run_1, run] = activity['runs']
    # this way you can retrieve the logs of a run
    logs = run['logs']
    # This way you can delete an activity
    s.activity.delete_activity(menu_path, activity_name)

    In order to execute an activity it has to be linked to a webhook, the next example expects that the activity in use has a webhook attached:

    # The function execute activity creates a run and then executes the run
    # the return value is the dictionary of the run
    run = s.activity.execute_activity(menu_path, activity_name, settings)
    # You can pass settings the same way as when creating a run
    run_1 = s.activity.execute_activity(menu_path, activity_name, settings=run['id'])
    # Another way of executing a run is with it's id
    run_2 = s.activity.create_run(menu_path, activity_name, settings=run['id'])
    s.activity.execute_run(menu_path, activity_name, run_id=run['id']

    When a run gets executed the API will automatically add a log indicating that the webhook has been called

    The webhook will no longer be attached after deleting an activity, we do not recommend deleting activities.

    A run can only be executed once.

    It has also been added the option to create a button in the dashboard to dinamically execute the activity. To use it call s.activity.button_execute_activity passing it with the traditional information of the s.plt.* methods. Like the other execute methods settings can be provided. It has a parameter named align which can be set with one of the follow options:

    start, center, right, stretch

    By default it will use stretch.

    The next example shows how to call this method in various ways:

            menu_path=menu_path, activity_name=activity_name, order=0, 
            label='test_button', cols_size=12, align='start'
        menu_path=menu_path, activity_name=activity_name, order=1, 
        label='test_button', cols_size=12, align='center'
        menu_path=menu_path, activity_name=activity_name, order=2, 
        label='test_button',rows_size=2, cols_size=12, align='right'
    for i in range(6):
            menu_path=menu_path, activity_name=activity_name, order=3+i, 
            label='test_button', rows_size=2, cols_size=12-i*2, align='stretch', 
        menu_path=menu_path, activity_name=activity_name, order=9, 
        label='test_button', cols_size=12, align='center'

    The result in the dashboard is:

Last updated