Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@formbricks/api
Advanced tools
This is the official API wrapper for Formbricks. It is used to interact with the Formbricks API. To know more about Formbricks, visit Formbricks.com.
The direct API documentation can be found in our official docs here. To interact with the Formbricks API, you need to have an environment ID. You can get it from the Formbricks dashboard at app.formbricks.com.
npm install @formbricks/api
import { FormbricksAPI } from "@formbricks/api";
const api = new FormbricksAPI({
apiHost: `https://app.formbricks.com`, // If you have self-hosted Formbricks, change this to your self hosted instance's URL
environmentId: "<environment-id>", // Replace this with your Formbricks environment ID
});
The API client is now ready to be used across your project. It can be used to interact with the following models:
Create a Display
await api.client.display.create({
surveyId: "<your-survey-id>", // required
userId: "<your-user-id>", // optional
responseId: "<your-response-id>", // optional
});
Update a Display
await api.client.display.update(
displayId: "<your-display-id>",
{
userId: "<your-user-id>", // optional
responseId: "<your-response-id>", // optional
},
);
Create a Response
await api.client.response.create({
surveyId: "<your-survey-id>", // required
finished: boolean, // required
data: {
questionId: "<answer-to-this-question-in-string>",
anotherQuestionId: 123, // answer to this question in number
yetAnotherQuestionId: ["option1", "option2"], // answer to this question in array,
}, // required
userId: "<your-user-id>", // optional
singleUseId: "<your-single-use-id>", // optional
ttc: {
questionId: 123, // optional
}, // optional
meta: {
source: "<your-source>", // optional
url: "<your-url>", // optional
userAgent: {
browser: "<your-browser>", // optional
device: "<your-device>", // optional
os: "<your-os>", // optional
},
country: "<your-country>", // optional
}, // optional
});
Update a Response
await api.client.response.update({
responseId: "<your-response-id>", // required
finished: boolean, // required
data: {
questionId: "<answer-to-this-question-in-string>",
anotherQuestionId: 123, // answer to this question in number
yetAnotherQuestionId: ["option1", "option2"], // answer to this question in array,
}, // required
ttc: {
questionId: 123, // optional
}, // optional
});
Create an Action
await api.client.action.create({
name: "<your-action-name>", // required
properties: {
key1: "value1",
key2: "value2",
key3AsNumber: 123,
}, // required
personId: "<your-person-id>", // optional
sessionId: "<your-session-id>", // optional
});
Create a Person
await api.client.people.create({
userId: "<your-user-id>", // required
});
Update a Person
await api.client.people.update(personId: "<your-person-id>", // required
{
attributes: {
key1: "value1",
key2: "value2",
key3AsNumber: 456,
}, // required
}
Upload a file
await api.client.storage.uploadFile(
file: File, // required (of interface File of the browser's File API)
{
allowedFileTypes: ["file-type-allowed", "for-example", "image/jpeg"], // optional
surveyId: "<your-survey-id>", // optional
} // optional
);
If you have any questions or need help, feel free to reach out to us on our Discord
FAQs
Formbricks-api is an api wrapper for the Formbricks client API
The npm package @formbricks/api receives a total of 1,473 weekly downloads. As such, @formbricks/api popularity was classified as popular.
We found that @formbricks/api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.