Skip to content

Commit

Permalink
Merge pull request #2 from trycourier/bryan/overhaul
Browse files Browse the repository at this point in the history
overhaul
  • Loading branch information
bwebs authored Jun 3, 2024
2 parents 1d73a68 + b056ada commit 1a1b67b
Show file tree
Hide file tree
Showing 42 changed files with 6,158 additions and 8,583 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
1.
1.

## Specifications

- Version:
- Platform:
- Subsystem:
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Description of the change

> Description here
## Type of change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Related issues

> Fix [#1]()
## Checklists

### Development

- [ ] Lint rules pass locally
- [ ] The code changed/added as part of this pull request has been covered with tests
- [ ] All tests related to the changed code pass in development

### Code review

- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
- [ ] "Ready for review" label attached to the PR and reviewers mentioned in a comment
- [ ] Changes have been reviewed by at least one other engineer
- [ ] Issue from task tracker has a link to this pull request
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: "https://registry.npmjs.org"
node-version: "14.x"
scope: "@trycourier"
always-auth: true
- uses: MathieuSoysal/[email protected]
with:
file: source/version.ts
old-string: local
new-string: ${GITHUB_REF_NAME#v}
- run: yarn
- run: yarn build
- run: yarn publish --new-version ${GITHUB_REF_NAME#v}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.14.0
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#4D1749",
"titleBar.activeBackground": "#6C2067",
"titleBar.activeForeground": "#FDF8FD"
}
}
76 changes: 56 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Courier CLI is a developer tool to help you build, test, and manage your int
From the command-line, use the following command to install the Courier CLI and set your API key:

```bash
$ npm install -g @trycourier/cli
$ yarn install -g @trycourier/cli
$ courier config --apikey <your-api-key>
```

Expand All @@ -29,23 +29,23 @@ The fastest way to get started is to run:
$ courier config --apikey <your-api-key>
```

Courier CLI looks for an environment variable named `COURIER_API_KEY`. It will load that key from the first location it finds in the following list:
Courier CLI looks for environment variables prefixed with `COURIER_AUTH_TOKEN`. It will load keys from the first location it finds in the following list:

- A `.courier` file in the current working directory
- `~/.courier` (in your home directory)
- A `COURIER_API_KEY` value otherwise set in your environment (such as via `~/.profile` or `~/.zshrc`)
- A `COURIER_AUTH_TOKEN` or `COURIER_AUTH_TOKEN_*` value otherwise set in your environment (such as via `~/.profile` or `~/.zshrc`)

You can find your Courier API key in your [Courier Settings](https://app.courier.com/settings/api-keys).

## Commands

- `courier config` – Set your Courier API key
- `courier whoami` – Display the currently authenticated workspace
- `courier send` - Send a notification to a user, list, or audience
- `courier send` - Send a notification to a user, list, tenant, or audience
- `courier track` - Send a track event to trigger a Courier Automations
- `courier users:get` - Fetch the data for a given user ID
- `courier users:set` - Overwrite a user's profile with the provided data
- `courier digests:flush` – Flush any currently queued events for a given user + digest
- `courier users:bulk` - Bulk upload users via csv, json, or parquet
- `courier translations:upload` - Upload .PO files to your Courier workspace
- `courier translations:download` - Download .PO files from your Courier workspace

Expand All @@ -54,27 +54,63 @@ For more details, run `courier` to see a list of commands and their arguments &
## Examples

```
$ courier send --tel 555-867-5309 --body "Hey Jenny\\!"
$ courier send --user user123 --template my-template-id --foo bar
$ courier send --email [email protected] --title "My Subject" --body "My Body"
$ courier send --user user123 --title "Important\\!" --body "Lorem Ipsum" --channels sms,push
$ courier send --user user123 --elemental my-template.json --foo bar
$ courier track my-event user123 --foo bar
$ courier users:get user123
$ courier users:set user123 --email [email protected] --tel 555-867-5309
$ courier digests:flush user123 my-digest-id
$ courier translations:upload en-US ./translations/en-US.po
$ courier translations:download en-US --text > example.en-US.po
courier --help
courier upgrade
courier send --tel 555-867-5309 --body "Hey Jenny\!"
courier send --user user123 --template my-template-id --foo bar
courier send -P --user=test123 --body "hello world" --title="hello" --channels=inbox
courier send --tenant=kewl --title=hello --body="hello world" --channel=inbox
courier send --user="1" --tenant-context=kewl --title=hello --body="hello world" --channel=inbox
courier users:get user123
courier users:set user123 --email [email protected]
courier users:bulk examples/users.csv --replace
courier users:bulk "examples/users/*.csv" --keep-flat
courier users:bulk "examples/*.json" --remove-nulls
courier users:bulk examples/users.parquet --list new-list-id
courier users:bulk examples/users.xlsx --tenant new-tenant-id
courier track EXAMPLE_EVENT user123 --name "Pip the Pigeon"
courier translations:upload en-US ./translations/en-US.po
courier translations:download en-US --text > example.en-US.po
courier config --apikey MY_API_KEY -P --override
courier config --apikey MY_API_KEY --mock
courier config --apikey MY_API_KEY --draft
```

## Common Flags

There are a number flags you can use for any command
┌────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│Flags │Description │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│-M --mock │Use the API key that simulates sending using the simulating routing │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│-P --production │Use the production environment API key │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│-D --draft │Use the draft document scope API key. Use draft or submitted, will default to published key if neither are provided │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│-S --submitted │Use the submitted document scope API key │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│--apikey <Courier API Key> │Use the provided Courier API key, otherwise use the approprate environment variable │
├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│--apiurl <Courier API URL> │Use the provided Courier API URL, otherwise use COURIER_API_URL environment variable. Default is https://api.courier.com
└────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

## Misc

- If you need to change the Courier API URL, you can set COURIER_API_URL in .courier or make sure an environment variable is set with it.

## License

[MIT License](http://www.opensource.org/licenses/mit-license.php)

## Author

[Courier](https://github.com/trycourier) ([[email protected]](mailto:[email protected]))

TODO - COURIER_DOMAIN
TODO - Common Flags
4 changes: 4 additions & 0 deletions examples/users.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
user_id,name,email,nested.key
2,Jane Doe,[email protected],
1,John Doe,[email protected],value
,Alice,[email protected],
10 changes: 10 additions & 0 deletions examples/users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{"user_id": 2, "name": "Jane Doe", "email": "[email protected]"},
{
"user_id": 1,
"name": "John Doe",
"email": "[email protected]",
"nested": {"key": "value"}
},
{"name": "Alice", "email": "[email protected]"}
]
3 changes: 3 additions & 0 deletions examples/users.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"user_id": 2, "name": "Jane Doe", "email": "[email protected]"}
{"user_id": 1, "name": "John Doe", "email": "[email protected]", "nested": {"key": "value"}}
{"name": "Alice", "email": "[email protected]"}
Binary file added examples/users.parquet
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/users/a.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
user_id,name,email,nested.key
2,Jane Doe,[email protected],
,Alice,[email protected],
4 changes: 4 additions & 0 deletions examples/users/a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{"user_id": 2, "name": "Jane Doe", "email": "[email protected]"},
{"name": "Alice", "email": "[email protected]"}
]
2 changes: 2 additions & 0 deletions examples/users/b.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
user_id,name,email,nested.key
1,John Doe,[email protected],value
8 changes: 8 additions & 0 deletions examples/users/b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"user_id": 1,
"name": "John Doe",
"email": "[email protected]",
"nested": {"key": "value"}
}
]
Loading

0 comments on commit 1a1b67b

Please sign in to comment.