Public Zambdas
We will cover what public Zambdas are and when you should use them. If you are interested in creating your own public Zambda, we recommend reading the Writing Zambdas guide.
Overview of Public Zambdas
As the name implies, Public Zambdas are accessible to anyone. They do not require any authentication to use. Use public Zambdas when you wish to intentionally expose a Zambda to the public.
Example use cases:
- getting a list of available slots for scheduling an appointment
- returning a list of recent blog posts on your website
- form submissions that don't require authentication
- signing up for an appointment on a website that doesn't require authentication
Creating and Executing a Public Zambda
If you do not already have a Zambda, you can create one by following the Writing Zambdas guide.
Navigate to https://console.oystehr.com/zambdas (opens in a new tab) and select your Zambda. Edit it to use trigger method http_open
and save your changes:
You can use the Oystehr SDK or the curl
command to test your Zambda. You will need to replace the following values:
your_zambda_id
with the ID of the Zambdayour_oystehr_project_id
with the ID of the project that the Zambda belongs to. You can find this in the Project Settings (opens in a new tab)
You don't need an access token since this is a public Zambda.
Execute a public Zambda with the v3 SDK:
import Oystehr from '@oystehr/sdk';
const oystehr = new Oystehr({
accessToken: "<your_access_token>",
});
const zambda = await oystehr.zambda.executePublic(
{
id: 'your_zambda_id',
name: 'Oystehr User',
// you can submit additional data to your Zambda here
}
);
If you try modifying your project ID and you will see that the request fails with an Unauthorized error.
x-zapehr-project-id
header.