Use Custom Webhook to Activate Email Processing

Greetings All,

I am new to Make so apologies if this is a silly question.

I have a Google Workspace Email that will be receiving emails. I set it up so that each time an email is received, it will activate a webhook to call the Make Custom Webhook.

I cannot figure out how to get ‘some’ Make email processor to process the new emails when the Make custom webhook receives a message. I have attached a modified image of what I would like the processing to look like.

Any pointers would be welcome.

Thanks very much!!

Paul

Welcome to the Make community!

If you want to use a custom webhook to trigger this scenario, then you cannot use the Gmail integration.

Use the generic Email integration instead, as it has a “Search” module called “Get Emails”

However, you should simply just use the Custom MAILHOOK module instead, which is also compatible with Gmail.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Thank you, @samliew. I will definitely try the Custom Mailhook.

I will report back.

Thanks again!!

Paul

@samliew,

I have made several attempts to utilize the Custom Mailhook.

Initially, I attempted to set up a webhook trigger in Google Workspace as follows:

function triggerMakeWebhookForNewEmails() {
  Logger.log("Script started");

  // Fetch up to 5 unread email threads to avoid excessive requests
  const threads = GmailApp.search("is:unread", 0, 5);

  threads.forEach(thread => {
    const messages = thread.getMessages();

    messages.forEach(message => {
      if (!message.isUnread()) return; // Only process unread messages

      Logger.log("Found an unread email");

      // Create a form payload with email details
      const payload = {
        "subject": message.getSubject(),
        "body": message.getPlainBody(),
        "from": message.getFrom(),
        "to": message.getTo(),
        "date": message.getDate().toISOString() // Convert date to string format
      };

      const options = {
        method: "post",
        payload: payload // Send as form data (not JSON)
      };

      // Make.com webhook URL
      const response = UrlFetchApp.fetch("https://hook.us2.make.com/XXXXX", options);
      Logger.log("Webhook sent to Make.com");
    });
  });
  Logger.log("Script completed");
}

Even after getting the trigger to fire, it seemed that no data was passing to the mailhook module. So I am unclear as to whether the data needs to be passed or if the trigger simply tells the mailhook to start processing the mailbox.

Likewise, I tried forwarding the email to the webhook (URL / Email Address), but I still did not see any data passing through.

UrlFetchApp.fetch("https://XXXXX@hook.us2.make.com", options);

The online help was a bit vague on this account.

Is it possible that there is a video that explains this process in some detail?

Thanks very much!!

Paul

HI Paul, did you get a response to your query?

I am also having issues with the custom mailhook. I can’t tell why it’s not being triggered.

I’m trying to send a certain type of email from my hotmail/outlook account to the convertkit module.

Any advice would be appreciated!

Selda