Data Connectors

Connect your own APIs to the TextPeak Inbox so agents can see and act on CRM, billing, or order data in conversations. Learn how to build, test, and publish a connector and read its request logs.

A data connector calls one of your own APIs, such as your CRM, billing, or order system, so your agents can see and act on that data without leaving a conversation. You build the request once, test it against your API, and choose which fields of the response agents get to see. Sidebar widgets then show that data inside the conversation.

Screenshot of a conversation with the Order summary sidebar widget showing order items and totals from a data connector

Data from your API in a conversation's Sidebar widgets section

This article walks you through creating, testing, and publishing a connector, and checking the calls it makes.

📘

NOTE

To create and manage data connectors, you need the Inbox admin role, or an Inbox manager role with the Manage data connectors permission. For a breakdown of what each role can do, see the Inbox Role Permissions page.

To open the Data Connectors page:

Log in to TextPeak

In your browser, log in to TextPeak with manager access privileges.

Open Inbox

In the main TextPeak menu, select the Inbox tab.

Open Settings

Click Settings at the bottom of the Inbox sidebar.

Open Data Connectors

In the Automation group, click Data Connectors.

Screenshot of the Data Connectors page listing connectors with their Published or Draft status

The Data Connectors page

Each connector appears as a card with its status, Published or Draft, the number of sidebar widgets built on it, and the number of fields it saves. Use Manage to open a connector and Delete to remove it.

How a connector works

A connector is one API request that TextPeak sends on your behalf:

  • Request: the method, the address, the headers, and the body TextPeak sends. Tokens in the request are replaced with details from the conversation, such as the contact's phone number, or with values the agent enters.
  • Fields: the parts of the response you choose to save, each with a label agents read.
  • Widgets: a sidebar widget picks a published connector and shows its fields in the conversation. A widget never receives the raw response, only the fields you saved.

A connector can fetch data, for example a full CRM record found by the contact's phone number, or take an action in your platform, for example a refund with an amount the agent enters.

Creating a connector

A new connector goes through four steps: Details, Request, Test & fields, and Publish.

Naming the connector

Start a new connector

On the Data Connectors page, click New connector.

Name the connector

In Name, enter a name. It identifies the connector in settings and in the request logs.

Describe the connector

Optionally, in Description, add a line of context for whoever maintains the connector later.

Continue

Click Next.

Screenshot of the Details step of a new data connector with the Name and Description fields

Step 1 of 4: Details

Setting up the request

Choose a credential

If your API needs a key or a token, click Choose a credential and select a saved credential or create one. See Adding a credential.

Add the values agents fill in

Under Values you'll fill in later, click Add value for each detail the agent supplies when the connector runs, such as an order number or a refund amount. Enter its Name, select its Type (string, number, or boolean), and select whether it is Required or Optional. Each value becomes a token, such as {{input.order_id}}. A lookup that needs only the contact's details does not need any values.

Enter the address

Under Call, select the method (GET, POST, PUT, PATCH, or DELETE) and enter the address of your API. The address must start with https://. To add a token, click Insert token and select it from the list.

Add headers

Under Headers, enter a Key and a Value for each header your API expects, such as Accept and application/json. To send a credential, reference it in a header value, for example Bearer followed by its token. Click Add header for more.

Write the body

For a POST, PUT, PATCH, or DELETE request, write the JSON body in the Body editor. You can insert tokens here too. A GET request has no body.

Set the timeout

In Timeout, enter how long TextPeak waits for your API to answer, between 1000 and 15000 ms. The default is 10000 ms.

Save the request

Click Save & next.

Screenshot of the Request step of a data connector showing a value, the GET address with a token, and an Accept header

Step 2 of 4: Request

LimitValue
Values you'll fill in laterUp to 25
HeadersUp to 20
Timeout1000–15000 ms
Tokens in the addressIn the path and the query string only, not in the domain
👍

TIP

Set the timeout as short as your API allows. A widget that runs when a conversation opens waits for the connector, and a slow answer leaves the agent looking at an empty widget.

Tokens from the conversation

Click Insert token next to the address, a header, or the body to add any of these. TextPeak replaces each token with the value from the conversation the connector runs in.

TokenReplaced with
{{contact.phone}}The contact's phone number
{{contact.name}}The contact's name
{{contact.id}}The contact's ID in TextPeak
{{contact.lead_id}}The contact's lead ID
{{contact.external_id}}The contact's external ID
{{conversation.uuid}}The conversation's unique ID
{{conversation.status}}The conversation's status, for example open
{{conversation.vendor}}The channel the conversation is on, for example whatsapp
{{conversation.subject}}The conversation's subject
{{stream.uuid}}The unique ID of the channel the conversation arrived on
{{stream.account_phone_number}}The phone number of that channel
{{input.<name>}}The value the agent enters for a value you added under Values you'll fill in later
Screenshot of the Insert token list showing the contact, conversation, and stream tokens with sample values

The Insert token list

Testing the connector and choosing fields

The test calls your API for real, so you see exactly what comes back before agents do.

Fill in the test values

Under Values for this test run, enter a real value for each token in your request, such as an order number that exists in your system. TextPeak uses these values for this test only and never saves them.

Run the test

Click Run test. When the call succeeds, Test passed shows the status code, the response time, and the number of records. What we sent shows the request with the tokens filled in, and Their response shows what your API returned.

Pick the fields

Under Fields to keep, select the fields you want agents to see. Each field shows its type and a sample value; use Search fields to find one in a long response. If the response holds a list, such as the items of an order, agents get one row per item.

Label the fields

In Label, enter the name agents see for each selected field.

Continue

Click Save & next. You need at least one field to continue.

Screenshot of the Test and fields step showing a passed test, the request sent, the API response, and the fields picked with their labels

Step 3 of 4: Test & fields

If the test fails, check the address, the headers, and the test values, then click Run again.

Publishing the connector

The Publish step shows the connector exactly as it was tested: its name, description, address, headers, credential, values, timeout, and the fields agents will see.

Review the connector

Check the summary. To change anything, click Back.

Publish

Click Publish connector.

Screenshot of the Publish step of a data connector showing the tested settings and the four fields agents will see

Step 4 of 4: Publish

Publishing makes this version the one agents see, and the connector can now carry sidebar widgets. A connector you leave before publishing stays on the list as a Draft.

Adding a credential

Credentials hold the keys and tokens your API needs. You save a credential once and reuse it in other connectors. TextPeak stores secrets encrypted and never shows them back, only their last four characters.

Open the credentials

On the Request step, click Choose a credential.

Create a credential

Open the Create new tab.

Name the credential

In Name, enter the name the credential is listed under.

Add the keys

Under Keys and values, enter each Key and its Value. Keys use lowercase letters, digits, and underscores. Click Add key for more.

Save the credential

Click Save and use.

Screenshot of the Connector credentials dialog with the Create new tab open, showing the Name field and the Keys and values rows

Creating a credential in Connector credentials

Each key becomes a token, {{credentials.<key>}}, that you place in a header yourself. For example, a credential with the key token goes into an Authorization header as Bearer {{credentials.token}}. To reuse a credential, open the Saved credentials tab, select it, and click Use credential.

Changing a connector

Open the connector

On the Data Connectors page, click Manage on the connector.

Make your changes

Change the request under Connector settings, or rename field labels under Fields agents see.

Test again

If you changed the request, run a new test. Save changes stays disabled until the connector passes a test with the new settings.

Save the changes

Click Save changes. To undo your edits instead, click Discard.

A renamed label updates every sidebar widget built on the connector.

Checking the request logs

The Request logs tab lists every call your connectors make, newest first.

Screenshot of the Request logs tab showing calls with their connector, time sent, status, trigger, method, and URL

The Request logs tab

ColumnWhat it shows
Connector NameThe connector that made the call.
Sent AtThe date and time of the call.
StatusOK or ERROR, with the HTTP status code your API returned.
TriggerOn Load when a widget ran as the conversation opened, or Manual when an agent ran it.
MethodThe HTTP method.
URLThe address called, with the tokens filled in.
DetailsClick View to see the request with its headers and the response your API returned. Secret header values are masked.

To narrow the list, filter by Connector, URL, Trigger, or Date range, then click Search.

👍

TIP

When a widget shows nothing, check the request logs first. An ERROR status with a 401 or 403 code usually means a credential problem; a 404 usually means the address or a token value is wrong.

Deleting a connector

On the Data Connectors page, click Delete on the connector and confirm.

🚧

WARNING

Before you delete a connector, check its card: it shows how many sidebar widgets are built on it. Those widgets get their data from this connector only.

To show a connector's data to agents, see the Sidebar Widgets page. For the rest of the manager options, see the Manager's Guide: Inbox Settings page.


Did this page help you?