How to send a message to a Discord channel via HTTP when a Google Sheet is updated

Scenario: Update data in a Google Sheet to send a message to a Discord channel via the HTTP module. This scenario watches an existing Google Sheet and is triggered when data from a row is modified.

Level of difficulty: Easy

Implementation Time: Approximately 20 Minutes

Prerequisites: The following is needed to set up this scenario:

  • A Google Sheet with column names and existing data.

  • A Discord account with permission to manage webhooks for a text channel.

The scenario for this tutorial contains only two modules and looks like this:

how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-1.png

  1. Configure your sheet.

    As mentioned under prerequisites, you must have a Google Sheet configured with column names and some sample data. If you don’t, please create one before you proceed. This is what mine looks like:

    how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-2.png
  2. Create a Webhook in your Discord Channel

    Discord gives you the ability to create one or more webhooks for each text channel. If you’re not familiar with the process, follow the 3-step instructions below or else, jump to Step 3.

    • Under TEXT CHANNELS, click the settings icon next to the channel name:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-3.png
    • Head over to the Webhooks tab from the left menu and click the button labelled Create Webhook:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-4.png
    • Give the Webhook a name, copy the webhook URL, and click Save:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-5.png

    Keep this URL handy, we will need it while setting up the HTTP module in our Boost.space Integrator scenario.

  3. Head over to your Boost.space Integrator dashboard to create a new scenario.

    • Click the big question mark to set up Google Sheets as the first module and select Watch a worksheet as the trigger.

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-6.png
    • Choose your Google connection or add a new one followed by selecting a file (the sheet you created earlier) and the worksheet in the file that contains the sample data. Under Maximum number of returned rows, type in the number of messages you’d like to send every time the scenario runs. If you’d like to send a separate message for each updated row, type in 1 as shown below:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-7.png
    • After clicking OK, you’ll see another dialog box asking you to either enter the row number from which you’d like the module to start looking for updates or select All rows.

      [Note] Note

      The first row or header row is always assumed to contain the column names. Hence, if you enter 1, entries will be watched starting the row below the header row.

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-8.png
  4. Configure the HTTP module as the Action

    The HTTP module is the second and the last module in the scenario that performs the action of sending a message to a discord channel.

    • Search for the HTTP module and select Make a request as the action:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-9.png
    • Under URL, paste the Webhook URL obtained from the Discord channel earlier.

    • Under Method, select POST.

    • Under Body Type, select Raw.

    • Under Content Type, select JSON (application/json).

    • Finally, under Request Content, type in the message to be sent to the channel as a JSON payload as per Discord’s API. To send a message (string), the Field type is content, hence the JSON payload should be written as follows:

      “content” : “Houston, this is a message for Discord”

      Click here to learn more about executing webhooks on Discord.

      Since the trigger is a Google Sheet with columns containing data, we can use the column names to include the contents of each cell in the message that is sent to the channel. We may also use line breaks (\n) in the message. Below is what I have composed:

      “content” : “**Incoming Status Update**\nName: {{firstname}} {{lastname}}\nMission: {{mission}}\nStatus: {{status}}”

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-10.png
    • Click OK to complete the scenario. You must save the scenario and toggle the Scheduling switch to ON.

    • To define the schedule for the scenario, click the little clock icon next to the toggle switch or the big clock animation on the Google Sheets module image as shown below:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-11.png
    • You may also rename the modules and add notes under each by right-clicking the module image:

      how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-12.png

    That’s it. Now update some data in your sheet and run your module once to make sure everything works fine as shown below:

    how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-13.png
    how-to-send-message-Discord-channel-HTTP-when-Google-Sheet-updated-14.png

Hope you were able to implement this scenario with ease.