You’re not obliged to use the Feedback Rocket widget to collect feedback. In fact you’re welcome to integrate directly with the API instead and build your own frontend components or integrate from non-web environments where the widget isn’t suitable.
The Feedback Rocket API is incredibly simple. The code snippet below demonstrates a custom integration using JavaScript and the fetch
API:
// if in a browser, you can get the current URL from window.location.href
const url = 'https://yoursite.com/current-url'
// Find your own ID at https://www.feedbackrocket.io/account/config
const FEEDBACK_ROCKET_ID = 'your-id-here'
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Origin: url,
'User-Agent': 'My Custom User Agent'
},
body: JSON.stringify({
text: 'Feedback content here',
from: 'from.address@example.com',
id: FEEDBACK_ROCKET_ID,
url: url,
}),
})
console.log(response.status, response.ok)
If the request was successful, you will always receive a 200 OK status code in response.
Any other status code will return a JSON payload containing an error
property which will repeat the status code, and a message
indicating the nature of the failure. These messages will not contain sensitive data, but they are intended for developer consumption and not end users.
text
- the user’s feedbackid
- your Feedback Rocket IDurl
- the URL the user was on when they submitted this feedbackfrom
- the user’s email addressContent-Type
- must be `application/json`Origin
- should match the provided url
User-Agent
- if not in a web environment, you may set this to whatever you wish400 (Bad Request)
- there’s something wrong with your payload which needs fixing403 (Forbidden)
- the Origin
provided is not allowed by your Security settings500 (Internal Server Error)
- something is wrong on our end and we’ll try and fix it ASAP!If you’d like to see your own custom integration showcased here, please get in touch!