← Google Cloud + Discord Webhook integrations

Send Message with Discord Webhook API on BigQuery - New Row from Google Cloud API

Pipedream makes it easy to connect APIs for Discord Webhook, Google Cloud and 800+ other apps remarkably fast.

Trigger workflow on
BigQuery - New Row from the Google Cloud API
Next, do this
Send Message with the Discord Webhook API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Google Cloud trigger and Discord Webhook 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 BigQuery - New Row trigger
    1. Connect your Google Cloud account
    2. Configure Polling interval
    3. Configure Event Size
    4. Select a Dataset ID
    5. Select a Table Name
    6. Select a Unique Key
  3. Configure the Send Message action
    1. Connect your Discord Webhook account
    2. Configure Message
    3. Optional- Configure Thread ID
    4. Optional- Configure Username
    5. Optional- Configure Avatar URL
    6. Optional- Configure Include link to workflow
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger


This integration uses pre-built, open source 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.


Description:Emit new events when a new row is added to a table

Trigger Code

import crypto from "crypto";
import { isString } from "lodash-es";
import googleCloud from "../../google_cloud.app.mjs";
import common from "../common/bigquery.mjs";

export default {
  key: "google_cloud-bigquery-new-row",
  // eslint-disable-next-line pipedream/source-name
  name: "BigQuery - New Row",
  description: "Emit new events when a new row is added to a table",
  version: "0.1.3",
  dedupe: "unique",
  type: "source",
  props: {
    tableId: {
      propDefinition: [
        ({ datasetId }) => ({
    uniqueKey: {
      type: "string",
      label: "Unique Key",
      description: "The name of a column in the table to use for deduplication. See [the docs](https://github.com/PipedreamHQ/pipedream/tree/master/components/google_cloud/sources/bigquery-new-row#technical-details) for more info.",
      async options(context) {
        const { page } = context;
        if (page !== 0) {
          return [];

        const columnNames = await this._getColumnNames();
        return columnNames.sort();
  hooks: {
    async deploy() {
      await this._validateColumn(this.uniqueKey);
      const lastResultId = await this._getIdOfLastRow(this.getInitialEventCount());
    async activate() {
      if (this._getLastResultId()) {
        // ID of the last result has already been initialised during deploy(),
        // so we skip the rest of the activation.

      await this._validateColumn(this.uniqueKey);
      const lastResultId = await this._getIdOfLastRow();
    deactivate() {
  methods: {
    _getLastResultId() {
      return this.db.get("lastResultId");
    _setLastResultId(lastResultId) {
      this.db.set("lastResultId", lastResultId);
        Next scan of table '${this.tableId}' will start at ${this.uniqueKey}=${lastResultId}
     * Utility method to make sure that a certain column exists in the target
     * table. Useful for SQL query sanitizing.
     * @param {string} columnNameToValidate The name of the column to validate
     * for existence
    async _validateColumn(columnNameToValidate) {
      if (!isString(columnNameToValidate)) {
        throw new Error("columnNameToValidate must be a string");

      const columnNames = await this._getColumnNames();
      if (!columnNames.includes(columnNameToValidate)) {
        throw new Error(`Nonexistent column: ${columnNameToValidate}`);
    async _getColumnNames() {
      const table = this.googleCloud
      const [
      ] = await table.getMetadata();
      const { fields } = metadata.schema;
      return fields.map(({ name }) => name);
    async _getIdOfLastRow(offset = 0) {
      const limit = offset + 1;
      const query = `
        SELECT *
        FROM \`${this.tableId}\`
        ORDER BY \`${this.uniqueKey}\` DESC
        LIMIT @limit
      const queryOpts = {
        params: {
      const rows = await this.getRowsForQuery(queryOpts, this.datasetId);
      if (rows.length === 0) {
          No records found in the target table, will start scanning from the beginning

      const startingRow = rows.pop();
      return startingRow[this.uniqueKey];
    getQueryOpts() {
      const lastResultId = this._getLastResultId();
      const query = `
        SELECT *
        FROM \`${this.tableId}\`
        WHERE \`${this.uniqueKey}\` >= @lastResultId
        ORDER BY \`${this.uniqueKey}\` ASC
      const params = {
      return {
    generateMeta(row, ts) {
      const id = row[this.uniqueKey];
      const summary = `New row: ${id}`;
      return {
    generateMetaForCollection(rows, ts) {
      const hash = crypto.createHash("sha1");
        .map((i) => i[this.uniqueKey])
        .map((i) => i.toString())
        .forEach((i) => hash.update(i));
      const id = hash.digest("base64");

      const rowCount = rows.length;
      const entity = rowCount === 1
        ? "row"
        : "rows";
      const summary = `${rowCount} new ${entity}`;

      return {

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.
Google CloudgoogleCloudappThis component uses the Google Cloud app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between component invocations.
Polling intervaltimer$.interface.timer

How often to run your query

Event SizeeventSizeinteger

The number of rows to include in a single event (by default, emits 1 event per row)

Dataset IDdatasetIdstringSelect a value from the drop down menu.
Table NametableIdstringSelect a value from the drop down menu.
Unique KeyuniqueKeystringSelect a value from the drop down menu.

Trigger Authentication

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

1) Create a service account in GCP and set the permissions you need for Pipedream workflows.

2) Generate a service account key

3) Download the key details in JSON format

4) Open the JSON in a text editor, and copy and paste its contents here.

About Google Cloud

The Google Cloud Platform


Description:Send a simple message to a Discord channel

Action Code

import common from "../send-message-common.mjs";

export default {
  key: "discord_webhook-send-message",
  name: "Send Message",
  description: "Send a simple message to a Discord channel",
  version: "0.3.0",
  type: "action",
  props: {
  async run({ $ }) {
    const {
    } = this;

    try {
      // No interesting data is returned from Discord
      await this.discordWebhook.sendMessage({
        content: includeSentViaPipedream
          ? this.appendPipedreamText(message)
          : message,
      $.export("$summary", "Message sent successfully");
    } catch (err) {
      const unsentMessage = this.getUserInputProps();
      $.export("unsent", unsentMessage);
      throw err;

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.

Discord WebhookdiscordWebhookappThis component uses the Discord Webhook app.

Enter a simple message up to 2000 characters. This is the most commonly used field. However, it's optional if you pass embed content.

Thread IDthreadIDstring

If provided, the message will be posted to this thread


Overrides the current username of the webhook

Avatar URLavatarURLstring

If used, it overrides the default avatar of the webhook

Include link to workflowincludeSentViaPipedreamboolean

Defaults to true, includes a link to this workflow at the end of your Discord message.

Action Authentication

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

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


About Discord Webhook

Use this app to send messages to a channel using Discord's incoming webhooks

More Ways to Connect Discord Webhook + Google Cloud