I am following Elsa Workflow tutorial here: https://elsa-workflows.github.io/elsa-core/docs/next/guides/guides-document-approval#document-approval-workflow-visual-designer
I am using the docker version, which should be the latest.
But whenever I sent a POST request using postman, it always returns 400
.
I believe I am following the tutorial exactly as described.
The workflow isn't being triggered at all..., I suspect http://localhost:13000/v2/documents
is not the correct url.
Here is what I have designed.
This is what I POST using Postman.
This is the exported workflow definition.
{
"$id": "1",
"definitionId": "94e1b452fe8e4239aeff1cf779a65329",
"versionId": "cb2fbcfe31c44875b6f82b01ef477ea9",
"name": "VisualDocumentApprovalWorkflow",
"displayName": "Visual Document Approval Workflow",
"version": 3,
"variables": {
"$id": "2",
"data": {}
},
"customAttributes": {
"$id": "3",
"data": {}
},
"isSingleton": false,
"persistenceBehavior": "WorkflowBurst",
"deleteCompletedInstances": false,
"isPublished": true,
"isLatest": true,
"createdAt": "2022-11-23T08:43:45.6472218Z",
"activities": [
{
"$id": "4",
"activityId": "b1d82194-6a6b-4568-adde-382b16027c93",
"type": "HttpEndpoint",
"displayName": "HTTP Endpoint",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "5",
"name": "Path",
"expressions": {
"$id": "6",
"Literal": "/v2/documents/"
}
},
{
"$id": "7",
"name": "Methods",
"expressions": {
"$id": "8",
"Json": "[\"POST\"]"
}
},
{
"$id": "9",
"name": "ReadContent",
"expressions": {
"$id": "10",
"Literal": "true"
}
},
{
"$id": "11",
"name": "TargetType",
"expressions": {
"$id": "12"
}
},
{
"$id": "13",
"name": "Schema",
"syntax": "Literal",
"expressions": {
"$id": "14",
"Literal": ""
}
},
{
"$id": "15",
"name": "Authorize",
"expressions": {
"$id": "16",
"Literal": "false"
}
},
{
"$id": "17",
"name": "Policy",
"expressions": {
"$id": "18",
"Literal": "adaa"
}
}
],
"propertyStorageProviders": {
"$id": "19"
}
},
{
"$id": "20",
"activityId": "2e7f8800-d49f-4485-b47b-0c9f3cb82a48",
"type": "SetVariable",
"displayName": "Set Variable",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "21",
"name": "VariableName",
"expressions": {
"$id": "22",
"Literal": "Document"
}
},
{
"$id": "23",
"name": "Value",
"syntax": "JavaScript",
"expressions": {
"$id": "24",
"Literal": "input.Body",
"JavaScript": "input.Body"
}
}
],
"propertyStorageProviders": {
"$id": "25"
}
},
{
"$id": "26",
"activityId": "b10ffb0d-c9ae-439a-86fa-b4351294666d",
"type": "SendEmail",
"displayName": "Send Email",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "27",
"name": "From",
"expressions": {
"$id": "28",
"Literal": "[email protected]"
}
},
{
"$id": "29",
"name": "To",
"expressions": {
"$id": "30",
"Json": "[\"[email protected]\"]"
}
},
{
"$id": "31",
"name": "Subject",
"syntax": "Liquid",
"expressions": {
"$id": "32",
"Literal": "Document received from {{Variables.Document.Author.Name}}",
"Liquid": "Document received from {{Variables.Document.Author.Name}}"
}
},
{
"$id": "33",
"name": "Attachments",
"expressions": {
"$id": "34"
}
},
{
"$id": "35",
"name": "Body",
"expressions": {
"$id": "36",
"Literal": "Document from {{ Variables.Document.Author.Name }} received for review.<br><a href=\"{{ \"Approve\" | signal_url }}\">Approve</a> or <a href=\"{{ \"Reject\" | signal_url }}\">Reject</a>"
}
},
{
"$id": "37",
"name": "Cc",
"expressions": {
"$id": "38"
}
},
{
"$id": "39",
"name": "Bcc",
"expressions": {
"$id": "40"
}
}
],
"propertyStorageProviders": {
"$id": "41"
}
},
{
"$id": "42",
"activityId": "90942864-bd26-4309-82fd-51f27b8e3615",
"type": "WriteHttpResponse",
"displayName": "HTTP Response",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "43",
"name": "Content",
"expressions": {
"$id": "44",
"Literal": "<h1>Request for Approval Sent</h1><p>Your document has been received and will be reviewed shortly.</p>"
}
},
{
"$id": "45",
"name": "ContentType",
"expressions": {
"$id": "46",
"Literal": "text/html"
}
},
{
"$id": "47",
"name": "StatusCode",
"expressions": {
"$id": "48",
"Literal": "OK"
}
},
{
"$id": "49",
"name": "CharSet",
"expressions": {
"$id": "50",
"Literal": ""
}
},
{
"$id": "51",
"name": "ResponseHeaders",
"expressions": {
"$id": "52"
}
}
],
"propertyStorageProviders": {
"$id": "53"
}
},
{
"$id": "54",
"activityId": "c62c8ff0-db76-4dea-b1a6-6cc138415b17",
"type": "Fork",
"displayName": "Fork",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "55",
"name": "Branches",
"expressions": {
"$id": "56",
"Json": "[\"Approve\",\"Reject\",\"Remind\"]"
}
}
],
"propertyStorageProviders": {
"$id": "57"
}
},
{
"$id": "58",
"activityId": "aa201fb5-a50f-44b1-989f-7a7b57b3b52d",
"type": "SignalReceived",
"displayName": "Signal Received",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "59",
"name": "Signal",
"expressions": {
"$id": "60",
"Literal": "Approve"
}
}
],
"propertyStorageProviders": {
"$id": "61"
}
},
{
"$id": "62",
"activityId": "615f0e0d-9f7a-4a2f-ab9e-97b3bea10cbe",
"type": "SendEmail",
"displayName": "Send Email",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "63",
"name": "From",
"expressions": {
"$id": "64",
"Literal": "[email protected]"
}
},
{
"$id": "65",
"name": "To",
"syntax": "JavaScript",
"expressions": {
"$id": "66",
"Json": "[\"[Document.Author.Email]\"]",
"JavaScript": "[Document.Author.Email]"
}
},
{
"$id": "67",
"name": "Subject",
"syntax": "Liquid",
"expressions": {
"$id": "68",
"Liquid": "Document {{ Variables.Document.Id }} Approved!"
}
},
{
"$id": "69",
"name": "Attachments",
"expressions": {
"$id": "70"
}
},
{
"$id": "71",
"name": "Body",
"syntax": "Liquid",
"expressions": {
"$id": "72",
"Liquid": "Great job {{ Variables.Document.Author.Name }}, that document is perfect."
}
},
{
"$id": "73",
"name": "Cc",
"expressions": {
"$id": "74"
}
},
{
"$id": "75",
"name": "Bcc",
"expressions": {
"$id": "76"
}
}
],
"propertyStorageProviders": {
"$id": "77"
}
},
{
"$id": "78",
"activityId": "af52dae7-254b-4602-be35-0c0ef23a4ba5",
"type": "SignalReceived",
"displayName": "Signal Received",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "79",
"name": "Signal",
"expressions": {
"$id": "80",
"Literal": "Reject"
}
}
],
"propertyStorageProviders": {
"$id": "81"
}
},
{
"$id": "82",
"activityId": "ce2c17ff-cb9e-430a-a11e-9c92f0f4aa46",
"type": "SendEmail",
"displayName": "Send Email",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "83",
"name": "From",
"expressions": {
"$id": "84",
"Literal": "[email protected]"
}
},
{
"$id": "85",
"name": "To",
"syntax": "JavaScript",
"expressions": {
"$id": "86",
"JavaScript": "[Document.Author.Email]"
}
},
{
"$id": "87",
"name": "Subject",
"syntax": "Liquid",
"expressions": {
"$id": "88",
"Literal": "Document {{ Variables.Document.Id }} Rejected",
"JavaScript": "Document {{ Variables.Document.Id }} Rejected"
}
},
{
"$id": "89",
"name": "Attachments",
"expressions": {
"$id": "90"
}
},
{
"$id": "91",
"name": "Body",
"syntax": "Liquid",
"expressions": {
"$id": "92",
"Liquid": "Nice try {{ Variables.Document.Author.Name }}, but that document needs work."
}
},
{
"$id": "93",
"name": "Cc",
"expressions": {
"$id": "94"
}
},
{
"$id": "95",
"name": "Bcc",
"expressions": {
"$id": "96"
}
}
],
"propertyStorageProviders": {
"$id": "97"
}
},
{
"$id": "98",
"activityId": "0be8d291-f88e-4db6-866e-fc722df70b27",
"type": "Timer",
"displayName": "Timer",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "99",
"name": "Timeout",
"syntax": "JavaScript",
"expressions": {
"$id": "100",
"JavaScript": "Duration.FromSeconds(10)"
}
}
],
"propertyStorageProviders": {
"$id": "101"
}
},
{
"$id": "102",
"activityId": "01b73005-d48e-46eb-88ae-55a08f96c356",
"type": "SendEmail",
"displayName": "Send Email",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "103",
"name": "From",
"expressions": {
"$id": "104",
"Literal": "[email protected]"
}
},
{
"$id": "105",
"name": "To",
"expressions": {
"$id": "106",
"Json": "[\"[email protected]\"]"
}
},
{
"$id": "107",
"name": "Subject",
"syntax": "Liquid",
"expressions": {
"$id": "108",
"Liquid": "{{ Variables.Document.Author.Name }} is waiting for your review!"
}
},
{
"$id": "109",
"name": "Attachments",
"expressions": {
"$id": "110"
}
},
{
"$id": "111",
"name": "Body",
"syntax": "Liquid",
"expressions": {
"$id": "112",
"Liquid": "Don't forget to review document {{ Variables.Document.Id }}.<br><a href=\"{{ \"Approve\" | signal_url }}\">Approve</a> or <a href=\"{{ \"Reject\" | signal_url }}\">Reject</a>"
}
},
{
"$id": "113",
"name": "Cc",
"expressions": {
"$id": "114"
}
},
{
"$id": "115",
"name": "Bcc",
"expressions": {
"$id": "116"
}
}
],
"propertyStorageProviders": {
"$id": "117"
}
},
{
"$id": "118",
"activityId": "e1c0aedb-c75b-4386-a20a-b0121f3a1421",
"type": "Join",
"displayName": "Join",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "119",
"name": "EagerJoin",
"expressions": {
"$id": "120"
}
},
{
"$id": "121",
"name": "Mode",
"expressions": {
"$id": "122",
"Literal": "WaitAny"
}
}
],
"propertyStorageProviders": {
"$id": "123"
}
},
{
"$id": "124",
"activityId": "84247af4-66a8-41ab-a442-b72b1d256154",
"type": "WriteHttpResponse",
"displayName": "HTTP Response",
"persistWorkflow": false,
"loadWorkflowContext": false,
"saveWorkflowContext": false,
"properties": [
{
"$id": "125",
"name": "Content",
"expressions": {
"$id": "126",
"Literal": "Thanks for the hard work!"
}
},
{
"$id": "127",
"name": "ContentType",
"expressions": {
"$id": "128",
"Literal": "text/html"
}
},
{
"$id": "129",
"name": "StatusCode",
"expressions": {
"$id": "130",
"Literal": "OK"
}
},
{
"$id": "131",
"name": "CharSet",
"expressions": {
"$id": "132",
"Literal": ""
}
},
{
"$id": "133",
"name": "ResponseHeaders",
"expressions": {
"$id": "134"
}
}
],
"propertyStorageProviders": {
"$id": "135"
}
}
],
"connections": [
{
"$id": "136",
"sourceActivityId": "b1d82194-6a6b-4568-adde-382b16027c93",
"targetActivityId": "2e7f8800-d49f-4485-b47b-0c9f3cb82a48",
"outcome": "Done"
},
{
"$id": "137",
"sourceActivityId": "2e7f8800-d49f-4485-b47b-0c9f3cb82a48",
"targetActivityId": "b10ffb0d-c9ae-439a-86fa-b4351294666d",
"outcome": "Done"
},
{
"$id": "138",
"sourceActivityId": "b10ffb0d-c9ae-439a-86fa-b4351294666d",
"targetActivityId": "90942864-bd26-4309-82fd-51f27b8e3615",
"outcome": "Done"
},
{
"$id": "139",
"sourceActivityId": "90942864-bd26-4309-82fd-51f27b8e3615",
"targetActivityId": "c62c8ff0-db76-4dea-b1a6-6cc138415b17",
"outcome": "Done"
},
{
"$id": "140",
"sourceActivityId": "c62c8ff0-db76-4dea-b1a6-6cc138415b17",
"targetActivityId": "aa201fb5-a50f-44b1-989f-7a7b57b3b52d",
"outcome": "Approve"
},
{
"$id": "141",
"sourceActivityId": "aa201fb5-a50f-44b1-989f-7a7b57b3b52d",
"targetActivityId": "615f0e0d-9f7a-4a2f-ab9e-97b3bea10cbe",
"outcome": "Done"
},
{
"$id": "142",
"sourceActivityId": "c62c8ff0-db76-4dea-b1a6-6cc138415b17",
"targetActivityId": "af52dae7-254b-4602-be35-0c0ef23a4ba5",
"outcome": "Reject"
},
{
"$id": "143",
"sourceActivityId": "af52dae7-254b-4602-be35-0c0ef23a4ba5",
"targetActivityId": "ce2c17ff-cb9e-430a-a11e-9c92f0f4aa46",
"outcome": "Done"
},
{
"$id": "144",
"sourceActivityId": "c62c8ff0-db76-4dea-b1a6-6cc138415b17",
"targetActivityId": "0be8d291-f88e-4db6-866e-fc722df70b27",
"outcome": "Remind"
},
{
"$id": "145",
"sourceActivityId": "0be8d291-f88e-4db6-866e-fc722df70b27",
"targetActivityId": "01b73005-d48e-46eb-88ae-55a08f96c356",
"outcome": "Done"
},
{
"$id": "146",
"sourceActivityId": "01b73005-d48e-46eb-88ae-55a08f96c356",
"targetActivityId": "0be8d291-f88e-4db6-866e-fc722df70b27",
"outcome": "Done"
},
{
"$id": "147",
"sourceActivityId": "615f0e0d-9f7a-4a2f-ab9e-97b3bea10cbe",
"targetActivityId": "e1c0aedb-c75b-4386-a20a-b0121f3a1421",
"outcome": "Done"
},
{
"$id": "148",
"sourceActivityId": "ce2c17ff-cb9e-430a-a11e-9c92f0f4aa46",
"targetActivityId": "e1c0aedb-c75b-4386-a20a-b0121f3a1421",
"outcome": "Done"
},
{
"$id": "149",
"sourceActivityId": "e1c0aedb-c75b-4386-a20a-b0121f3a1421",
"targetActivityId": "84247af4-66a8-41ab-a442-b72b1d256154",
"outcome": "Done"
}
],
"id": "cb2fbcfe31c44875b6f82b01ef477ea9"
}
Nevermind..., the correct url is http://localhost:13000/workflows/v2/documents
instead of http://localhost:13000/v2/documents
.
I found this by trial and error.
I will submit a PR to amend the documentation.