How to Get an Email Notification When a New User Signs Up

Hey everyone!

Welcome to this tutorial on how to setup an automation workflow with Integromat that will allow you to automatically receive an email notification every time a new user signs up to your Discourse community.

In order to connect Discourse to Integromat, you need to have an Integromat account. If you don’t have one yet, you can sign up here.

This method utilizes the webhooks feature that Discourse offers, therefore you will need to have Admin access to your Discourse community before getting started.

Once you have Admin access, the first thing you need to do is create a new webhook request. To do this, click on your profile icon at the top right-hand corner, and from the profile tab, select the Summary option.

This will bring you to your profile page. Click on the Admin button to navigate to the admin page.

Click on the API option.

Select the Webhooks tab, and click the New Webhook button to generate a new webhook request.

The configuration page should look like this.

To fill out this form, you will need to generate a new Integromat webhook that will be used to receive the data that Discourse sends out every time a new user signs up to your community.

To do this, log in to your Integromat account, and create a new scenario.

First, you’ll need to set up a trigger module, or, in other words, the module that will cause your scenario to be executed. In this case, it will be a webhook module, so you can click on the question mark icon, and search for the Webhooks app.

Click on the webhooks app, and select the Custom webhook module.

Next, create a new webhook so your scenario can receive the data that Discourse sends to it. To do so, click on the Webhooks app to open its configuration window, and click on the Add button to set up a new webhook.

Go ahead and give your webhook a name. This can be anything you like, for example, Discourse Webhook.

The next step will be to click on the Show advanced settings option, and select the Get request headers option. Once you do that, click Save to generate your new webhook.

Your webhook should now be visible. It is the URL highlighted in blue. Click the Copy address to clipboard button to copy your webhook, and navigate over to your Discourse webhook setup page.

Paste your Integromat webhook URL in the Payload URL.

Next, select the User Event option from the list, and make sure that everything else is deselected. This will ensure that this webhook will only receive data based on user specific events.

Finally, select the Check TLS certificate of payload url and Active checkboxes at the end of the page, and click the Create button to set up this connection between your Discourse community and your Integromat webhook.

The new connection should now be visible on the Webhooks page of your Discourse account.

The next step will be to make sure that the connection between the Discourse community and your Integromat webhook has been established. To do this, click on Inactive.

You will then be presented with a small menu that looks like this. Simply click Ping, and navigate over to your Integromat scenario to see if your webhook has successfully detected this event.

If it did, then you will see a message that says Successfully determined.

The next step is to check if the webhook can actually receive data from your Discourse community. To do this, you need to execute the scenario once by clicking on the Run once button.

Once the webhook module starts spinning, navigate over to your Discourse community, log out, and create a new user account on your community. Once the new user is successfully created, the webhook should receive some data, and it will look like this.

This will help you make sure the webhook can actually detect real events (not just pings), and it will also allow you to map the received data elements to the email app later on in this tutorial. If your Integromat webhook has successfully detected the event, the scenario would have been successfully executed, and it should look like this.

Now, that you know the webhook module functions as expected, and your Integromat scenario gets triggered every time a new user is created, it’s time to extend the scenario, and configure it so it automatically sends you an email with all the user information.

The first step will be to attach an Interator module to the webhook trigger module. You can find this in the Tools menu of the scenario builder. We’ll explain the use of this module later on.

Click on the Interator module to open its configuration window.

Once you click on the Array field, a menu will open up on the left-hand side with some data elements retrieved from the webhooks module. Simply drag and drop the data element called Headers to the Array field of the Iterator module. This will be an array with many values.

The next step will be to attach the Email app after the Iterator app. Click on the plus icon, and search for the Email app. Once you find it, click on it to select the module you would like to use.

Select the Send an Email module from the list to send an email to yourself every time a new user is created in your Discourse community.

Before configuring the Email module, you need to set up a filter between the Iterator and Email apps that will make sure you only receive emails for the users that sign up to your community. This is required because Discourse, by default, will be triggering webhook requests for all kinds of user activities.

In the filter configuration window, you’ll need to enter a label first. This can be anything you like, for example, New User.

Then, you’ll need to create a condition that will trigger this filter. In the first field of the condition, simply map the Value data element from the Iterator module. For the logical operator, select Equal to. Finally, in the bottom field, enter the value user_created.

The way this condition works is as follows:

The webhook data that Integromat receives from Discourse every time a user takes an action contains a Headers array (an array is a collection of values). The job of the iterator is to retrieve each one of these values individually so they can be processed and applied to the filter. Somewhere in this array of values, there is a value that specifies the type of event the user has performed. Because the event we are interested in is called user_created (because this indicates that the action the user has performed was to create a new account), we need to set up a filter to make sure the header values of the webhook data actually contain this value. If they do, then we proceed with the execution of the subsequent scenario modules. If they don’t, the scenario execution ends shortly, and no email is sent.

Once your filter is configured, you can click on the Email module to open its configuration window.

The first thing you need to do is connect the email account you would like to send emails with. If you are connecting your Gmail please make sure to follow this guide, which explains the process step by step.

Once your email is connected, you can proceed by setting up the other options of the email module.

For the To field, you can click on Add a recipient, and enter the email you would like to receive these updates on.

For Subject, you can enter anything you like, and for Content Type, you can select the Plaintext option to construct the message you would like to send every time this module is executed.

The content field is where you can construct the message of the email. Here, you can write some static text (i.e., text that always stays the same in every execution), but you can also map dynamic data elements from the webhook module. The webhook contains a lot of data about the user that you can use, including their username, name, email, etc.

And there you have it! You have successfully managed to create an Integromat scenario that notifies you every time a new user joins your Discourse community.

We hope this tutorial was useful! If you have any questions or recommendations for what you would like to see next, please do not hesitate to let us know in the comments, submit a ticket to Integromat’s support team or check out Integromat’s Facebook Community of 10K members.

Happy automating!

LINKS

:link: How to Connect Discourse with Hundreds of Apps Using Integromat

:link: Discourse – Integromat Support

:link: Discourse Integrations | Integromat

:link: Contact support | Integromat

:link: Sign up | Integromat

:link: Apps & Services | Integromat

4 Likes