//native
/**
* Create Recipient View
* Generate an embedded-signing URL for a recipient. The recipient must have a clientUserId set on the envelope.
*/
export async function main(
auth: RT.Docusign,
envelope_id: string,
recipient_view_request: {
authenticationMethod: string
clientUserId: string
email: string
recipientId?: string
returnUrl: string
userName: string
pingFrequency?: string
pingUrl?: string
},
) {
const url = new URL(
`${auth.base_uri}/restapi/v2.1/accounts/${auth.account_id}/envelopes/${envelope_id}/views/recipient`,
)
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(recipient_view_request),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 22 days ago