Deployment
Zoom Rivet comes with built-in support to deploy to AWS Lambda. It provides a default AwsLambdaReceiver to parse and emit incoming webhook events.
Import AwsLambdaReceiver from the name spaced product you want to implement.
import { AwsLambdaReceiver, ... } from "@zoom/rivet/chatbot";
When you instantiate a client class, pass a new instance of AwsLambdaReceiver to the receiver option.
const chatbotClient = new ChatbotClient({
// ...
receiver: new AwsLambdaReceiver({
webhooksSecretToken: "XXXXXXXXXXXXXXXXXXXXXX",
});
// ...
});
webhooksSecretTokenis a required option forAwsLambdaReceiver.
In your application's entry point, pass the Lambda handler to the AwsLambdaReceiver.
export const handler = async (event, context, callback) => {
const handler = await chatbotClient.start();
return handler(event, context, callback);
};
Local function testing
To test your AWS Lambda receiver without deploying to AWS for development or testing, we recommend using Serverless Framework, with the Serverless Offline plugin.
The following serverless.yml file configures the Serverless Framework to deploy a Lambda function to AWS. The function runs boot.js from the same directory when it receives an HTTP POST request to the /zoom/events endpoint.
frameworkVersion: "4"
service: serverless-rivet-js
provider:
name: aws
runtime: nodejs20.x
functions:
rivet:
handler: boot.handler
events:
- http:
path: zoom/events
method: post
plugins:
- serverless-offline
Test the function offline (locally) with the following command:
serverless offline --noPrependStageInUrl