← Notion + Replicate integrations

Create Prediction with Replicate API on Page Updated from Notion API

Pipedream makes it easy to connect APIs for Replicate, Notion and 2,700+ other apps remarkably fast.

Trigger workflow on
Page Updated from the Notion API
Next, do this
Create Prediction with the Replicate API
No credit card required
Intro to Pipedream
Watch us build a workflow
Watch us build a workflow
8 min
Watch now ➜

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo

Developers Pipedream

Getting Started

This integration creates a workflow with a Notion trigger and Replicate action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the Page Updated trigger
    1. Connect your Notion account
    2. Configure timer
    3. Configure infoLabel
    4. Select a Page ID
  3. Configure the Create Prediction action
    1. Connect your Replicate account
    2. Select a Collection Id
    3. Select a Model Id
    4. Select a Model Version
    5. Configure Input
    6. Optional- Configure Webhook
    7. Optional- Select one or more Webhook Events Filter
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, source-available components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emit new event when a selected page is updated. [See the documentation](https://developers.notion.com/reference/page)
Version:0.0.8
Key:notion-updated-page-id

Notion Overview

Notion's API allows for the creation, reading, updating, and deleting of pages, databases, and their contents within Notion. Using Pipedream's platform, you can build workflows that connect Notion with various other services to automate tasks such as content management, task tracking, and data synchronization. With Pipedream's serverless execution, you can trigger these workflows on a schedule, or by external events from other services, without managing any infrastructure.

Trigger Code

import notion from "../../notion.app.mjs";
import base from "../common/base.mjs";
import constants from "../common/constants.mjs";

export default {
  ...base,
  key: "notion-updated-page-id",
  name: "Page Updated", /* eslint-disable-line pipedream/source-name */
  description: "Emit new event when a selected page is updated. [See the documentation](https://developers.notion.com/reference/page)",
  version: "0.0.8",
  type: "source",
  dedupe: "unique",
  props: {
    ...base.props,
    infoLabel: {
      type: "alert",
      alertType: "info",
      content: "Ensure the selected page is shared with your Pipedream integration to receive events.",
    },
    pageId: {
      propDefinition: [
        notion,
        "pageId",
      ],
    },
  },
  async run() {
    const page = await this.notion.retrievePage(this.pageId);

    if (this.isResultNew(page.last_edited_time, this.getLastUpdatedTimestamp())) {
      const meta = this.generateMeta(
        page,
        constants.types.PAGE,
        constants.timestamps.LAST_EDITED_TIME,
        constants.summaries.PAGE_UPDATED,
        true,
      );

      this.$emit(page, meta);
      this.setLastUpdatedTimestamp(Date.parse(page.last_edited_time));
    }
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
NotionnotionappThis component uses the Notion app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between executions.
timer$.interface.timer
Page IDpageIdstringSelect a value from the drop down menu.

Trigger Authentication

Notion uses OAuth authentication. When you connect your Notion account, Pipedream will open a popup window where you can sign into Notion and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Notion API.

Pipedream requests the following authorization scopes when you connect your account:

About Notion

Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.

Action

Description:Create a new prediction [See the documentation](https://replicate.com/docs/reference/http#predictions.create)
Version:0.0.1
Key:replicate-create-prediction

Replicate Overview

The Replicate API allows you to access a wide array of machine learning models for tasks such as image generation, text-to-image, and more. Using Pipedream, you can orchestrate these models to automate content creation, analyze media, or enhance data with AI-generated insights. Pipedream's serverless platform empowers you to create workflows that react to events, schedule tasks, and integrate with numerous other services, all harnessing the power of Replicate's AI models.

Action Code

import replicate from "../../replicate.app.mjs";

export default {
  key: "replicate-create-prediction",
  name: "Create Prediction",
  version: "0.0.1",
  description: "Create a new prediction [See the documentation](https://replicate.com/docs/reference/http#predictions.create)",
  type: "action",
  props: {
    replicate,
    collectionSlug: {
      propDefinition: [
        replicate,
        "collectionSlug",
      ],
    },
    modelId: {
      propDefinition: [
        replicate,
        "modelId",
        ({ collectionSlug }) => ({
          collectionSlug,
        }),
      ],
    },
    version: {
      propDefinition: [
        replicate,
        "modelVersion",
        ({ modelId }) => ({
          modelId,
        }),
      ],
    },
    input: {
      type: "string",
      label: "Input",
      description: "The model's input as a JSON object. The input depends on what model you are running. To see the available inputs, click the \"Run with API\" tab on the model you are running. For example, stability-ai/stable-diffusion takes prompt as an input.",
    },
    webhook: {
      type: "string",
      label: "Webhook",
      description: "An HTTPS URL for receiving a webhook when the prediction has new output.",
      optional: true,
    },
    webhookEventsFilter: {
      type: "string[]",
      label: "Webhook Events Filter",
      description: "By default, we will send requests to your webhook URL whenever there are new logs, new outputs, or the prediction has finished. [See de documentartion here](https://replicate.com/docs/reference/http#predictions.create--webhook_events_filter) for more details.",
      options: [
        "start",
        "output",
        "logs",
        "completed",
      ],
      optional: true,
    },
  },
  async run({ $ }) {
    const {
      replicate,
      version,
      input,
      webhook,
      webhookEventsFilter,
    } = this;

    const response = await replicate.createPrediction({
      $,
      data: {
        version,
        input: JSON.parse(input),
        webhook,
        webhook_events_filter: webhookEventsFilter,
      },
    });

    $.export("$summary", `A new prediction with Id: ${response.id} was successfully created!`);
    return response;
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
ReplicatereplicateappThis component uses the Replicate app.
Collection IdcollectionSlugstringSelect a value from the drop down menu.
Model IdmodelIdstringSelect a value from the drop down menu.
Model VersionversionstringSelect a value from the drop down menu.
Inputinputstring

The model's input as a JSON object. The input depends on what model you are running. To see the available inputs, click the "Run with API" tab on the model you are running. For example, stability-ai/stable-diffusion takes prompt as an input.

Webhookwebhookstring

An HTTPS URL for receiving a webhook when the prediction has new output.

Webhook Events FilterwebhookEventsFilterstring[]Select a value from the drop down menu:startoutputlogscompleted

Action Authentication

Replicate uses API keys for authentication. When you connect your Replicate account, Pipedream securely stores the keys so you can easily authenticate to Replicate APIs in both code and no-code steps.

Sign in and copy your API key directly from your dashboard.

About Replicate

Run machine learning models in the cloud.

More Ways to Connect Replicate + Notion

Cancel Prediction with Replicate API on Updated Page ID from Notion API
Notion + Replicate
 
Try it
Get Model with Replicate API on Updated Page ID from Notion API
Notion + Replicate
 
Try it
Get Prediction with Replicate API on Updated Page ID from Notion API
Notion + Replicate
 
Try it
Get Model with Replicate API on New Page in Database from Notion API
Notion + Replicate
 
Try it
Get Model with Replicate API on Updated Page in Database from Notion API
Notion + Replicate
 
Try it
New Comment Created from the Notion API

Emit new event when a new comment is created in a page or block. See the documentation

 
Try it
New Database Created from the Notion API

Emit new event when a database is created. See the documentation

 
Try it
New or Updated Page in Database from the Notion API

Emit new event when a page is created or updated in the selected database. See the documentation

 
Try it
New Page in Database from the Notion API

Emit new event when a page is created in the selected database. See the documentation

 
Try it
Page or Subpage Updated from the Notion API

Emit new event when the selected page or one of its sub-pages is updated. See the documentation

 
Try it
Append Block to Parent with the Notion API

Append new and/or existing blocks to the specified parent. See the documentation

 
Try it
Create Comment with the Notion API

Create a comment in a page or existing discussion thread. See the documentation

 
Try it
Create Page with the Notion API

Create a page from a parent page. See the documentation

 
Try it
Create Page from Database with the Notion API

Create a page from a database. See the documentation

 
Try it
Duplicate Page with the Notion API

Create a new page copied from an existing page block. See the documentation

 
Try it

Explore Other Apps

1
-
0
of
2,700+
apps by most popular