Creating the workflow - Amazon SDK for JavaScript
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

The Amazon SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the Amazon SDK for JavaScript version 3 (V3).

Starting October 1, 2022, Amazon SDK for JavaScript (v3) will end support for Internet Explorer 11 (IE 11). For details, see Announcing the end of support for Internet Explorer 11 in the Amazon SDK for JavaScript (v3).

Creating the workflow

This topic is part of a tutorial that demonstrates to to invoke Lambda functions using Amazon Step Functions. To start at the beginning of the tutorial, see Creating Amazon serverless workflows using Amazon SDK for JavaScript.

The following figure shows the workflow you’ll create with this tutorial.

The following is what happens at each step in the workflow:

+ Start - Initiates the workflow.

+ Open Case – Handles a support ticket ID value by passing it to the workflow.

+ Assign Case – Assigns the support case to an employee and stores the data in a DynamoDB table.

+ Send Email – Sends the employee an email message by using the Amazon Simple Email Service (Amazon SES) to inform them there is a new ticket.

+ End - Stops the workflow.

Create a serverless workflow by using Step functions

You can create a workflow that processes support tickets. To define a workflow by using Step Functions, you create an Amazon States Language (JSON-based) document to define your state machine. An Amazon States Language document describes each step. After you define the document, Step functions provides a visual representation of the workflow. The following figure shows the Amazon States Language document and the visual representation of the workflow.

Workflows can pass data between steps. For example, the Open Case step processes a case ID value (passed to the workflow) and passes that value to the Assign Case step. Later in this tutorial, you’ll create application logic in the Lambda function to read and process the data values.

To create a workflow

  1. Open the Amazon Web Services Console.

  2. Choose Create State Machine.

  3. Choose Author with code snippets. In the Type area, choose Standard.

  4. Specify the Amazon States Language document by entering the following code.

    { "Comment": "A simple Amazon Step Functions state machine that automates a call center support session.", "StartAt": "Open Case", "States": { "Open Case": { "Type": "Task", "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", "Next": "Assign Case" }, "Assign Case": { "Type": "Task", "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", "Next": "Send Email" }, "Send Email": { "Type": "Task", "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", "End": true } } }

    Don’t worry about the errors related to the Lambda resource values. You’ll update these values later in this tutorial.

  5. Choose Next.

  6. In the name field, enter SupportStateMachine.

  7. In the Permission section, choose Choose an existing role.

  8. Choose workflow-support (the IAM role that you created).

  9. Choose Create state machine. A message appears that states the state machine was successfully created.