@@ -5,6 +5,17 @@ if [[ $SHELL != *"bash"* ]]; then
55 echo " PROBLEM: Run these scripts from within the bash shell."
66fi
77
8+ # Configuration
9+ # 1. Search for and update '{USER_EMAIL}' and '{USER_FULLNAME}'.
10+ # They occur and re-occur multiple times below.
11+ # 2. Obtain an OAuth access token from
12+ # https://developers.hqtest.tst/oauth-token-generator
13+ access_token=' {ACCESS_TOKEN}'
14+ # 3. Obtain your accountId from demo.docusign.com -- the account id is shown in
15+ # the drop down on the upper right corner of the screen by your picture or
16+ # the default picture.
17+ account_id=' {ACCOUNT_ID}'
18+
819#
920# Step 1. Create the envelope.
1021# The signer recipient includes a clientUserId setting
@@ -73,10 +84,10 @@ printf \
7384 "status": "sent"
7485}' >> $request_data
7586
76- curl --header " Authorization: Bearer {ACCESS_TOKEN }" \
87+ curl --header " Authorization: Bearer ${access_token }" \
7788 --header " Content-Type: application/json" \
7889 --data-binary @${request_data} \
79- --request POST ${base_path} /v2/accounts/{ACCOUNT_ID }/envelopes \
90+ --request POST ${base_path} /v2/accounts/${account_id } /envelopes \
8091 --output ${response}
8192
8293echo " "
@@ -98,7 +109,7 @@ echo "EnvelopeId: ${envelope_id}"
98109
99110echo " "
100111echo " Requesting the url for the signing ceremony..."
101- curl --header " Authorization: Bearer {ACCESS_TOKEN }" \
112+ curl --header " Authorization: Bearer ${access_token }" \
102113 --header " Content-Type: application/json" \
103114 --data-binary '
104115{
@@ -108,7 +119,7 @@ curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
108119 "userName": "{USER_FULLNAME}",
109120 "clientUserId": 1000,
110121}' \
111- --request POST ${base_path} /v2/accounts/{ACCOUNT_ID }/envelopes/${envelope_id} /views/recipient \
122+ --request POST ${base_path} /v2/accounts/${account_id } /envelopes/${envelope_id} /views/recipient \
112123 --output ${response}
113124
114125echo " "
@@ -118,13 +129,14 @@ echo ""
118129
119130signing_ceremony_url=` cat $response | grep url | sed ' s/.*\"url\": \"//' | sed ' s/\".*//' `
120131echo " "
121- echo " Attempting to automatically open your browser to the signing ceremony url..."
122- if which open > /dev/null 2> /dev/null
123- then
124- open " $signing_ceremony_url "
125- elif which start > /dev/null
126- then
127- start " $signing_ceremony_url "
132+ printf " The signing ceremony URL is ${signingCeremonyUrl} \n"
133+ printf " It is only valid for a couple of minutes. Attempting to automatically open your browser...\n"
134+ if which xdg-open & > /dev/null ; then
135+ xdg-open " $signingCeremonyUrl "
136+ elif which open & > /dev/null ; then
137+ open " $signingCeremonyUrl "
138+ elif which start & > /dev/null ; then
139+ start " $signingCeremonyUrl "
128140fi
129141
130142# cleanup
0 commit comments