Conversation Service

Our Conversation Service API comprehensively manages the entire lifecycle of conversations—enabling creation, updates (audio persistence, display name, language, sharing, skill, state, and metadata), retrieval, redaction or deletion of messages, tagging, event logging, batch operations, and final closure—providing robust end-to-end conversation management.

Languages
Servers
https://{api-domain}.cresta.com/

ConversationService

Operations

UpsertConversationMetadata upserts upsertitional metadata to a conversation.

Request

When new metadata is upserted to the Conversation, or existing metadata value is updated, a ConversationEvent with type of CONVERSATION_METADATA will be automatically created. The ConversationEvent may result in new MomentAnnotations of type CONVERSATION_METADATA, as documented in [ConversationMetadata][].

Path
conversationstringrequired

Resource name of the Conversation to upsert metadata to.

Format: customers/{customer_id}/profiles/{profile_id}/conversations/{conversation_id}

Bodyapplication/jsonrequired
metadataValuesobject

The key and values of the conversation metadata field. Each key can be mapped to one or more values.

The key should be the taxonomy of a MomentTemplate of type CONVERSATION_METADATA, otherwise no MomentAnnotation will be generated for that key.

Nested values are not supported, but can be achieved by using dot separated keys. e.g.

"builtin.visitor.geo.country": {"values": ["US"]}, "builtin.visitor.geo.state": {"values": ["CA"]},

If a key in metadata_values does not exist in the Conversation's current metadata values, it will be added to the Conversation's metadata. If it already exists, the Conversation's metadata with the same key will be replaced with the key's value in metadata_values. In other words, values to existing key are replaced, not concatenated.

If a key exists in the Conversation's metadata but not in metadata_values, it won't be removed.

sourcestring(Where the metadata value originated from)
  • SOURCE_UNSPECIFIED: Invalid - do not use.
  • SOURCE_CCAAS: Provided by the Contact Center as a Service (CCaaS) system the conversation is handled by (e.g. Five9, Genesys, LivePerson, AmazonConnect, ...).
  • SOURCE_FILE: Ingested from a file.
  • SOURCE_CRM: Provided by a 3rd party CRM system (e.g. via Burger).
  • SOURCE_VA: Generic source for metadata in virtual agent conversations. In VA conversations it's sometimes hard to distinguish where a certain piece of metadata comes from and we don't try to break it down granularly.

Some examples:

  1. Visitor-provided information like a codeword they spoke or a name they entered into a form.
  2. Information from calls to the customer's APIs, e.g., the expected last 4 digits of an SSN for authentication.
  3. Data from integrations, e.g., the phone number of the caller passed through from Twilio.
Default "SOURCE_UNSPECIFIED"
Enum"SOURCE_UNSPECIFIED""SOURCE_CCAAS""SOURCE_FILE""SOURCE_CRM""SOURCE_VA"
skipAnnotationsboolean

If set to true, this API call won't trigger orchestrator to generate moment/action annotations. If not set to true, if the conversation has skip_annotations=true in StartConversationRequest.feature_override, it won't trigger as well.

saveConversationMetadataAnnotationboolean

Only takes effect if skip_annotations is set to true in the request or in StartConversationRequest.feature_override If set to true, this API call will still call orchestrator but configure it only insert CONVERSATION_METADATA type of moment annotations.

indexClosedConversationsboolean

If set to true, this API call will index the conversation if it's already closed.

curl -i -X POST \
  'https://{api-domain}.cresta.com/v1/{conversation}:upsertMetadata' \
  -H 'Content-Type: application/json' \
  -d '{
    "metadataValues": {
      "property1": {
        "values": [
          {
            "numberValue": 0.1,
            "stringValue": "string",
            "booleanValue": true
          }
        ]
      },
      "property2": {
        "values": [
          {
            "numberValue": 0.1,
            "stringValue": "string",
            "booleanValue": true
          }
        ]
      }
    },
    "source": "SOURCE_UNSPECIFIED",
    "skipAnnotations": true,
    "saveConversationMetadataAnnotation": true,
    "indexClosedConversations": true
  }'

Responses

A successful response.

Bodyapplication/json
conversationMetadataEventstring(DEPRECATED - use conversation_event instead. the resource name of the conversation metadata event if there was a diff OR empty when there was no metadata change Format: customers/{customer_id}/profiles/{profile_id}/conversations/{conversation_id}/events/{event_id})
conversationEventobject(Event is a non-message information in a Conversation. NEXT ID: 26)
Response
application/json
{ "conversationMetadataEvent": "string", "conversationEvent": { "name": "string", "associatedMessage": "string", "associatedActionAnnotation": "string", "type": "EVENT_TYPE_UNSPECIFIED", "callReason": {}, "entityFeedback": {}, "summarizationFeedback": {}, "usedSuggestion": {}, "usedHintSuggestion": {}, "interactiveVoiceResponse": {}, "conversationMetadata": {}, "usedHintDocumentChip": {}, "usedSearchSuggestion": {}, "usedKbSearch": {}, "usedKbDocument": {}, "conversationLanguageChange": {}, "usedSummarization": {}, "usedNoteTaking": {}, "conversationTextPasted": {}, "kaGenAiReplyFeedback": {}, "kaGenAiReplyCopied": {}, "kaGenAiReplyInserted": {}, "usedSmartCompose": {}, "kaGenAiExtractedQuestionFeedback": {}, "topicSubmission": {}, "createTime": "2019-08-24T14:15:22Z" } }

Deletes a conversation message from the apps DB.

Request

Only conversations with source of STUDIO_SYNTHETIC_ANNOTATION, STUDIO_USER_DEFINED, OPERA_SYNTHETIC and OPERA_SIMULATION support deletion of conversation message. If the conversation does not exist, it returns a NOT_FOUND (404) error. If the conversation exists, but the source is not supporting the operation, it will throw FAILED_PRECONDITION error (HTTP status code 400).

Path
namestringrequired

The resource name of the conversation to be deleted.

curl -i -X DELETE \
  'https://{api-domain}.cresta.com/v1/{name=customers/*/profiles/*/conversations/*/messages/*}'

Responses

A successful response.

Bodyapplication/json
object(Response of [ConversationService.DeleteConversationMessage][])
Response
application/json
{}

Redact a substring of a conversation message. Currently only cresta admins can redact a message.

Request

Path
namestringrequired

The resource name of the conversation message to be redacted. Format: customers/{customer_id}/profiles/{profile_id}/conversations/{conversation_id}/messages/{message_id}

Bodyapplication/jsonrequired
momentstring(The moment resource name, used for creating a moment annotation. The moment should be of type ENTITY Format: customers/{customer_id}/profiles/{profile_id}/moments/{moment_id})required
startIndexinteger(int32)required

The start byte index (including) of the text to be redacted.

endIndexinteger(int32)required

The end byte index (exclusive) of the text to be redacted.

curl -i -X POST \
  'https://{api-domain}.cresta.com/v1/{name=customers/*/profiles/*/conversations/*/messages/*}:redact' \
  -H 'Content-Type: application/json' \
  -d '{
    "moment": "string",
    "startIndex": 0,
    "endIndex": 0
  }'

Responses

A successful response.

Bodyapplication/json
conversationMessageobject(A message in a Conversation. Next ID: 22)
Response
application/json
{ "conversationMessage": { "name": "string", "legacyMessageId": 0, "text": "string", "textHtml": "string", "transcriptionInfo": {}, "agent": "string", "speaker": "ROLE_UNSPECIFIED", "speakerInfo": {}, "state": "STATE_UNSPECIFIED", "sequencePosition": 0, "createTime": "2019-08-24T14:15:22Z", "updateTime": "2019-08-24T14:15:22Z", "audioStartOffset": "string", "audioEndOffset": "string", "originalEventData": {}, "usedSuggestionId": "string", "usedCoachSuggestionId": "string", "redaction": {}, "botData": {}, "isTransferred": true, "email": {} } }