Interactions API

Overview

Interactions are instances of bot conversations with a customer. Clients can add an interaction for a customer, and the SDK will automatically detect this and interact with the customer accordingly.


Properties

Interactions have many properties associated with them, some of which are self explanatory but some that aren’t.

status

  • Type: String
  • Description: The current status of the interaction. Can be ‘Draft’, ‘Pending’, ‘InProgress’, ‘Completed’ or ‘Expired’. Defaults to Draft if one isn’t provided on creation.

priority

  • Type: String
  • Description: The level of priority for this interaction, can be ‘Low’, ‘Medium’, or ‘High’. Defaults to Medium if one isn’t provided on creation.
  • Type: String
  • Description: A direct link to the bot and the interaction. Can be used as a way of sending the customer directly to a conversation rather than in a popup. Could be used in an email for example.

expiresAt

  • Type: String
  • Description: The timestamp at which this interaction will expire, or null if it does not expire.

createdAt

  • Type: String
  • Description: The timestamp indicating when the interaction was created.

customerId

  • Type: String
  • Description: The internal ID used for the customer in your system.

type

  • Type: String
  • Description: Type or category of the bot, e.g., ‘RG’.

data

  • Type: String
  • Description: This is a JSON string of the interactions history. Contains the evaluation data and the transcript that gets sent via the webhook, can be null when interaction hasn’t started.

Example:

{
  "customer_id": "123456789",
  "interaction_id": "437a1ee7-b569-ee11-b006-6045bdd13058",
  "evaluation": {
    "howfeel_scale": "5",
    "action": "Timeout"
  },
  "transcript": [
    {
      "body": "How do you feel about your behaviour?",
      "timestamp": 1698234096.2698698,
      "type": "bot"
    },
    {
      "body": "i feel fine",
      "timestamp": 1698234096.2698698,
      "type": "customer"
    }
  ]
}

context

  • Type: Array
  • Description: An array of key-value pairs providing additional context for the interaction. Properties to provide can be found in the bot configuration in the bot endpoint.
key
  • Type: String
  • Description: The property key in the context array.
value
  • Type: String
  • Description: The value corresponding to the property key in the context array.

These properties are used in all of the interaction endpoints.


Get Interactions

Endpoint

GET https://api.rdentify.com/v1/workspaces/<workspace-id>/interactions

Retrieve all interactions within a specific workspace.

Response Example

{
    "success": true,
    "code": 200,
    "detail": "Request completed successfully",
    "data": [
        {
            "id": "7aa69441-f468-ee11-b006-6045bdd13058",
            "status": "Pending",
            "priority": "Low",
            "link": "https://landing.rdentify.com/interactions/NzA3ZmRkMmEtNzMzZi00ZWNjLThlNzctYWVkZDRjZGEwZTVkOjdhYTY5NDQxLWY0NjgtZWUxMS1iMDA2LTYwNDViZGQxMzA1OA",
            "expiresAt": null,
            "createdAt": "2023-10-12T11:41:18.4213704",
            "customerId": "987654321",
            "type": "RG",
            "data": null,
            "context": [
                {
                    "key": "property_1",
                    "value": "value_1"
                },
                {
                    "key": "property_2",
                    "value": "value_2"
                }
            ]
        },
        {
            "id": "437a1ee7-b569-ee11-b006-6045bdd13058",
            "status": "Pending",
            "priority": "Low",
            "link": "https://landing.rdentify.com/interactions/NzA3ZmRkMmEtNzMzZi00ZWNjLThlNzctYWVkZDRjZGEwZTVkOjQzN2ExZWU3LWI1NjktZWUxMS1iMDA2LTYwNDViZGQxMzA1OA",
            "expiresAt": null,
            "createdAt": "2023-10-13T10:47:29.2008091",
            "customerId": "123456789",
            "type": "RG",
            "data": null,
            "context": [
                {
                    "key": "property_1",
                    "value": "value_1"
                },
                {
                    "key": "property_2",
                    "value": "value_2"
                }
            ]
        }
    ],
    "meta": {
        "totalResults": 2,
        "totalPages": 1,
        "currentPage": 1,
        "pageSize": 10
    }
}

Get Interaction

Endpoint

GET https://api.rdentify.com/v1/workspaces/<workspace-id>/interactions/<interaction-id>

Retrieve a specific interaction by its ID within a specific workspace.

Response Example

{
    "success": true,
    "code": 200,
    "detail": "Request completed successfully",
    "data": {
        "id": "437a1ee7-b569-ee11-b006-6045bdd13058",
        "status": "Pending",
        "priority": "Low",
        "link": "https://landing.rdentify.com/interactions/NzA3ZmRkMmEtNzMzZi00ZWNjLThlNzctYWVkZDRjZGEwZTVkOjQzN2ExZWU3LWI1NjktZWUxMS1iMDA2LTYwNDViZGQxMzA1OA",
        "expiresAt": null,
        "createdAt": "2023-10-13T10:47:29.2008091",
        "customerId": "123456789",
        "type": "RG",
        "data": null,
        "context": [
            {
                "key": "property_1",
                "value": "value_1"
            },
            {
                "key": "property_2",
                "value": "value_2"
            }
        ]
    },
    "meta": null
}

Create Interaction

Endpoint

POST https://api.rdentify.com/v1/workspaces/<workspace-id>/interactions

Create a new interaction within a specific workspace. If a customer does not exist it will be created as part of this call.

Request Body Example

{
    "customerId": "123456789",
    "botId": "57a9fa6a-f04b-ee11-9937-6045bdf21413",
    "status": "Pending",
    "expiry": 1698234826,
    "priority": "Medium"
}

Response Example

{
    "success": true,
    "code": 200,
    "detail": "Request completed successfully",
    "data": {
        "id": "437a1ee7-b569-ee11-b006-6045bdd13058",
        "status": "Pending",
        "priority": "Low",
        "link": "https://landing.rdentify.com/interactions/NzA3ZmRkMmEtNzMzZi00ZWNjLThlNzctYWVkZDRjZGEwZTVkOjQzN2ExZWU3LWI1NjktZWUxMS1iMDA2LTYwNDViZGQxMzA1OA",
        "expiresAt": null,
        "createdAt": "2023-10-13T10:47:29.2008091",
        "customerId": "123456789",
        "type": "RG",
        "data": null,
        "context": [
            {
                "key": "property_1",
                "value": "value_1"
            },
            {
                "key": "property_2",
                "value": "value_2"
            }
        ]
    },
    "meta": null
}

Update Interaction

Endpoint

PATCH https://api.rdentify.com/v1/workspaces/<workspace-id>/interactions/<interaction-id>

Update an existing interaction within a specific workspace. Properties are optional but at least one required.

Request Body Example

{
    "status": "Pending",
    "priority": "Low",
    "expiry": 1698234826
}

Response Example

{
    "success": true,
    "code": 200,
    "detail": "Request completed successfully",
    "data": {
        "id": "437a1ee7-b569-ee11-b006-6045bdd13058",
        "status": "Pending",
        "priority": "Low",
        "link": "https://landing.rdentify.com/interactions/NzA3ZmRkMmEtNzMzZi00ZWNjLThlNzctYWVkZDRjZGEwZTVkOjQzN2ExZWU3LWI1NjktZWUxMS1iMDA2LTYwNDViZGQxMzA1OA",
        "expiresAt": null,
        "createdAt": "2023-10-13T10:47:29.2008091",
        "customerId": "123456789",
        "type": "RG",
        "data": null,
        "context": [
            {
                "key": "property_1",
                "value": "value_1"
            },
            {
                "key": "property_2",
                "value": "value_2"
            }
        ]
    },
    "meta": null
}