Tasks Python Quick Start

Last updated: 2020-04-28 Contributors John WangByrne ReesePaco Vu
Edit this page

Welcome to the Engage Platform. In this Quick Start, we are going to help you get a list of tasks that can be assigned to agents within your account. Obtaining a reference to a task by its ID is an important first step in managing the workflow of that task. This Quick Start will have you up and running in minutes.

Obtain Access Key

The first thing you need to do is obtain an API Access Token if you do not already have one. Access tokens can be created and/or accessed via the "API access token" area in the "Admin" area of your Engage portal.

How to generate an Engage API access token
  1. Login to your Engage portal and click on the "Admin" menu located in the top, horizontal menu.

  2. Select "API access tokens" towards the bottom of the left hand menu.

  3. You should see a list of access tokens if any have been provisioned. Select the token, or click the "+" button to create a new one.

  4. Finally, enter a label/description for your token, and select an Agent on which the token will act on behalf of. Make sure the token is "enabled" and click "Save."

    API access token

Make note of the access token generated as you will need it later.

Create and Edit tasks.py

Create a file called tasks.py. Be sure to edit the variables in <ALL CAPS> with your app's credentials.

import requests

SERVER = "https://<YOUR-DOMAIN>.api.engagement.dimelo.com"
API = "/1.0/tasks"

    url = SERVER + API
    headers = {
            'Authorization': 'Bearer ' + ACCESS_TOKEN
        response = requests.get(url, headers=headers)
        if response.status_code == 200:
            print (response._content)
            print (response.status_code)
    except Exception as e:
        raise ValueError(e)
except Exception as e:
    raise ValueError(e)

Run Your Code

You are almost done. Now run your script.

$ python tasks.py

Need Help?

Having difficulty? Feeling frustrated? Receiving an error you don't understand? Our community is here to help and may already have found an answer. Search our community forums, and if you don't find an answer please ask!

Search the forums »

What's Next?

When you have successfully made your first API call, it is time to take your next step towards building a more robust Engage application.

Explore the REST API »