A Go wrapper for the HelloSign API.
The unofficial library for using the HelloSign API for golang.
https://app.hellosign.com/api/reference
client := hellosign.Client{APIKey: "ACCOUNT API KEY"}
using FileURL
request := hellosign.EmbeddedSignatureRequest{
TestMode: true,
ClientID: os.Getenv("HELLOSIGN_CLIENT_ID"),
FileURL: []string{"http://www.pdf995.com/samples/pdf.pdf"},
Title: "My First Document",
Subject: "Contract",
Signers: []hellosign.Signer{
hellosign.Signer{
Email: "[email protected]",
Name: "Jane Doe",
},
},
}
response, err := client.CreateEmbeddedSignatureRequest(request)
if err != nil {
log.Fatal(err)
}
// type SignatureRequest
fmt.Println(response.GetSignatureRequestID())
using File
request := hellosign.EmbeddedSignatureRequest{
TestMode: true,
ClientID: "APP_CLIENT_ID",
File: []string{"public/offer_letter.pdf"},
Title: "My First Document",
Subject: "Contract",
Signers: []hellosign.Signer{
hellosign.Signer{
Email: "[email protected]",
Name: "Jane Doe",
},
hellosign.Signer{
Email: "[email protected]",
Name: "John DOe",
},
},
}
response, err := client.CreateEmbeddedSignatureRequest(request)
if err != nil {
log.Fatal(err)
}
// type SignatureRequest
fmt.Println(response.GetSignatureRequestID())
Full Feature
request := hellosign.EmbeddedSignatureRequest{
TestMode: true,
ClientID: os.Getenv("HS_CLIENT_ID"),
File: []string{
"public/offer_letter.pdf",
"public/offer_letter.pdf",
},
Title: "My Document",
Subject: "Please Sign",
Message: "A message can go here.",
Signers: []hellosign.Signer{
hellosign.Signer{
Email: "[email protected]",
Name: "Freddy Rangel",
Pin: "1234",
Order: 1,
},
hellosign.Signer{
Email: "[email protected]",
Name: "Frederick Rangel",
Pin: "1234",
Order: 2,
},
},
CCEmailAddresses: []string{
"[email protected]",
"[email protected]",
},
UseTextTags: false,
HideTextTags: true,
Metadata: map[string]string{
"no": "cats",
"more": "dogs",
},
FormFieldsPerDocument: [][]hellosign.DocumentFormField{
[]hellosign.DocumentFormField{
hellosign.DocumentFormField{
APIId: "api_id",
Name: "display name",
Type: "text",
X: 123,
Y: 456,
Width: 678,
Required: true,
Signer: 0,
},
},
[]hellosign.DocumentFormField{
hellosign.DocumentFormField{
APIId: "api_id_2",
Name: "display name 2",
Type: "text",
X: 123,
Y: 456,
Width: 678,
Required: true,
Signer: 1,
},
},
},
}
response, err := client.CreateEmbeddedSignatureRequest(request)
if err != nil {
log.Fatal(err)
}
// type SignatureRequest
fmt.Println(response.GetSignatureRequestID())
// uses SignatureRequestID
res, err := client.GetSignatureRequest("6d7ad140141a7fe6874fec55931c363e0301c353")
// res is SignatureRequest type
res.GetSignatureRequestID()
res.GetSignatures()
// uses SignerID
res, err := client.GetEmbeddedSignURL("deaf86bfb33764d9a215a07cc060122d")
res.GetSignUrl() => "https://app.hellosign.com/editor/embeddedSign?signature_id=deaf86bfb33764d9a215a07cc060122d&token=TOKEN"
// uses SignatureRequestID
fileInfo, err := client.GetPDF("6d7ad140141a7fe6874fec55931c363e0301c353", "/tmp/download.pdf")
fileInfo.Size() => 98781
fileInfo.Name() => "download.pdf"
// uses SignatureRequestID
fileInfo, err := client.GetFiles("6d7ad140141a7fe6874fec55931c363e0301c353", "zip", "/tmp/download.zip")
fileInfo.Size() => 98781
fileInfo.Name() => "download.zip"
res, err := client.ListSignatureRequests()
res.GetListInfo().GetNumPages() => 1
res.GetListInfo().GetPage() => 1
res.GetListInfo().GetNumResults() => 19
res.GetListInfo().GetPageSize() => 20
len(res.GetSignatureRequests()) => 19
res, err := client.UpdateSignatureRequest(
"9040be434b1301e31019b3dad895ed580f8ca890", // SignatureRequestID
"deaf86bfb33764d9a215a07cc060122d", // SignatureID
"[email protected]", // New Email
)
res.GetSignatureRequestID() => "9040be434b1301e31019b3dad895ed580f8ca890"
res.GetSignatures()[0].GetSignerEmailAddress() => "[email protected]"
// uses SignatureRequestID
res, err := client.CancelSignatureRequest("5c002b65dfefab79795a521bef312c45914cc48d")
// res is *http.Response
res.StatusCode => 200