diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 648e72883..c73715e46 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16.x, 18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 @@ -83,7 +83,7 @@ jobs: - ubuntu-latest # TODO: Fix tests on Windows # - windows-latest - node-version: [16.x, 18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 @@ -108,7 +108,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16.x, 18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 @@ -142,7 +142,7 @@ jobs: - ubuntu-latest # TODO: Fix tests on Windows # - windows-latest - node-version: [16.x, 18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 diff --git a/docs/cli.html b/docs/cli.html index f8105cb12..aee092834 100644 --- a/docs/cli.html +++ b/docs/cli.html @@ -754,13 +754,24 @@
Invoke an auth operation, a trigger, or a create/search action locally.
-
Usage: zapier invoke [ACTIONTYPE] [ACTIONKEY]
This command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.
This command loads authData
from the .env
file in the current directory. Create a .env
file with the necessary auth data before running this command. Each line in .env
should be in the format authData_FIELD_KEY=VALUE
. For example, an OAuth2 integration might have a .env
file like this:
Usage: zapier invoke [ACTIONTYPE] [ACTIONKEY]
This command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.
This command loads environment variables and authData
from the .env
file in the current directory. If you don't have an .env
file yet, you can use the zapier invoke auth start
command to help you initialize it, or you can manually create it.
The zapier invoke auth start
subcommand will prompt you for the necessary auth fields and save them to the .env
file.
Each line in the .env
file should follow one of these formats:
VAR_NAME=VALUE
for environment variables
authData_FIELD_KEY=VALUE
for auth data fields
For example, a .env
file for an OAuth2 integration might look like this:
-authData_access_token=1234567890
+CLIENT_ID='your_client_id'
+
+CLIENT_SECRET='your_client_secret'
-authData_other_auth_field=abcdef
+authData_access_token='1234567890'
+
+authData_refresh_token='abcdefg'
+
+authData_account_name='zapier'
Then you can test an trigger, a search, or a create action. For example, this is how you invoke a trigger with key new_recipe
:
Once you have the correct auth data, you can test an trigger, a search, or a create action. For example, here's how you invoke a trigger with the key new_recipe
:
@@ -794,9 +805,7 @@ invoke
To add input data, use the --inputData
flag. The input data can come from the command directly, a file, or stdin. See EXAMPLES below.
The following are current limitations and may be supported in the future:
zapier invoke auth start
to help you initialize the auth data in .env
To add input data, use the --inputData
flag. The input data can come from the command directly, a file, or stdin. See EXAMPLES below.
When you miss any command arguments, such as ACTIONTYPE or ACTIONKEY, the command will prompt you interactively. If you don't want to get interactive prompts, use the --non-interactive
flag.
The --debug
flag will show you the HTTP request logs and any console logs you have in your code.
The following is a non-exhaustive list of current limitations and may be supported in the future:
zapier invoke auth refresh
to refresh the auth data in .env
Hook triggers, including REST hook subscribe/unsubscribe
@@ -813,21 +822,33 @@Buffered create actions
Search-or-create actions
+Search-powered fields
+Field choices
+autoRefresh for OAuth2 and session auth
+Arguments
actionType
| The action type you want to invoke.actionKey
| The trigger/action key you want to invoke. If ACTIONTYPE is "auth", this can be "test" or "label".actionKey
| The trigger/action key you want to invoke. If ACTIONTYPE is "auth", this can be "label", "start", or "test".Flags
-i, --inputData
| The input data to pass to the action. Must be a JSON-encoded object. The data can be passed from the command directly like '{"key": "value"}', read from a file like @file.json, or read from stdin like @-.--isLoadingSample
| Set bundle.meta.isLoadingSample to true. When true in production, this run is initiated by the user in the Zap editor trying to pull a sample.--isFillingDynamicDropdown
| Set bundle.meta.isFillingDynamicDropdown to true. Only makes sense for a polling trigger. When true in production, this poll is being used to populate a dynamic dropdown.--isLoadingSample
| Set bundle.meta.isLoadingSample to true. When true in production, this run is initiated by the user in the Zap editor trying to pull a sample.--isPopulatingDedupe
| Set bundle.meta.isPopulatingDedupe to true. Only makes sense for a polling trigger. When true in production, the results of this poll will be used initialize the deduplication list rather than trigger a Zap. This happens when a user enables a Zap.--limit
| Set bundle.meta.limit. Only makes sense for a trigger. When used in production, this indicates the number of items you should fetch. -1 means no limit. Defaults to -1
.-p, --page
| Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.-z, --timezone
| Set the default timezone for datetime fields. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to America/Chicago
.--non-interactive
| Do not show interactive prompts.-z, --timezone
| Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to America/Chicago
.--redirect-uri
| The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to http://localhost:9000
.-d, --debug
| Show extra debugging output.Examples
zapier invoke
zapier invoke auth start
zapier invoke auth test
zapier invoke auth label
zapier invoke trigger new_recipe
zapier invoke create add_recipe --inputData '{"title": "Pancakes"}'
zapier invoke search find_recipe -i @file.json
zapier invoke
Commandz
Object in Testszapier invoke
Commandz
Object in TestsYou can write unit tests for your Zapier integration that run locally, outside of the Zapier editor. -You can run these tests in a CI tool like Travis.
+There are several ways to test your Zapier integration:
zapier invoke
command to invoke a trigger, search, create, or an auth operation locally.zapier invoke
CommandAdded in v15.17.0.
The zapier invoke <ACTION_TYPE> <ACTION_KEY>
CLI command emulates how the Zapier production environment would invoke your app. Since it runs code locally, it's a fast way to debug and test interactively without needing to deploy the code to Zapier.
Its general execution flow invovles calling operation.inputFields
of an action, resolving the input data to the expected types, and then calling the operation.perform
method.
zapier invoke --help
should be self-explanatory, but here's a quick rundown:
# Intialize auth data in .env file
+zapier invoke auth start
+
+# Test your auth data in .env
+zapier invoke auth test
+zapier invoke auth label
+
+# Invoke a polling trigger
+zapier invoke trigger new_recipe
+
+# Invoke a create action
+zapier invoke create add_recipe --inputData '{"name": "Pancakes"}'
+zapier invoke create add_recipe --inputData @file.json
+
+ Invoke an auth operation, a trigger, or a create/search action locally.
-
Usage: zapier invoke [ACTIONTYPE] [ACTIONKEY]
This command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.
This command loads authData
from the .env
file in the current directory. Create a .env
file with the necessary auth data before running this command. Each line in .env
should be in the format authData_FIELD_KEY=VALUE
. For example, an OAuth2 integration might have a .env
file like this:
Usage: zapier invoke [ACTIONTYPE] [ACTIONKEY]
This command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.
This command loads environment variables and authData
from the .env
file in the current directory. If you don't have an .env
file yet, you can use the zapier invoke auth start
command to help you initialize it, or you can manually create it.
The zapier invoke auth start
subcommand will prompt you for the necessary auth fields and save them to the .env
file.
Each line in the .env
file should follow one of these formats:
VAR_NAME=VALUE
for environment variables
authData_FIELD_KEY=VALUE
for auth data fields
For example, a .env
file for an OAuth2 integration might look like this:
-authData_access_token=1234567890
+CLIENT_ID='your_client_id'
+
+CLIENT_SECRET='your_client_secret'
-authData_other_auth_field=abcdef
+authData_access_token='1234567890'
+
+authData_refresh_token='abcdefg'
+
+authData_account_name='zapier'
Then you can test an trigger, a search, or a create action. For example, this is how you invoke a trigger with key new_recipe
:
Once you have the correct auth data, you can test an trigger, a search, or a create action. For example, here's how you invoke a trigger with the key new_recipe
:
@@ -794,9 +805,7 @@ invoke
To add input data, use the --inputData
flag. The input data can come from the command directly, a file, or stdin. See EXAMPLES below.
The following are current limitations and may be supported in the future:
zapier invoke auth start
to help you initialize the auth data in .env
To add input data, use the --inputData
flag. The input data can come from the command directly, a file, or stdin. See EXAMPLES below.
When you miss any command arguments, such as ACTIONTYPE or ACTIONKEY, the command will prompt you interactively. If you don't want to get interactive prompts, use the --non-interactive
flag.
The --debug
flag will show you the HTTP request logs and any console logs you have in your code.
The following is a non-exhaustive list of current limitations and may be supported in the future:
zapier invoke auth refresh
to refresh the auth data in .env
Hook triggers, including REST hook subscribe/unsubscribe
@@ -813,21 +822,33 @@Buffered create actions
Search-or-create actions
+Search-powered fields
+Field choices
+autoRefresh for OAuth2 and session auth
+Arguments
actionType
| The action type you want to invoke.actionKey
| The trigger/action key you want to invoke. If ACTIONTYPE is "auth", this can be "test" or "label".actionKey
| The trigger/action key you want to invoke. If ACTIONTYPE is "auth", this can be "label", "start", or "test".Flags
-i, --inputData
| The input data to pass to the action. Must be a JSON-encoded object. The data can be passed from the command directly like '{"key": "value"}', read from a file like @file.json, or read from stdin like @-.--isLoadingSample
| Set bundle.meta.isLoadingSample to true. When true in production, this run is initiated by the user in the Zap editor trying to pull a sample.--isFillingDynamicDropdown
| Set bundle.meta.isFillingDynamicDropdown to true. Only makes sense for a polling trigger. When true in production, this poll is being used to populate a dynamic dropdown.--isLoadingSample
| Set bundle.meta.isLoadingSample to true. When true in production, this run is initiated by the user in the Zap editor trying to pull a sample.--isPopulatingDedupe
| Set bundle.meta.isPopulatingDedupe to true. Only makes sense for a polling trigger. When true in production, the results of this poll will be used initialize the deduplication list rather than trigger a Zap. This happens when a user enables a Zap.--limit
| Set bundle.meta.limit. Only makes sense for a trigger. When used in production, this indicates the number of items you should fetch. -1 means no limit. Defaults to -1
.-p, --page
| Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.-z, --timezone
| Set the default timezone for datetime fields. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to America/Chicago
.--non-interactive
| Do not show interactive prompts.-z, --timezone
| Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to America/Chicago
.--redirect-uri
| The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to http://localhost:9000
.-d, --debug
| Show extra debugging output.Examples
zapier invoke
zapier invoke auth start
zapier invoke auth test
zapier invoke auth label
zapier invoke trigger new_recipe
zapier invoke create add_recipe --inputData '{"title": "Pancakes"}'
zapier invoke search find_recipe -i @file.json
zapier invoke
Commandz
Object in Testszapier invoke
Commandz
Object in TestsYou can write unit tests for your Zapier integration that run locally, outside of the Zapier editor. -You can run these tests in a CI tool like Travis.
+There are several ways to test your Zapier integration:
zapier invoke
command to invoke a trigger, search, create, or an auth operation locally.zapier invoke
CommandAdded in v15.17.0.
The zapier invoke <ACTION_TYPE> <ACTION_KEY>
CLI command emulates how the Zapier production environment would invoke your app. Since it runs code locally, it's a fast way to debug and test interactively without needing to deploy the code to Zapier.
Its general execution flow invovles calling operation.inputFields
of an action, resolving the input data to the expected types, and then calling the operation.perform
method.
zapier invoke --help
should be self-explanatory, but here's a quick rundown:
# Intialize auth data in .env file
+zapier invoke auth start
+
+# Test your auth data in .env
+zapier invoke auth test
+zapier invoke auth label
+
+# Invoke a polling trigger
+zapier invoke trigger new_recipe
+
+# Invoke a create action
+zapier invoke create add_recipe --inputData '{"name": "Pancakes"}'
+zapier invoke create add_recipe --inputData @file.json
+
+