Filtering data from webhook

Hi,

I am new to n8n and am trying to Webhook and Gmail nodes to send emails when webhook hits. However, I want Gmail to send emails only when certain conditions are fulfilled.

I am using Baserow wherein, if I select a checkbox then only email should be sent. Webhook will be hit whenever there is any update in the row. So, it should work only if checkbox is selected.

when a row is updated, Baserow webhook provides details of what were old values and what are new values. Considering I want to put a condition in filter that if Old Value of checkbox is false and New value of checkbox is true then only Gmail should send email.

I have set this IF node between two but looks like it is not working.

  1. This is workflow
    image

  2. This is IF condition
    image
    image
    image

However, when I do the process, it does not do anything.
Can someone help me?

Hi @pratik

Welcome to the community!
I see your condition is a string condition. This will not work with booleans.
You need to use the boolean filter:

1 Like

Thank you I will see if that works

Hi,

I tried using the boolean but the filter is not working and test data goes to the False branch.
image

Hi @pratik

Could you please share your workflow?

1 Like

Here is a workflow. I want to send email when there is update in row (exactly when checkbox is selected)

After executing IF node, all data goes to False branch.

You can select the workflow by dragging your cursor and then use ctrl+c ctrl+v to copy paste the workflow in the community. with the </> option you can add a code block when writing your text.

1 Like

I am not able to copy paste the workflow. Its giving me an error.


Is this because I am using Desktop app?

not sure what you are doing. You would need to do this:


Then when you let go of your left mouse button you can CTRL+C to copy.

then you click on this button and paste in that block that was added.

Thanks, this is exactly what I was doing earlier but it was not working. I restarted the app and its working now. Thank you for the instruction though.

Please let me know if I have done something wrong in the workflow.

Hi @pratik

Could you also give an example for the data that is pushed to the webhook?

{
    "table_id": "33eezLafG93GiBqgQlAP21",
    "event_type": "row.updated",
    "event_id": "00000000-0000-0000-0000-000000000000",
    "row_id": 0,
    "values": {
        "id": 0,
        "order": "1.00000000000000000000",
        "Entity Name": "",
        "Type of Entity": null,
        "CIN LLPIN": "",
        "ROC Code": null,
        "Registration Number": null,
        "Company Category": null,
        "Company Sub-category": null,
        "Class of Company": null,
        "Authorised Capital": null,
        "Paidup Capital": null,
        "Date of Incorporation": null,
        "Registered Office": "",
        "Registered Email id": "",
        "ACTIVE Compliant": false,
        "ACTIVE mca": "",
        "Date of Last AGM": null,
        "Date of Balance Sheet": null,
        "Entity Status": null,
        "Client Email Id": "",
        "Email Id 2": null,
        "List of Directors and Partners": [],
        "ROC": null,
        "Send Email": false,
        "Email": "",
        "Names of Directors": null
    },
    "old_values": {
        "id": 0,
        "order": "1.00000000000000000000",
        "Entity Name": "",
        "Type of Entity": null,
        "CIN LLPIN": "",
        "ROC Code": null,
        "Registration Number": null,
        "Company Category": null,
        "Company Sub-category": null,
        "Class of Company": null,
        "Authorised Capital": null,
        "Paidup Capital": null,
        "Date of Incorporation": null,
        "Registered Office": "",
        "Registered Email id": "",
        "ACTIVE Compliant": false,
        "ACTIVE mca": "",
        "Date of Last AGM": null,
        "Date of Balance Sheet": null,
        "Entity Status": null,
        "Client Email Id": "",
        "Email Id 2": null,
        "List of Directors and Partners": [],
        "ROC": null,
        "Send Email": false,
        "Email": "",
        "Names of Directors": null
    }
}

This is test data

Hi @pratik

This was a nasty one.
There is a space with one of your expressions.


You can see that value 1 of the second expression is empty. This shows it doesn’t find the actual value for the boolean.

image
Here it does show false, but you can see from the cursor there is a space. When you remove it, it will work fine.

image

1 Like

Thank you @BramKn You are Gem! Thank you so much for taking your time to look into this. It worked perfectly.

I am new to n8n, so much to learn for me.

1 Like

@BramKn I have one following question.

Is it possible if Gmail node can send emails from the Draft folder and values from webhook?

Hi @pratik

So you would like to format an email in draft, fill it with the values from your workflow and sent it?

1 Like

Yes, that’s exactly I want to do. Idea is, I may need multiple emails to be sent based on conditions. Though its not really difficult to do this in n8n editor but I want my staff to create such emails, so that its easier for them to do it in drafts rather than in editor.

Or do you know any other easy way to do this?

That should be possible. Get the draft → fill in the draft → sent the email.
image

1 Like

Thanks. I checked this one earlier but I was not sure how to insert value from webhook to draft emails.

I don’t have my Gmail account setup for n8n at the moment, so I cannot provide an example.
If you create a draft and get this draft with this node and show the output with what you want to fill in I can have a go at it for ya.

1 Like