# Instant Trigger

By setting Instant Trigger, it allows Integromat scenario to receive generated image immediately.

Stencil supports this feature out of the box and setting it up requires minimal effort. For now Instant Trigger support is scoped per template.

{% hint style="info" %}
Integromat's Instant Triggers execute the flow immediately after the remote server sends data. It is powered by webhooks.&#x20;
{% endhint %}

## Requirements

1. Instant Trigger's webhook URL
2. A working template in Stencil

## Recommended Approach

This approach scopes the Instant Trigger on template level. That means all images generated from this template will trigger Integromat Instant Trigger.

### 1. Set Trigger in scenario

![](/files/-MeX0Cg9PsVU5d3AZcSe)

In your scenario editor, select Image Generated trigger from the list of available modules. This allows Integromat to listen for data coming from Stencil.

{% hint style="warning" %}
Instant Trigger must be the first module in scenario
{% endhint %}

### 2. Set up Trigger webhook

Add a new webhook or use existing webhook based on your need. Then copy the given webhook URL.

![](/files/-MeX1lDLr5SOZfwx3iEW)

### 3. Set Trigger webhook in Stencil's Console

Go back to Stencil's webapp, select the template that you want to integrate with Integromat.

Then, go to its console and select Integromat under the Integrations tab.&#x20;

Paste the webhook URL from the previous step to the input box. Make sure your save your changes.

![Integromat integration section in Console](/files/-MeX2oaFOg7vpiYU6UZ2)

Congratulations! You have successfully set up your Integromat Instant Trigger. We've told you that it's going to be easy.

### 4. Test your changes (optional)

#### Test scenario

For testing purpose, I've setup my scenario to look like this. The trigger is linked to a `Get multiple variables` module (Integromat's tools module) and will capture two variables from the output of the trigger.

![](/files/-MeX4XQ9UiQGcG56Lw7V)

Once you've got that set up, run the scenario and it will start listening for data.

#### Sending data from Console

Go to your template's Console page that is linked to the trigger. Use the Test API tool to send a request to generate image.

![Sample request sent through Console](/files/-MeXXQ4vH1oQXA9rPBVG)

If image is generated successfully, you should see similar output in your trigger module.

![Instant Trigger module successfully received data being sent from Stencil.](/files/-MeXWxps30CTd8PvcZ9g)

### Alternative approach

The other approach to trigger instant trigger is by setting the `webhook_url` field with Integromat's Dedicated Instant Trigger webhook URL when generating the image.

{% tabs %}
{% tab title="POST <https://api.usestencil.com/images>" %}

```javascript
{
  "template": "68b168a8-17e8-4702-92fd-838c019bc3ec",
  "modifications": [
    {
      "name": "text_1",
      "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do..."
    }
  ],
  "webhook_url": "https://hook.integromat.com/2rxxxxxxxxxxxxxxxxxxxx"
}
```

{% endtab %}
{% endtabs %}

The downside of this approach is that you would have to set this each time you generate the image.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usestencil.com/integrations/integromat-integration/instant-trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
