|
1 | | -#!/bin/bash |
2 | | -# https://developers.docusign.com/docs/maestro-api/maestro101/embed-workflow/ |
3 | | -# Embed a Maestro workflow after it has been triggered |
| 1 | +# #!/bin/bash |
| 2 | +# # https://developers.docusign.com/docs/maestro-api/maestro101/embed-workflow/ |
| 3 | +# # Embed a Maestro workflow after it has been triggered |
4 | 4 |
|
5 | | -# Check that we're in a bash shell |
6 | | -if [[ $SHELL != *"bash"* ]]; then |
7 | | - echo "PROBLEM: Run these scripts from within the bash shell." |
8 | | -fi |
| 5 | +# # Check that we're in a bash shell |
| 6 | +# if [[ $SHELL != *"bash"* ]]; then |
| 7 | +# echo "PROBLEM: Run these scripts from within the bash shell." |
| 8 | +# fi |
9 | 9 |
|
10 | | -# Step 1: Obtain your OAuth token |
11 | | -ACCESS_TOKEN=$(cat config/ds_access_token.txt) |
| 10 | +# # Step 1: Obtain your OAuth token |
| 11 | +# ACCESS_TOKEN=$(cat config/ds_access_token.txt) |
12 | 12 |
|
13 | | -# Step 2: Read the account ID |
14 | | -account_id=$(cat config/API_ACCOUNT_ID) |
| 13 | +# # Step 2: Read the account ID |
| 14 | +# account_id=$(cat config/API_ACCOUNT_ID) |
15 | 15 |
|
16 | | -# Step 3: Read the workflow ID created by the trigger workflow script |
17 | | -workflow_id=$(cat config/WORKFLOW_ID) |
| 16 | +# # Step 3: Read the workflow ID created by the trigger workflow script |
| 17 | +# workflow_id=$(cat config/WORKFLOW_ID) |
18 | 18 |
|
19 | | -# Step 4: Verify a workflow has been created |
20 | | -if [ -z "$workflow_id" ]; then |
21 | | - echo "❌ ERROR: No workflow found. Please trigger a workflow before running this embed script." |
22 | | - exit 0 |
23 | | -fi |
| 19 | +# # Step 4: Verify a workflow has been created |
| 20 | +# if [ -z "$workflow_id" ]; then |
| 21 | +# echo "❌ ERROR: No workflow found. Please trigger a workflow before running this embed script." |
| 22 | +# exit 0 |
| 23 | +# fi |
24 | 24 |
|
25 | | -# Step 5: Construct your API headers |
26 | | -declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \ |
27 | | - '--header' "Accept: application/json" \ |
28 | | - '--header' "Content-Type: application/json") |
| 25 | +# # Step 5: Construct your API headers |
| 26 | +# declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \ |
| 27 | +# '--header' "Accept: application/json" \ |
| 28 | +# '--header' "Content-Type: application/json") |
29 | 29 |
|
30 | | -# Step 6: Prepare request body |
31 | | -request_data=$(mktemp /tmp/request-embed.XXXXXX) |
32 | | -printf \ |
33 | | -'{ |
34 | | - "returnUrl": "https://example.com/return" |
35 | | -}' > $request_data |
| 30 | +# # Step 6: Prepare request body |
| 31 | +# request_data=$(mktemp /tmp/request-embed.XXXXXX) |
| 32 | +# printf \ |
| 33 | +# '{ |
| 34 | +# "returnUrl": "https://example.com/return" |
| 35 | +# }' > $request_data |
36 | 36 |
|
37 | | -# Step 7: Make the POST request to generate the embed URL |
38 | | -response=$(mktemp /tmp/response-embed.XXXXXX) |
39 | | -Status=$(curl -s -w "%{http_code}\n" -i --request POST "https://api-d.docusign.net/maestro/v1/accounts/${account_id}/workflows/${workflow_id}/embed_url" \ |
40 | | - "${Headers[@]}" \ |
41 | | - --data-binary @$request_data \ |
42 | | - --output ${response}) |
| 37 | +# # Step 7: Make the POST request to generate the embed URL |
| 38 | +# response=$(mktemp /tmp/response-embed.XXXXXX) |
| 39 | +# Status=$(curl -s -w "%{http_code}\n" -i --request POST "https://api-d.docusign.net/maestro/v1/accounts/${account_id}/workflows/${workflow_id}/embed_url" \ |
| 40 | +# "${Headers[@]}" \ |
| 41 | +# --data-binary @$request_data \ |
| 42 | +# --output ${response}) |
43 | 43 |
|
44 | | -# Step 8: Handle the response |
45 | | -if [[ "$Status" -gt "201" ]]; then |
46 | | - echo "" |
47 | | - echo "❌ ERROR: Unable to generate embed URL for the workflow" |
48 | | - echo "" |
49 | | - cat $response |
50 | | - rm "$request_data" |
51 | | - rm "$response" |
52 | | - exit 0 |
53 | | -fi |
| 44 | +# # Step 8: Handle the response |
| 45 | +# if [[ "$Status" -gt "201" ]]; then |
| 46 | +# echo "" |
| 47 | +# echo "❌ ERROR: Unable to generate embed URL for the workflow" |
| 48 | +# echo "" |
| 49 | +# cat $response |
| 50 | +# rm "$request_data" |
| 51 | +# rm "$response" |
| 52 | +# exit 0 |
| 53 | +# fi |
54 | 54 |
|
55 | | -echo "" |
56 | | -echo "✅ Embed URL successfully generated:" |
57 | | -embed_url=$(grep '"url":' $response | sed -n 's/.*"url": "\([^"]*\)".*/\1/p') |
58 | | -echo $embed_url |
| 55 | +# echo "" |
| 56 | +# echo "✅ Embed URL successfully generated:" |
| 57 | +# embed_url=$(grep '"url":' $response | sed -n 's/.*"url": "\([^"]*\)".*/\1/p') |
| 58 | +# echo $embed_url |
59 | 59 |
|
60 | | -# Optional: Output embed code for iframe usage |
61 | | -echo "" |
62 | | -echo "📎 Use this in your HTML:" |
63 | | -echo "<iframe src=\"$embed_url\" width=\"100%\" height=\"600\" frameborder=\"0\" allowfullscreen></iframe>" |
| 60 | +# # Optional: Output embed code for iframe usage |
| 61 | +# echo "" |
| 62 | +# echo "📎 Use this in your HTML:" |
| 63 | +# echo "<iframe src=\"$embed_url\" width=\"100%\" height=\"600\" frameborder=\"0\" allowfullscreen></iframe>" |
64 | 64 |
|
65 | | -# Clean up |
66 | | -rm "$request_data" |
67 | | -rm "$response" |
| 65 | +# # Clean up |
| 66 | +# rm "$request_data" |
| 67 | +# rm "$response" |
0 commit comments