Automate Speckle

Hey there @Designer_London! :waving_hand:t3:

Welcome to the community! If you haven’t already, feel free to Introduce yourself 🙆 (or not… no pressure :wink:)

As I understand it, you want to be able to create a “service” that listens to specific actions and executes a task accordingly. This is certainly possible, although I would say it’s going to get waaay better (hopefully) very soon.

The core functionality of the script

This can be done by our C# and Python SDKs, basically you’d need to:

  • Run a script that would start listening to the desired event (in your case, it would be every time a commit is created in a specific stream)
  • Whenever the event gets raised:
    • Get the latest information from that stream.
    • Process that information in any way you need
    • Upload the new objects
    • Create a new commit.

Currently, the python SDK has limited capability for listening to events, but the C# SDK (aka Speckle.Core) does. We’ll update python soon with the missing ones.

As for listening to events…

2 Ways of listening to events

GraphQL Subscriptions

Currently, interacting with the server is done using our graphql API. The api includes subscriptions, events that you can listen to and get notified whenever something happens (like a commit creation).

This is how we are displaying branch and stream creation notifications in the Speckle Web App.

It works great on end user scenarios, where you can keep a connection open and listening actively, but it’s not ideal when you want a “service” that works 24/7.

Webhooks

This is an upcoming feature and is not yet available (but will be very soon :crossed_fingers:t3:).

We’re currently adding the capability to set up webhooks, which would allow you to “tell” the server to execute a call to a specific url (wherever your service lives). This way you don’t have to keep a live connection to “listen” to the events.

We’ll announce when this feature gets released.

2 Likes