Rest Connector

Easily connect our resources to your client's by using our Rest Connector cell within Syntphony CAI platform.

Rest Connector Cells use Dynamic Content. Hence, we highly recommend you reading the dedicated page to ensure a comprehensive understanding.

Rest Connectors

The Rest Connector cell executes the Rest Request you configure based on user inputs and retrieves the results into a designated hiddenContext parameter.

Each Rest Connector cell has its own unique URL and requires an Authentication step. This allows you to incorporate different APIs and integrations into your existing flow.

This cell requires some development expertise and and familiarity with the APIs you are integrating. If you're not a developer, reach your development team beforehand to clarify the desired outcomes you are aiming for.

Creating a Rest Connector cell

To create a Rest Connector cell, proceed to the "Advanced Options" on the cells library, select the option Service to choose between Webhook (transactional service) or Rest Connector.

After you clicked Rest Connector, you'll see the modal to create the service cell. Name it and insert your URL.

You may then provide any amount of header pairs you need, and you will fill your Request type and then your content-type, which will include items available for the Request Type you chose. As of now, PATCH is unavailable.

It is important you DO NOT fill in Authentication headers just yet. Those will be handled at a proper step, seen below.

The last field you must fill is the Body. This may be empty, and otherwise should meet the expected body type criteria.

Since this cell is intended to access APIs you have access to, we do not validate the correctness of the body. It is expected that you can debug the integration using your own logs.

You can describe it and add up to 5 tags. After that, you can add options.

Authentication

The last and mandatory part to fill in is the Authentication. Just above the URL, you'll see the "Edit the Authentication service" text button. Click it to choose from the available Authentication types. Those will either require you to simply fill a static Basic or Bearer authentication, or allow you to setup an oAuth2 form.

The oAuth2 form allows you to choose between Password and Client Credentials. By selecting this, a separate call will be used immediately before the configured cell's, and it's resulting body will be used as it's Bearers header.

Result handling

Lastly, the remaining field is "Output". This field works exactly as in the Code cell. You may parse the result however you want, and on that moment and that alone. The result will always be available as "hiddenContext.RestConnectorResponse". From there, you can choose to extract and handle specific parts, similar to how you would do it in a Code cell.

This cell contains branching paths. If the request and it's parsing were successful, the flow will continue. For a scenario where the Authorization, request, or handling fails, Syntphony CAI creates a service error option automatically. As service errors are treated like any other service option, you can add answers after it.

Dynamic Fields

Much like other cells, some fields in the Rest Connector are compliant with Dynamic Content. You may access any environment-defined parameter, bot-defined parameter or user context and you will have its data filled during execution. The fields are:

  • Url

  • Body

  • Authentication fields

  • Headers

This means that you can use ongoing conversation data such as previous results stored in context variables or user inputs into your API.

This tools is particularly useful if you handle user input and format it with the assistance of Generative cells.

Last updated