-
Notifications
You must be signed in to change notification settings - Fork 1
/
conversation.go
78 lines (61 loc) · 2.56 KB
/
conversation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package client
import (
"time"
)
// Channel represents the way a customer is getting in touch. It will be used to
// determine how the agent formats responses, etc.
type Channel string
const (
// ChannelWeb indicates the customer is getting in touch via a live instant
// message chat.
ChannelWeb Channel = "web"
// ChannelEmail indicates the customer is getting in touch via an email.
ChannelEmail Channel = "email"
)
// Status describes the current state of the conversation.
type Status string
const (
// StatusObserving indicates the agent is following the conversation but not
// participating (e.g. when it has been handed-off to a human).
StatusObserving Status = "observing"
// StatusActive indicates the agent is actively participating in the
// conversation.
StatusActive Status = "active"
// StatusCancelled indicates the conversation has been prematurely brought to
// a close (e.g. because a human has taken it over) and the AI agent can no
// longer participate in it.
StatusCancelled Status = "cancelled"
// StatusFinished indicates the conversation has been closed because the
// customer's issue has been resolved.
StatusFinished Status = "finished"
// StatusFailed indicates the agent encountered an irrecoverable error, such as
// not being able to deliver a message to your webhook endpoint after multiple
// retries.
StatusFailed Status = "failed"
)
// Conversation represents a series of messages between a customer, human agent,
// and the AI Agent.
type Conversation struct {
// ID uniquely identifies the conversation.
//
// Can be anything consisting of letters, numbers, or any of the following
// characters: _ - + =.
//
// Tip: use something meaningful to your business (e.g. a ticket number).
ID string `json:"id"`
// CustomerID uniquely identifies the customer. Used to build historical
// context of conversations the agent has had with this customer.
CustomerID string `json:"customer_id"`
// Channel represents the way a customer is getting in touch. It will be used
// to determine how the agent formats responses, etc.
Channel Channel `json:"channel"`
// Metadata is arbitrary metadata that will be attached to the conversation.
// It will be passed along with webhooks so can be used as action parameters.
Metadata any `json:"metadata"`
// Created is the time at which the conversation was created.
Created time.Time `json:"created"`
// Updated is the time at which the conversation was last updated.
Updated time.Time `json:"updated"`
// Status describes the current state of the conversation.
Status Status `json:"status"`
}