Send requests to gotoHuman
Use our SDK or API to send requests for human review to gotoHuman. You can fully customize a review to fit your use case by creating your own form used for the review.
Create a review form
First, make sure you created a form in our web app.
Pick dynamic form components to inject data with every request for review, or add components to collect reviewer's input and decisions.
The example SDK/API call shown in the form editor will show you your API key, the formId
and the fields
values accepted for your custom form.
How to use it
Init
- Python SDK
- JS/TS SDK
- REST API
Install our SDK
pip install gotohuman
Setup an environment variable with the API key shown in the form editor:
GOTOHUMAN_API_KEY=YOUR_API_KEY
If you're using a .env
file, don't forget to load it:
from dotenv import load_dotenv
load_dotenv()
Initialize the SDK
gotoHuman = GotoHuman()
Install our SDK
npm i gotohuman
Initialize the SDK
const gotoHuman = new GotoHuman(GOTOHUMAN_API_KEY)
Include the API key shown in the form editor.
Send requests for review with POST
requests to our API at
https://api.gotohuman.com/requestReview
.
Include an x-api-key
header with the API key shown in our form editor.
Send request
- Python SDK
- JS/TS SDK
- REST API
Create a request with the formId of the form you created.
Pass the field values as shown in our form editor and optionally add some meta data.
review = gotoHuman.create_review("YOUR_FORM_ID")
review.add_field_data("exampleField1", value1)
review.add_field_data("exampleField2", value2)
review.add_meta_data("threadId", threadId)
review.assign_to_users(["[email protected]"])
try:
response = review.send_request()
print("Review sent successfully:", response)
except Exception as e:
print("An error occurred:", e)
Create a request with the formId of the form you created.
Pass the field values and optionally some meta data.
const reviewRequest = gotoHuman.createReview(GOTOHUMAN_FORM_ID)
.addFieldData("exampleField1", value1)
.addFieldData("exampleField2", value2)
.addMetaData("threadId", threadId)
.assignToUsers(["[email protected]"])
await reviewRequest.sendRequest()
The structure of your API request is
{
"formId": "abcdef12345",
"fields": {
...
},
"meta": {
...
},
"assignTo": ["[email protected]"]
}
formId
Find the formId
in the example SDK/API call shown for your created form in the form editor.
fields
When creating your form in our web app, you add different components to show dynamic content or collect user input.
These added components determine the payload that you need to send with your request.
You can find the expected format in the example SDK/API call shown for your created form in the form editor.
Example
Given a urlLink (id: linkedin
) and a text component (id: aiDraft
) on your form, a request might look like this:
- Python SDK
- JS/TS SDK
- REST API
Create a request with the formId of the form you created.
Pass the field values as shown in our form editor and optionally add some meta data.
review = gotoHuman.create_review("abcdef12345")
review.add_field_data("linkedin", {
"label": "Rodrigo G.",
"url": "https://www.linkedin.com/in/rodrigog12/"
})
review.add_field_data("aiDraft", "Hey there, I saw...")
try:
response = review.send_request()
print("Review sent successfully:", response)
except Exception as e:
print("An error occurred:", e)
const reviewRequest = gotoHuman.createReview("abcdef12345")
.addFieldData("linkedin", {
label: "Rodrigo G.",
url: "https://www.linkedin.com/in/rodrigog12/"
})
.addFieldData("aiDraft", "Hey there, I saw...")
await reviewRequest.sendRequest()
{
"formId": "abcdef12345",
"fields": {
"linkedin": {
"label": "Rodrigo G.",
"url": "https://www.linkedin.com/in/rodrigog12/"
},
"aiDraft": "Hey there, I saw..."
}
}
meta
When a user is done reviewing and submits the form, you will receive a webhook. For convenience, you can add additional data to your request that you will receive back in the webhook. This could be an ID of your workflow run or of a conversation thread.
It could look like this:
- Python SDK
- JS/TS SDK
- REST API
Create a request with the formId of the form you created.
Pass the field values as shown in our form editor and optionally add some meta data.
review = gotoHuman.create_review("abcdef12345")
review.add_field_data(...)
review.add_meta_data('threadId', 'oai-thread-443289')
try:
response = review.send_request()
print("Review sent successfully:", response)
except Exception as e:
print("An error occurred:", e)
const reviewRequest = gotoHuman.createReview("abcdef12345")
.addFieldData(...)
.addMetaData("threadId", "oai-thread-443289")
await reviewRequest.sendRequest()
{
"formId": "abcdef12345",
"fields": {
...
},
"meta": {
"threadId": "oai-thread-443289"
}
}
assignTo
To send a review request only to selected users of your organization, you can specify a list of email addresses of those users. Use the email address used when signing up for gotoHuman.
This feature is available in our Pro plan.