Create new user through API using Zapier - Webhooks


(Lennart) #1

Hi,
My goal is to create a new discourse user, using a zapier webhook. Anyone have experience, or can point me in the right direction?

In a Zapier zap I get an email address and a unique password. Want to send a webhook to my (discourse hosted) discourse to create and activate this user.

I found a nr of posts here, but cannot tie it together. I am not a developer, but have used zapier a lot for many build in integrations.
What do I fill in? See Zapier screenshot…

  • Where do I fill in my discourse api key and admin username?
  • where do I put the email / password
  • can I use the before@ part as username (as discussed here)
  • Is this possible at all, using zapier?

If anyone can give e a few hints I would be most grateful!

Lennart


(Arpit Jalan) #2

Hi Lennart,

I just successfully created a Zap that creates a new user on my Discourse instance via a webhook.

For testing purposes I used the following webhook:

curl -v -H "Accept: application/json" \
        -H "Content-Type: application/json" \
        -X POST \
        -d '{"name":"Bryan","email":"bryan@example.com","username":"bryanH","password":"pass@woRD","active":"true"}' \
        https://zapier.com/hooks/catch/xxxxxx/

and Zapier parsed it as:

username:
bryanH
name:
Bryan
active:
true
password:
pass@woRD
email:
bryan@example.com

Now here are the fields which I entered for setting up Zapier POST webhook:

Note that in data field you will enter values as {{name}}, {{email}} etc.

When I triggered my original webhook, Zapier created a new user on my instance.

Hope this helps :smile:


(Lennart) #3

Love you techAPJ!!!

I did get an error with zapier:
We received an error from Webhooks by Zapier
-2

Can you look at my two screenshots? (I edited the website, api and user for the screenshot)

Does the second part stay empty?


(Lennart) #4

second part


(Arpit Jalan) #5

The only difference I can see is support.WEBSITE.com instead of http://support.WEBSITE.com, can you try adding the protocol in URL?

Also you should be able to see detailed error message on Zap’s History page.


(Lennart) #6

I had already tried http, then got 404 in zapier
Will check zapiers detailed error in history.
Thanks!


(Lennart) #7

Got it! added http:// and removed /admin/, and added two headers (not sure if that was needed)

Two things open:

1 - Is there already a way to create a user without sending an activation mail? (without the workaround sending three seperate webhooks from this discussion)

2 - I would like these users to automaticly join a custom group. I added in the data fields group | Mygroupname – but that does not work. Any suggestions?

Thanks!
Len


#8

As I can see Zapier still havent added Discourse to their list :frowning: Shame really as could really open up some good possibilities.

Is there a way anyone knows that I could integrate creating a user via the api from a hootsuite list of email addresses - or If I could use the above but somehow have it generate a password or allow the user to create a password upon activation?


(Blake Erickson) #9

If you generate a random password that no one knows could the new users just go through the normal “forgot password” flow where they get sent an email and then they could set a new password?


#10

Thanks @blake I was thinking that - Just got to think how the mail flow would go with activiation and then forgot password.

Will have to play with it and see I think


(Travis) #11

This could be absolutely huge combined with Facebook lead ads. :slight_smile: