Introduction
With UiForm, you can seamlessly connect external sources to your internal backend using webhooks, enabling streamlined document processing. Key capabilities include:
Creating new file-upload links : Share links to upload files and automatically send them to your webhook for processing.
Creating new mailboxes : Set up mailboxes to forward emails directly to your webhook.
Explore the SDK documentation below to integrate UiForm’s automation tools into your applications.
Verify Event
If you want to verify the event you can use the verify_event
method. The WEBHOOKS_SECRET
can be generated in the UiForm Dashboard .
import os
from fastapi import FastAPI, Request, Response, HTTPException
from uiform import UiForm
uiclient = UiForm( )
app = FastAPI( )
@app. post ( "/webhook" )
async def webhook_handler ( request: Request) :
try :
payload = await request. body( )
signature_header = request. headers. get( "UiForm-Signature" )
if not signature_header:
raise HTTPException( status_code= 400 , detail= "Missing UiForm-Signature header" )
uiclient. automations. verify_event(
event_body= payload,
event_signature= signature_header,
secret= os. getenv( "WEBHOOKS_SECRET" ) ,
)
return Response( status_code= 200 )
except Exception as e:
return Response( status_code= 400 , content= f"Webhook error: { str ( e) } " )
Link
Object
An Link object containing the extraction link configuration.
The type of object. Always “extraction_link”.
Unique identifier for the extraction link, prefixed with “el_”.
Optional password to access the link.
URL of the webhook to send the data to.
Headers to send with the webhook request.
Processing modality for the documents.
Preprocessing operations applied to images before sending to the LLM.
Model used for chat completion.
JSON schema format used to validate the output data.
Temperature for sampling. Defaults to 0.0 if not provided.
UTC timestamp of when the config was last updated.
Create
from uiform import UiForm
uiclient = UiForm( )
extraction_link = uiclient. automations. extraction_links. create(
name= "Invoices" ,
model= "gpt-4o-mini" ,
json_schema= json_schema,
webhook_url= "https://your_server.com/invoices/webhook" ,
)
Get
from uiform import UiForm
uiclient = UiForm( )
link_obj = uiclient. automations. extraction_links. get(
link_id= "el_1573aadc-e1ff-4569-80dc-05e71a6c4ff2"
)
List
from uiform import UiForm
uiclient = UiForm( )
list_link_obj = uiclient. automations. extraction_links. list ( )
Update
from uiform import UiForm
uiclient = UiForm( )
link_obj = uiclient. automations. extraction_links. update(
link_id= "el_1573aadc-e1ff-4569-80dc-05e71a6c4ff2" ,
model= "gpt-4o"
)
Delete
from uiform import UiForm
uiclient = UiForm( )
uiclient. automations. extraction_links. delete(
link_id= "el_1573aadc-e1ff-4569-80dc-05e71a6c4ff2"
)
Test
Test Webhook
from uiform import UiForm
uiclient = UiForm( )
link_log = uiclient. automations. extraction_links. test_webhook(
link_id= "el_1573aadc-e1ff-4569-80dc-05e71a6c4ff2" ,
)
Test Document Upload
from uiform import UiForm
uiclient = UiForm( )
link_log = uiclient. automations. extraction_links. test_document_upload(
link_id= "el_1573aadc-e1ff-4569-80dc-05e71a6c4ff2" ,
document = "invoice.pdf"
)
Mailbox
Object
An Mailbox object containing the extraction mailbox configuration.
The type of object. Always “mailbox”.
Unique identifier for the mailbox, prefixed with “mb_”.
Email address for the mailbox, must end with @mailbox.uiform.com.
List of authorized domains to receive the emails from.
List of emails to access the link.
URL of the webhook to send the data to.
Headers to send with the webhook request.
Processing modality for the documents.
Preprocessing operations applied to images before sending to the LLM.
Model used for chat completion.
JSON schema format used to validate the output data.
Temperature for sampling. Defaults to 0.0 if not provided.
UTC timestamp of when the config was last updated.
Create
from uiform import UiForm
uiclient = UiForm( )
extraction_link = uiclient. automations. mailboxes. create(
email= "invoices@mailbox.uiform.com" ,
model= "gpt-4o-mini" ,
json_schema= json_schema,
webhook_url= "https://your_server.com/invoices/webhook" ,
authorized_domains= [ "uiform.com" , "gmail.com" ] ,
authorized_emails= [ "john@doe.com" , "jane@doe.com" ]
)
Get
from uiform import UiForm
uiclient = UiForm( )
mailbox = uiclient. automations. mailboxes. get(
email= "invoices@mailbox.uiform.com" ,
)
List
from uiform import UiForm
uiclient = UiForm( )
list_mailboxes = uiclient. automations. mailboxes. list ( )
Update
from uiform import UiForm
uiclient = UiForm( )
mailbox = uiclient. automations. mailboxes. update(
email= "invoices@mailbox.uiform.com" ,
model= "gpt-4o-mini"
)
Delete
from uiform import UiForm
uiclient = UiForm( )
uiclient. automations. mailboxes. delete(
email= "invoices@mailbox.uiform.com"
)
Test
Test Webhook
from uiform import UiForm
uiclient = UiForm( )
mailbox_log = uiclient. automations. mailboxes. test_webhook(
email= "invoices@mailbox.uiform.com"
)
Test Email Processing
from uiform import UiForm
uiclient = UiForm( )
mailbox_log = uiclient. automations. mailboxes. test_email_processing(
email= "invoices@mailbox.uiform.com" ,
document= "invoice.eml"
)
Test Email forwarding
from uiform import UiForm
uiclient = UiForm( )
mailbox_log = uiclient. automations. mailboxes. test_email_forwarding(
email= "invoices@mailbox.uiform.com" ,
document= "invoice.eml"
)