How to put together blueprints to run a scenario with API

Hey guys,

Has anyone ever used the API to create scenarios? How do I go about creating the blueprint for the scenario as well as adding the connections and all that?

@zezutom might have some input here.

1 Like

Hi guys,
Yup, I will soon publish a repository with Java / Kotlin / JS client for the Make API. It will allow to create scenarios, fetch details about scenario modules and also update modules within a scenario.

2 Likes

Hello @zezutom , how is the project going so far ? I am also looking forward to create scenario dynamically so this feature would be awesome

2 Likes

hi @Albanmana ,
Glad you asked! Check my post here and please let me know your thoughts. :slight_smile:

2 Likes

Thank you @zezutom , well explained and practical :ok_hand:

Unfortunately I am not really familiar with the coding language you used in the video, and generating a blueprint then importing it might be fastidious in the long run.

What I was looking for is a way to clone scenarios via an HTTP Request, I already figured out how to do it (attachement), but I am having trouble changing the connexions (like webhooks). Any ideas on how to do it ?



Thank you for your feedback @Albanmana.

In the demo I copied json manually to keep things nice and simple. But in reality I am already working on a HTTP client that would leverage Make’s API - just like in your example.

You see, the advantage of having an SDK is that it “understands” the structure of the scenario. Without this insight, you have to resort to parsing JSON and look for specific properties on your own. Make’s API allows you to upload the entire blueprint, but AFAICS there is no way to update individual modules within the blueprint. Please feel free to prove me wrong, it would be great news to me.

In terms of coding language I used Kotlin. I understand this is a fairly niche language. Would you consider using the SDK if it was coded in JavaScript?

1 Like

Actually you gave me an idea. My HTTP client could use the SDK internally and expose an API that would satisfy your need.

For example, your current use case seems to be “clone a scenario and update some of its modules”.

In this case you would use my HTTP client roughly like this (just a pseudo-code):

MakeHttpClient("your api key", "your team id", "your org id")
.cloneBlueprint("blueprint.json")
.withChangedModule("your module id or name", "hook" -> "21. Hook ID")
.sendRequest()

The code above would upload an updated version of your blueprint.

What do you think?

1 Like

I have a scenario that creates new scenarios from a blueprint, but also creates a new Slack webhook, and sets that as the trigger and turns the scenario on.
The biggest issue I ran into was forming the post request for the new scenario using JSON that contained both dyamically updated fields, as well as IML from the original blueprint. If you try to just include the whole blueprint, the interface has a bit of a meltdown because it tries to reference any IML to a module that doesn’t exist (or worse, one that does).
My workaround was to import the parts of the blueprint with static IML from Google sheets, and the rest I would update dynamically and then splice them together in the POST request. Kind of a hack I guess, and hard to maintain, but otherwise works reliably.

2 Likes