Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackyliang committed Feb 28, 2022
0 parents commit 9f01abd
Show file tree
Hide file tree
Showing 16 changed files with 1,287 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = off
tab_width = 2
trim_trailing_whitespace = true

[*.xml]
indent_size = 4
ij_xml_space_inside_empty_tag = true

[{*.ts,*.tsx}]
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_typescript_force_quote_style = true
ij_typescript_keep_simple_methods_in_one_line = true
ij_typescript_method_call_chain_wrap = normal
ij_typescript_object_literal_wrap = split_into_lines
ij_typescript_spaces_within_imports = true
ij_typescript_spaces_within_object_literal_braces = true
ij_typescript_use_double_quotes = false
ij_typescript_var_declaration_wrap = split_into_lines

[{*.js,*.jsx}]
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_javascript_force_quote_style = true
ij_javascript_keep_simple_methods_in_one_line = true
ij_javascript_method_call_chain_wrap = normal
ij_javascript_object_literal_wrap = split_into_lines
ij_javascript_spaces_within_imports = true
ij_javascript_spaces_within_object_literal_braces = true
ij_javascript_use_double_quotes = false
ij_javascript_var_declaration_wrap = split_into_lines

[{*.ejs,*.html}]
indent_size = 4
ij_html_attribute_wrap = off
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_html_text_wrap = off

[{*.markdown,*.md}]
ij_markdown_max_lines_around_block_elements = 0
53 changes: 53 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"env": {
"node": true
},
"extends": [
"airbnb-base",
"plugin:import/typescript"
],
"ignorePatterns": [
"/build/**/*"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"root": true,
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"d.ts": "never",
"ts": "never"
}
],
"import/prefer-default-export": [
"off"
],
"max-len": [
"off"
],
"no-console": [
"off"
],
"no-use-before-define": [
"off"
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [
".d.ts",
".ts"
]
}
}
}
}
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
### macOS ###
.DS_Store
.AppleDouble
.LSOverride
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Linux ###
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*

### Windows ###
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
Desktop.ini
$RECYCLE.BIN/
*.lnk

### Node Stack ###
node_modules/
package-lock.json

### WebStorm+all Patch ###
.idea/
*.iml
modules.xml
.idea/misc.xml
*.ipr

### Project Excludes ###
build/
config.json
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2021, Jacky Liang

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
Memberful Sync
===============

[![GitHub Releases](https://img.shields.io/github/v/release/mrjackyliang/memberful-sync?style=flat-square&color=blue&sort=semver)](https://github.com/mrjackyliang/memberful-sync/releases)
[![GitHub Top Languages](https://img.shields.io/github/languages/top/mrjackyliang/memberful-sync?style=flat-square&color=success)](https://github.com/mrjackyliang/memberful-sync)
[![GitHub License](https://img.shields.io/github/license/mrjackyliang/memberful-sync?style=flat-square&color=yellow)](https://github.com/mrjackyliang/memberful-sync/blob/master/LICENSE)
[![Become a GitHub Sponsor](https://img.shields.io/badge/sponsor-github-black?style=flat-square&color=orange)](https://github.com/sponsors/mrjackyliang)

An application that continuously syncs Memberful member data to all external services. Supported integrations will be listed below. Additional integrations may come in the future (accepting pull requests).

To use Memberful Sync, you would need to:
1. Install the [dependencies](#install-dependencies)
3. Configure the [Memberful Sync](#configuration) application
4. Start the application using `npm start`

## Install Dependencies
Before configuring and starting the application, make sure to install the dependencies and required packages.

1. Install [Homebrew](https://brew.sh) and run `brew install node`
2. Tap into the application directory with `cd memberful-sync`
3. Install dependencies by running `npm install`

## Configuration
In the project folder, you will find a `config-sample.json` file. Each section enables an integration and must be configured correctly. If you wish to disable an integration, you may omit the section from the configuration.

1. [Base Settings](#1-base-settings)
2. [Intercom](#2-intercom)
3. [WordPress](#3-wordpress)

### 1. Base Settings
For Memberful Sync to start, these settings should be filled.

| __Key__ | __Type__ | __Description__ | __Required__ | __Accepted Values__ |
|--------------------------------|----------|----------------------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------|
| `settings` | `object` | | no | |
| `settings.memberful-api-key` | `string` | | yes | Read [Memberful API Authentication](https://memberful.com/help/custom-development-and-api/memberful-api/#authentication) |
| `settings.memberful-subdomain` | `string` | | yes | A URL of `https://example123.memberful.com` would have a subdomain of `example123` |
| `settings.time-zone` | `string` | Preferred time zone | yes | More time zones found in the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) |
| `settings.log-level` | `number` | Verbosity level configured for logging | yes | `10` (error), `20` (warning), `30` (information), or `40` (debug) |

```json
{
"settings": {
"memberful-api-key": "",
"memberful-subdomain": "",
"time-zone": "Etc/UTC",
"log-level": 30
}
}
```

### 2. Intercom
Easily sync Memberful data to Intercom. Before enabling integration, you must set custom attributes in your workspace. To set custom attributes, go to [**Settings** > **Your workspace data** > **People data**](https://app.intercom.com/a/apps/_/settings/people-data).

The custom attributes are as follows:
- `credit_card` (text)
- `discord_user_id` (text)
- `downloads` (text)
- `last_updated` (date)
- `postal_code` (text)
- `stripe_customer_id` (text)
- `subscriptions` (text)
- `total_spend` (decimal number)
- `unrestricted_access` (true or false)

__NOTE:__ If custom attributes aren't set properly, errors will occur when attempting to update or create a new contact.

| __Key__ | __Type__ | __Description__ | __Required__ | __Accepted Values__ |
|------------------------------|----------|-------------------------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `intercom` | `object` | | no | |
| `intercom.access-token` | `string` | Access token to access Intercom API | no | Read [How to get your access token](https://developers.intercom.com/building-apps/docs/authentication-types#how-to-get-your-access-token) |

```json
{
"intercom": {
"access-token": ""
}
}
```

### 3. WordPress
Integration is being built! Coming Soon!

| __Key__ | __Type__ | __Description__ | __Required__ | __Accepted Values__ |
|----------------------------------|----------|----------------------------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `wordpress` | `object` | | no | |
| `wordpress.application-password` | `string` | Application password to access WordPress API | no | Read [How to use Application Passwords in WordPress for REST API Authentication](https://artisansweb.net/how-to-use-application-passwords-in-wordpress-for-rest-api-authentication/) |

```json
{
"wordpress": {
"application-password": ""
}
}
```
14 changes: 14 additions & 0 deletions config-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"settings": {
"memberful-api-key": "",
"memberful-subdomain": "",
"time-zone": "Etc/UTC",
"log-level": 30
},
"intercom": {
"access-token": ""
},
"wordpress": {
"application-password": ""
}
}
59 changes: 59 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "memberful-sync",
"displayName": "Memberful Sync",
"version": "1.0.0",
"description": "An application that continuously syncs Memberful member data to external services",
"main": "build/src/index.js",
"private": true,
"scripts": {
"start": "ts-node src/index.ts",
"build": "tsc --build"
},
"repository": {
"type": "git",
"url": "git://github.com/mrjackyliang/memberful-sync.git"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/mrjackyliang"
},
"keywords": [
"memberful",
"intercom",
"wordpress",
"sync"
],
"author": "Jacky Liang",
"license": "ISC",
"bugs": {
"url": "https://github.com/mrjackyliang/memberful-sync/issues"
},
"files": [],
"homepage": "https://github.com/mrjackyliang/memberful-sync#readme",
"engines": {
"node": "16"
},
"dependencies": {
"axios": "^0.25.0",
"bottleneck": "^2.19.5",
"chalk": "^4.1.2",
"gravatar": "^1.8.2",
"json-to-graphql-query": "^2.2.2",
"lodash": "^4.17.21",
"luxon": "^2.3.0",
"node-schedule": "^2.1.0"
},
"devDependencies": {
"@types/gravatar": "^1.8.3",
"@types/lodash": "^4.14.178",
"@types/luxon": "^2.0.9",
"@types/node-schedule": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
}
}
Loading

0 comments on commit 9f01abd

Please sign in to comment.