Advanced Zapier Integrations
Zapier is an online automation tool that connects apps and services. You can build a Zapier integration that allows your customers to connect your service to other services with Svix.
The Svix auto-generated Zapier integration is a Node/JavaScript project meaning it's defined as code and very easy to customize.
This doc gives guidance on ways to enhance your Zapier webhook integration powered by Svix.
Before reading this doc, we strongly recommend reading the Build a Zapier Integration docs. This doc assumes you're familiar with the basics of Svix Integrations and have a functional API key-based Zapier webhook integration.
Upgrade an existing integration
If you add or change your event types, you may want to upgrade your Zapier integration to a new auto-generated integration.
Upgrading to an updated auto-generated package
Follow the Download the package section of the Build a Zapier Integration guide to download an updated auto-generated package. Then follow the steps below to link the new package to the existing integration and deploy.
Build and deploy
After downloading and extracting the auto-generated integration package, download the package dependencies:
npm install
Then, link the new integration package to your existing Zapier integration using the Zapier CLI link command:
zapier link
Finally, build & deploy the integration to Zapier through the push command:
zapier push
Managing integration versions
If you wish to version bump your integration, be sure to update your integration's package.json
(shown below) to reflect the new version number. It defaults to 1.0.0
.
{
"name": "zapier-webhook-integration-with-svix",
"version": "1.0.0", // <------ CHANGE ME
"main": "index.js",
// << truncated >>
}
Zapier supports complex versioning use cases including migrating users during a version bump. Review the Zapier Platform docs for more information.
Upgrading a customized integration
If you have customized your integration package, you will need to manually reconcile the diff. We strongly recommend using version control like git to track the changes and aid in merging.
Alternative authentication schemes
By default, the auto-generated Zapier integration uses custom (API key) authentication type and requires users to explicitly provide an application ID and integration key. The default scheme might be undesirable because it requires the the user to copy-paste credentials and doesn't connect to your existing auth flows.
To provide a better user experience that hides the Svix constructs, we recommend using OAuth2 or Session authentication. See the Zapier Platform authentication docs for more information.
- With OAuth2, Zapier will redirect your user to your site where you can authenticate them and send Zapier back an access token. An demonstration of this flow's user experience is shown in the video below.
- With Session Auth, Zapier will show a login form for your user to provide their username and password. Those are securely sent to your service where you'll send Zapier back a session token.
With either authentication flow, you can make another request to your APIs to exchange the access/session token for the Svix application ID and integration key. An example of that API endpoint for a Flask-based service might look like the following:
svix = Svix("AUTH_TOKEN")
@app.route('/webhook/integration/')
@auth_required
def get_svix_integration_key():
app_id = ... # get your user's app id
integration_out = svix.integration.create(app_id, IntegrationIn(
name="Zapier Integration"
))
... # store your user's zapier integration ID
key_out = svix.integration.get_key(app_id, integration_out.id)
return jsonify({
"application_id": app_id,
"integration_key": key_out.key
})
OAuth2 Flow User Experience
Custom triggers
Multiple event types per trigger
If you wish to configure triggers with multiple event types, you can modify the filterTypes
field on the create endpoint operation during the trigger's subscribe hook.
If you wish your users to specify a set of event types when creating the trigger, you can use Zapier's input fields feature.
Additional trigger fields
By default, the auto-generated integration contains the example payload that you provided with the event type schema. Zapier supports explicitly defining the list of output fields for the trigger. If you have optional fields or multiple event types with different schemas, we recommend explicitly defining the output fields on the trigger.
Adding custom actions or triggers
The auto-generated Zapier integration can be extended with additional actions, triggers, creates, or other Zapier resources. More information on this is available on the Zapier CLI platform docs.
The Zapier CLI can modify your package (e.g. creating a new action from a template). More information on that is available on the Zapier CLI Reference.