-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs handlebars #68
Open
Geo25rey
wants to merge
3
commits into
main
Choose a base branch
from
docs/handlebars
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Docs handlebars #68
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
## Overview | ||
|
||
Mailscript provides integrations with external services such as Google Drive and Zoom. These integrations provide validated OAuth tokens to Mailscript Actions after the integrations are setup. The provided OAuth tokens can be used to interact directly with the integrated service. | ||
|
||
## Google Drive | ||
|
||
The Google Drive Integration provides an OAuth token with the permissions defined by [drive.files](https://www.googleapis.com/auth/drive.file). This allows for viewing and managing Google Drive files and folders that you have opened or created with this app. | ||
|
||
### Setup | ||
|
||
To setup the Google Drive Integration, first ensure you are logged in under the CLI with: | ||
``` | ||
mailscript login | ||
``` | ||
|
||
Then, add the Google Drive Integration with the following: | ||
``` | ||
mailscript integrations:add --gdrive | ||
``` | ||
|
||
This will open up your default web browsers with a prompt to sign in to Google. | ||
|
||
### Usage | ||
|
||
To access the Google Drive Integration from an Action, [Variable Interpolation]() is required on `integrations.google`, which returns the Integration's OAuth token. | ||
|
||
Note: The Integration's OAuth token is only provided to Webhook-typed Actions. | ||
|
||
## Zoom | ||
|
||
The Zoom Integration provides an OAuth token. This allows for full access to the Zoom API with your authority. | ||
|
||
Note: This Integration is not currently supported. | ||
|
||
### Setup | ||
|
||
There is currently no easy way to setup the Zoom Integration and is not currently supported. | ||
|
||
### Usage | ||
|
||
Since the Zoom Integration is not suppported yet, Zoom OAuth tokens are not exposed to Mailscript Actions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,63 @@ | ||
# Workflow Variables | ||
|
||
## Intro | ||
## Overview | ||
|
||
In workflows there are multiple variables that are passed down to the built in parser. In mailscript we use handlebars to allow you to substitute text in for processed variables. If you are unfamiliar with handlbars I'd suggest you read up on it [here](https://handlebarsjs.com/) | ||
In the Mailscript Pipeline, E-Mail messages are parsed into a custom JSON object. This object contains a wealth of metadata based on each message and other useful bits of information like [Integrations](/cli/integrations). To access this data, Mailscript Actions' `body` and `text` tags are parsed with HandleBars, providing a method of Variable Interpolation and, thus, allowing you to substitute text in for processed metadata. For more in-depth documentaion on HandlBars, read up on it [here](https://handlebarsjs.com/guide/). | ||
|
||
Some example handlebars syntax | ||
### HandleBars Example | ||
|
||
` | ||
My subject is {{subject}} | ||
` | ||
|
||
Assuming the variable subject is not undefined and defined as "did you receive my email?" | ||
``` | ||
My variable is {{variable}} | ||
``` | ||
|
||
The processed output would look like: "My subject is did you receive my email?" | ||
Assuming the variable is defined as "did you receive my email?", the processed output would look like: | ||
``` | ||
My variable is did you receive my email? | ||
``` | ||
|
||
## Available Metadata | ||
|
||
## Available variables | ||
There are many data fields generated by the Mailscript Pipeline for each E-Mail message. These fields can be used in the `body` or `text` section of a Mailscript Action in your Mailscript Workflow. The data fields will be available regardless of the type of the Action. Additional data fields may be supplied depending on the contents of the E-Mail message and the type of the Action. See the [Examplea](#examples) section for usage. | ||
|
||
We provide a couple of different out of the box variables, which can be used in the body section of the action in your workflow. These variables will be available regardless of what integration, or trigger is used. Additional variables may be supplied depending on what integration is used. | ||
### Subset of Metadata Fields | ||
|
||
| Name | Description | | ||
| ----------- | ----------- | | ||
| `msg.text` | Body of the email in the pipeline | | ||
| `msg.html` | HTML body of the email | | ||
| `msg.text` | Body of the text-only email | | ||
| `msg.html` | Body of the HTML-formatted email | | ||
| `msg.subject` | Subject line of the email | | ||
| `msg.attachments` | List of attachments in the email | | ||
|
||
## Extended HandleBars Functionality | ||
|
||
Some extra functionality has been added to HandleBars. This includes a special data field (`all`) and a Regular Expression matcher. | ||
|
||
### `all` Data Field | ||
|
||
The `all` data field returns the entirety of the JSON object created by the Mailscript Pipeline. | ||
|
||
#### YML Example | ||
### Regular Expression Matcher | ||
|
||
The Regular Expression matcher is used on a data field to check if some formatted text is present or to collect dynamic data from an E-Mail message such as a time, date, or price. The syntax for the matcher is defined as follows: | ||
|
||
``` | ||
{{ match data-field regex regex-flags index-of-match }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you include the example regex you showed us? |
||
``` | ||
|
||
- match: the keyword to initiate the match | ||
- data-field: the metadata field to run the Regular Expression on | ||
- regex: the Regular Expression to run on the metadata field | ||
- regex-flags: the flags to mask onto the Regular Expression | ||
- index-of-match: the index of the match to choose (starting at 0) | ||
|
||
## Examples | ||
|
||
### YML Example | ||
|
||
<img src="/images/var_example_yml.png"/> | ||
|
||
This example was taken from the [annotated workflow example](https://github.com/mailscript/cli/blob/main/docs/docs/cli/annotated-workflow.yml) | ||
|
||
#### CLI Example | ||
### CLI Example | ||
Or, if you are using the CLI: | ||
|
||
Forwarding an email | ||
|
@@ -45,4 +69,4 @@ Sending a SMS message | |
Note: This will require you to verify the sms number used ahead of time or this will not be able to receive SMS messages upon execution of the action. | ||
```sh | ||
mailscript actions:add --sms=1235555000 --text "The body of the email is {{msg.text}}" | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally committed this file into this PR?