Create an API Task (API Task in Process)

Create the essential API Tasks for your automation, utilizing the readily available packages within the API Task editor.

Prerequisites

You must have a Bot Creator license.

This topic describes the first step of crafting the API and Bot Tasks that will orchestrate the automation process. In this example, let us consider a sending a "Hello World" message using an API Task to Microsoft Teams.

Procedure

  1. Log in to your instance of the Automation Anywhere Control Room as a Bot creator.
  2. Create a new API Task:
    1. From the left pane, click Automation.
    2. Click Create new > API Task.
    3. In the Create API Task window, enter the API Task name.
    4. Accept the default folder location: \Bots\.
      To change where your API Task is stored, click Choose and follow the prompts.
    5. Click Create & edit.
    In this example, an API Task is created that calls an API to send a "Hello World" message on Teams.
  3. Use the Post method action to send a message in Teams.
    Note: Pre-built packages are available for most common enterprise applications. For a list of supported packages, see Table 1.
    1. Double-click or drag the REST Web Services > Post method action.API Task Teams message
    2. You can use the Graph API to send a chat message on Teams. For more information, see https://learn.microsoft.com/en-us/graph/api/chat-post-messages.
      Note:

      You can call multiple APIs within a single API Task. This can simplify your automation and reduce the need for multiple separate tasks. For instance, you can call API 1 to fetch product data, API 2 to fetch pricing data, and then API 3 to create a quotation within the same API Task.

    3. In the Authentication Mode drop-down list, select No Authentication and click Add header to input the bearer token. In this example, the bearer token is stored in a variable (in_graph_bearertoken).
      Note: Typically, endpoints require authentication to ensure that only authorized applications can access the data. Select an appropriate authentication mechanism to allow access to the endpoint you want to access.
    4. Under Content type, make sure JSON (application/json) is selected and enter the following JSON in Custom parameters.
      {
          "body": {
                  "content": "Hello World"
              }
      }
    5. Assign the output of the API to a variable (o_teams).