> For the complete documentation index, see [llms.txt](https://docs.systemsx.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.systemsx.co.uk/sense/assist-integration.md).

# Assist - Integration

## Authenticating an Agent

<mark style="color:green;">`POST`</mark> `/v2/assist/authenticate`

Used on load of the Sense page to gain an access\_token for the Javascript to load.

**Body**

| Name       | Type   | Description     |
| ---------- | ------ | --------------- |
| `api_key`  | string | Account API Key |
| `agent_id` | int    | View API Agents |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "access_token": "",
    "expires_at": "2029-01-01T18:39:59.707469Z"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

## HTML Setup

```
divs
assist_client_name
assist_client_email_address
assist_client_phone_number
assist_client_location
assist_client_date_of_birth
assist_client_created_at
assist_client_source
assist_client_holder
assist_client_tags
assist_buttons
assist_response_loading [innerHTML required]
assist_response
assist_mistakes
assist_actions

products
assist_product_calls
assist_product_communication
assist_recent_communication

modal
assist_modal
assist_modal_title
assist_modal_body
assist_modal_alert
assist_modal_label_subject
assist_modal_textarea_subject
assist_modal_label
assist_modal_textarea
assist_modal_templates
assist_modal_buttons
assist_modal_footer
assist_modal_send

textareas
assist_jotter

inputs
assist_ask_input

buttons
assist_ask_button
```

## Javascript Setup

| Param                    | Description                                                       |
| ------------------------ | ----------------------------------------------------------------- |
| `accessToken`            | Provided by [Broken mention](broken://pages/QAxDgqFKAs1xWqDQlDNH) |
| `jotter`                 | eg: Previous jotter notes saved                                   |
| `details[unique_id]`     | Used by CRMs for Sync                                             |
| `details[ip_address]`    | eg: 123.456.789.0                                                 |
| `details[name]`          | eg: John Doe                                                      |
| `details[email_address]` | eg: <example@example.com>                                         |
| `details[phone_number]`  | eg: +447377357971                                                 |
| `details[date_of_birth]` | eg: 01/05/2000                                                    |
| `details[location]`      | eg: Cardiff, United Kingdom                                       |
| `details[biography]`     | Summary of the Customer                                           |
| `details[tags]`          | eg: vip,member,business                                           |

```html
<script type="module">

    const senseConfiguration = {
        accessToken: "ACCESS_TOKEN_HERE",
        disableProducts: [], // calls, communication
        contact: {
            jotter: "2 adults, Costa Del Sol, CWL or BRS, 7 nights, all inclusive", // Overrides Jotter default value.
            details: {
                // unique_id, ip_address, name, email_address, phone_number, date_of_birth, location, biography, tags (vip,example_tax)
                name: "",
                email_address: "",
                phone_number: "",
                location: ""
            },
            preferences: {
                vip: true
            }
        },
        classes: {
            hidden: 'hidden',
            assist: {
                output: {
                    ul: 'list-group sx-fs-16 mb-2',
                    li: 'list-group-item sx-lh'
                },
                rating: {
                    like: 'btn btn-default',
                    dislike: 'btn btn-default'
                }
            },
            contact: {
                tags: {
                    "default": 'badge badge-outline badge-light',
                    "Vip": 'badge badge-outline badge-gold'
                }
            },
            actions: {
                div: 'col',
                buttons: {
                    default: 'btn btn-primary btn-block mb-2',
                    send_email: 'btn btn-primary btn-block mb-2',
                    send_meeting: 'btn btn-primary btn-block mb-2',
                    send_sms: 'btn btn-light btn-block',
                    send_whatsapp: 'btn btn-light btn-block',
                }
            },
            jotter: {
                buttons: {
                    default: 'btn btn-primary mr-2',
                    narrow_down: 'btn btn-primary mr-2',
                    recommend: 'btn btn-primary'
                }
            },
            products: {
                calls: {
                    score: {
                        circle_color: "avatar-",
                        circle_span: "initial-wrap"
                    },
                    summary: {
                        button: "btn btn-primary btn-sm btn-block"
                    },
                    tasks: {
                        li_header: "list-group-item sx-lh sx-text-dark",
                        li_task: "list-group-item d-flex justify-content-between align-items-center",
                        li_footer: "list-group-item sx-lh sx-text-dark",
                        li_button: "btn btn-primary btn-sm btn-block"
                    },
                    feedback: {
                        li_header: "list-group-item sx-lh sx-text-dark",
                        li_good: "list-group-item sx-lh list-group-item-success",
                        li_bad: "list-group-item sx-lh list-group-item-danger",
                        li_improve: "list-group-item sx-lh list-group-item-warning"
                    }
                }
            }
        },
        lang: {
            assist: {
                mistakes: "*Sense Assist can make mistakes. Always check important info."
            },
            actions: {
                buttons: {
                    email: 'Send Email',
                    meeting: 'Send Meeting',
                    sms: 'Send SMS',
                    whatsapp: 'Send WhatsApp',
                }
            },
            jotter: {
                buttons: {
                    narrow_down: 'Narrow Down',
                    recommend: 'Recommend'
                }
            },
            products: {
                calls: {
                    summary: {
                        title: "Call Summary",
                        button: "Add to Notes"
                    },
                    score: {
                        description: "Your last call was rated [X]"
                    },
                    tasks: {
                        title: "Call Tasks",
                        button: "Add To Tasks",
                    },
                    feedback: {
                        title: "Call Feedback"
                    }
                }
            }
        }
    };

    // Importing from a remote URL
    import('https://api.sense-ai.co.uk/js/assist/core.js').then(module => {
        // Run the load function from the core.js with the configuration
        module.senseAssist.load(senseConfiguration);
    }).catch(error => console.error('Error loading the module:', error));

</script>

```
