# How do I set-up this workflow? Membership form with Payment \> Discourse Invite

**URL:** https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669
**Category:** Support
**Created:** [1 באוגוסט,‏ 2018,‏ 6:03pm UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669 "2018-08-01T18:03:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![debryc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/debryc/32/101652_2.png) [@debryc](https://meta.discourse.org/u/debryc)
#### Post date: [1 באוגוסט,‏ 2018,‏ 6:03pm UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669/1 "2018-08-01T18:03:16Z")

</div>

Hi, I run a nonprofit community that has this workflow.

1. Someone applies to join the nonprofit community via a form of some kind

2. As part of the application, they are asked to make a donations based contribution that’s up to them, from $0 to the sky’s the limit

3. After submitting their membership application, I’d like a setup that automatically sends them a Discourse invite to our private Discourse forum

How do I set-up this workflow?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 באוגוסט,‏ 2018,‏ 6:37am UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669/2 "2018-08-02T06:37:29Z")

</div>

One side of this is that you can generate invite links via the API and make your community require login / approval. Do you have someone doing dev on your side, it is going to require a little bit of coding.

---

<div class="post-metadata">

### Author: ![debryc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/debryc/32/101652_2.png) [@debryc](https://meta.discourse.org/u/debryc)
#### Post date: [2 באוגוסט,‏ 2018,‏ 6:09pm UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669/3 "2018-08-02T18:09:17Z")

</div>

We have some dev talent. Is there example code or documentation, though, that perhaps another discourse forum uses, that we can borrow from?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2 באוגוסט,‏ 2018,‏ 6:43pm UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669/4 "2018-08-02T18:43:00Z")

</div>

You can send an invite through the Discourse API by making a POST request to `https://forum.example.com/invites`

In the body of the request you need to include the All Users `api_key` and `api_username`. The All Users `api_username` defaults to ‘system’. The other parameter that you need to include is `email`. You can optionally include a `custom_message` and a `group_names` parameter. The `group_names` parameter should be set to a comma separated list (without spaces) of group names for groups that already exist on your forum.

Here is an example API call made with curl. `$api_key` is set to the All Users API key for my forum. The URL is the URL of my local development forum:

```plaintext
curl -X POST -d "api_key=$api_key&api_username=system&email=johndoe@example.com&custom_message=Thanks for your contribution." http://localhost:3000/invites

```

The response you should get for a successful invite is `{"success":"OK"}`.

Once you have this working with curl or [Postman](https://www.getpostman.com/), it should be possible to wire up your application to make the request automatically when a user makes a contribution.

You can customize the email templates that are used for sending these invites. The template that is used if a custom message is included is the **Custom Invite Forum Mailer** template. The template that is used when a custom message is _not_ included is the **Invite Forum Mailer**.

For details about finding which API request to make to perform a specific action, see the [Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576) topic. For details about customizing email templates, see the [Customizing specific system email templates](https://meta.discourse.org/t/how-to-customize-email-templates/88323) topic.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [1 בספטמבר,‏ 2018,‏ 6:43pm UTC](https://meta.discourse.org/t/how-do-i-set-up-this-workflow-membership-form-with-payment-discourse-invite/93669/5 "2018-09-01T18:43:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
