What are you trying to accomplish
I successfully send a post request but It got saved as a draft in builder, Can I make it published automatically when the user submit?.
Also, Can I send an email to the builder admin regarding new review submitted?
Screenshots or video link
Code stack you are integrating Builder with
e.g. NextJS, react
Reproducible code example
`const dataObject = {
name: slug,
data: {
userName: 'Anu',
review: 'Testing',
productSlug: slug,
date: new Date(),
rating: 4,
},
}
const postData = async (url: string, data: any) => {
const response = await fetch(url, {
body: JSON.stringify(data),
headers: {
Authorization: 'Bearer ' + process.env.BUILDER_PRIVATE_KEY,
'Content-Type': 'application/json',
},
method: 'POST',
})
return response.json()
}
postData('https://builder.io/api/v1/write/reviews', dataObject).then(
(data) => {
console.log('data: ', data)
}
).catch(error => console.error('error: ', error))
`