sentdm 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +1 -1
  4. data/lib/sentdm/internal/voice_agents_page.rb +115 -0
  5. data/lib/sentdm/models/call_event.rb +8 -6
  6. data/lib/sentdm/models/call_event_payload.rb +25 -6
  7. data/lib/sentdm/models/channels/voice_create_params.rb +23 -11
  8. data/lib/sentdm/models/channels/voice_number.rb +23 -1
  9. data/lib/sentdm/models/channels/voice_update_params.rb +12 -1
  10. data/lib/sentdm/models/voice/agent_create_params.rb +142 -0
  11. data/lib/sentdm/models/voice/agent_delete_params.rb +28 -0
  12. data/lib/sentdm/models/voice/agent_list_params.rb +38 -0
  13. data/lib/sentdm/models/voice/agent_retrieve_params.rb +28 -0
  14. data/lib/sentdm/models/voice/agent_rotate_secret_params.rb +34 -0
  15. data/lib/sentdm/models/voice/agent_update_params.rb +141 -0
  16. data/lib/sentdm/models/voice/api_response_of_voice_agent.rb +51 -0
  17. data/lib/sentdm/models/voice/api_response_of_voice_agent_secret.rb +45 -0
  18. data/lib/sentdm/models/voice/api_response_of_voice_agents_list.rb +48 -0
  19. data/lib/sentdm/models/voice/api_response_of_voice_catalogue.rb +49 -0
  20. data/lib/sentdm/models/voice/call.rb +97 -5
  21. data/lib/sentdm/models/voice/call_list_params.rb +19 -1
  22. data/lib/sentdm/models/voice/catalogue_list_params.rb +22 -0
  23. data/lib/sentdm/models/voice/voice_agent.rb +138 -0
  24. data/lib/sentdm/models/voice/voice_agent_audio.rb +19 -0
  25. data/lib/sentdm/models/voice/voice_agent_audio_spec.rb +20 -0
  26. data/lib/sentdm/models/voice/voice_agent_limits.rb +31 -0
  27. data/lib/sentdm/models/voice/voice_agent_limits_spec.rb +40 -0
  28. data/lib/sentdm/models/voice/voice_agent_party.rb +25 -0
  29. data/lib/sentdm/models/voice/voice_agent_party_spec.rb +28 -0
  30. data/lib/sentdm/models/voice/voice_agent_secret.rb +27 -0
  31. data/lib/sentdm/models/voice/voice_agent_speech.rb +31 -0
  32. data/lib/sentdm/models/voice/voice_agent_speech_spec.rb +40 -0
  33. data/lib/sentdm/models/voice/voice_agent_transcripts.rb +25 -0
  34. data/lib/sentdm/models/voice/voice_agent_transcripts_spec.rb +32 -0
  35. data/lib/sentdm/models/voice/voice_agents_list.rb +30 -0
  36. data/lib/sentdm/models/voice/voice_catalogue.rb +30 -0
  37. data/lib/sentdm/models/voice/voice_catalogue_voice.rb +43 -0
  38. data/lib/sentdm/models/webhook_create_params.rb +31 -5
  39. data/lib/sentdm/models/webhook_response.rb +66 -4
  40. data/lib/sentdm/models/webhook_update_params.rb +15 -3
  41. data/lib/sentdm/resources/channels/voice.rb +38 -15
  42. data/lib/sentdm/resources/profiles/campaigns.rb +3 -2
  43. data/lib/sentdm/resources/voice/agents.rb +319 -0
  44. data/lib/sentdm/resources/voice/calls/participants.rb +11 -0
  45. data/lib/sentdm/resources/voice/calls.rb +44 -13
  46. data/lib/sentdm/resources/voice/catalogue.rb +71 -0
  47. data/lib/sentdm/resources/voice/tokens.rb +11 -0
  48. data/lib/sentdm/resources/voice.rb +86 -0
  49. data/lib/sentdm/resources/webhooks.rb +43 -15
  50. data/lib/sentdm/version.rb +1 -1
  51. data/lib/sentdm.rb +29 -0
  52. data/rbi/sentdm/internal/voice_agents_page.rbi +71 -0
  53. data/rbi/sentdm/models/call_event.rbi +14 -10
  54. data/rbi/sentdm/models/call_event_payload.rbi +28 -5
  55. data/rbi/sentdm/models/channels/voice_create_params.rbi +33 -17
  56. data/rbi/sentdm/models/channels/voice_number.rbi +31 -0
  57. data/rbi/sentdm/models/channels/voice_update_params.rbi +14 -0
  58. data/rbi/sentdm/models/voice/agent_create_params.rbi +215 -0
  59. data/rbi/sentdm/models/voice/agent_delete_params.rbi +48 -0
  60. data/rbi/sentdm/models/voice/agent_list_params.rbi +66 -0
  61. data/rbi/sentdm/models/voice/agent_retrieve_params.rbi +48 -0
  62. data/rbi/sentdm/models/voice/agent_rotate_secret_params.rbi +64 -0
  63. data/rbi/sentdm/models/voice/agent_update_params.rbi +211 -0
  64. data/rbi/sentdm/models/voice/api_response_of_voice_agent.rbi +85 -0
  65. data/rbi/sentdm/models/voice/api_response_of_voice_agent_secret.rbi +81 -0
  66. data/rbi/sentdm/models/voice/api_response_of_voice_agents_list.rbi +83 -0
  67. data/rbi/sentdm/models/voice/api_response_of_voice_catalogue.rbi +83 -0
  68. data/rbi/sentdm/models/voice/call.rbi +141 -8
  69. data/rbi/sentdm/models/voice/call_list_params.rbi +20 -0
  70. data/rbi/sentdm/models/voice/catalogue_list_params.rbi +40 -0
  71. data/rbi/sentdm/models/voice/voice_agent.rbi +196 -0
  72. data/rbi/sentdm/models/voice/voice_agent_audio.rbi +30 -0
  73. data/rbi/sentdm/models/voice/voice_agent_audio_spec.rbi +33 -0
  74. data/rbi/sentdm/models/voice/voice_agent_limits.rbi +57 -0
  75. data/rbi/sentdm/models/voice/voice_agent_limits_spec.rbi +62 -0
  76. data/rbi/sentdm/models/voice/voice_agent_party.rbi +36 -0
  77. data/rbi/sentdm/models/voice/voice_agent_party_spec.rbi +45 -0
  78. data/rbi/sentdm/models/voice/voice_agent_secret.rbi +37 -0
  79. data/rbi/sentdm/models/voice/voice_agent_speech.rbi +48 -0
  80. data/rbi/sentdm/models/voice/voice_agent_speech_spec.rbi +62 -0
  81. data/rbi/sentdm/models/voice/voice_agent_transcripts.rbi +43 -0
  82. data/rbi/sentdm/models/voice/voice_agent_transcripts_spec.rbi +51 -0
  83. data/rbi/sentdm/models/voice/voice_agents_list.rbi +55 -0
  84. data/rbi/sentdm/models/voice/voice_catalogue.rbi +59 -0
  85. data/rbi/sentdm/models/voice/voice_catalogue_voice.rbi +75 -0
  86. data/rbi/sentdm/models/webhook_create_params.rbi +41 -3
  87. data/rbi/sentdm/models/webhook_response.rbi +112 -3
  88. data/rbi/sentdm/models/webhook_update_params.rbi +18 -3
  89. data/rbi/sentdm/resources/channels/voice.rbi +52 -19
  90. data/rbi/sentdm/resources/profiles/campaigns.rbi +3 -2
  91. data/rbi/sentdm/resources/voice/agents.rbi +316 -0
  92. data/rbi/sentdm/resources/voice/calls/participants.rbi +11 -0
  93. data/rbi/sentdm/resources/voice/calls.rbi +46 -11
  94. data/rbi/sentdm/resources/voice/catalogue.rbi +59 -0
  95. data/rbi/sentdm/resources/voice/tokens.rbi +11 -0
  96. data/rbi/sentdm/resources/voice.rbi +84 -0
  97. data/rbi/sentdm/resources/webhooks.rbi +56 -16
  98. data/sig/sentdm/internal/voice_agents_page.rbs +41 -0
  99. data/sig/sentdm/models/call_event_payload.rbs +12 -0
  100. data/sig/sentdm/models/channels/voice_create_params.rbs +9 -4
  101. data/sig/sentdm/models/channels/voice_number.rbs +12 -0
  102. data/sig/sentdm/models/channels/voice_update_params.rbs +5 -0
  103. data/sig/sentdm/models/voice/agent_create_params.rbs +99 -0
  104. data/sig/sentdm/models/voice/agent_delete_params.rbs +34 -0
  105. data/sig/sentdm/models/voice/agent_list_params.rbs +40 -0
  106. data/sig/sentdm/models/voice/agent_retrieve_params.rbs +32 -0
  107. data/sig/sentdm/models/voice/agent_rotate_secret_params.rbs +40 -0
  108. data/sig/sentdm/models/voice/agent_update_params.rbs +108 -0
  109. data/sig/sentdm/models/voice/api_response_of_voice_agent.rbs +41 -0
  110. data/sig/sentdm/models/voice/api_response_of_voice_agent_secret.rbs +41 -0
  111. data/sig/sentdm/models/voice/api_response_of_voice_agents_list.rbs +41 -0
  112. data/sig/sentdm/models/voice/api_response_of_voice_catalogue.rbs +41 -0
  113. data/sig/sentdm/models/voice/call.rbs +65 -0
  114. data/sig/sentdm/models/voice/call_list_params.rbs +10 -0
  115. data/sig/sentdm/models/voice/catalogue_list_params.rbs +27 -0
  116. data/sig/sentdm/models/voice/voice_agent.rbs +116 -0
  117. data/sig/sentdm/models/voice/voice_agent_audio.rbs +19 -0
  118. data/sig/sentdm/models/voice/voice_agent_audio_spec.rbs +17 -0
  119. data/sig/sentdm/models/voice/voice_agent_limits.rbs +38 -0
  120. data/sig/sentdm/models/voice/voice_agent_limits_spec.rbs +34 -0
  121. data/sig/sentdm/models/voice/voice_agent_party.rbs +23 -0
  122. data/sig/sentdm/models/voice/voice_agent_party_spec.rbs +19 -0
  123. data/sig/sentdm/models/voice/voice_agent_secret.rbs +19 -0
  124. data/sig/sentdm/models/voice/voice_agent_speech.rbs +32 -0
  125. data/sig/sentdm/models/voice/voice_agent_speech_spec.rbs +26 -0
  126. data/sig/sentdm/models/voice/voice_agent_transcripts.rbs +23 -0
  127. data/sig/sentdm/models/voice/voice_agent_transcripts_spec.rbs +20 -0
  128. data/sig/sentdm/models/voice/voice_agents_list.rbs +35 -0
  129. data/sig/sentdm/models/voice/voice_catalogue.rbs +35 -0
  130. data/sig/sentdm/models/voice/voice_catalogue_voice.rbs +42 -0
  131. data/sig/sentdm/models/webhook_create_params.rbs +12 -0
  132. data/sig/sentdm/models/webhook_response.rbs +46 -3
  133. data/sig/sentdm/models/webhook_update_params.rbs +5 -0
  134. data/sig/sentdm/resources/channels/voice.rbs +3 -1
  135. data/sig/sentdm/resources/voice/agents.rbs +74 -0
  136. data/sig/sentdm/resources/voice/calls.rbs +2 -0
  137. data/sig/sentdm/resources/voice/catalogue.rbs +14 -0
  138. data/sig/sentdm/resources/voice.rbs +4 -0
  139. data/sig/sentdm/resources/webhooks.rbs +3 -0
  140. metadata +89 -2
@@ -20,6 +20,17 @@ module Sentdm
20
20
  # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
21
  # conference participants while it is live. A leg to a phone number runs for at
22
22
  # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
23
34
  class Calls
24
35
  # Phone calls from the numbers you hold, driven by your own callback URL.
25
36
  #
@@ -38,15 +49,28 @@ module Sentdm
38
49
  # once one is ready, hang it up, start or stop recording, and add, mute or remove
39
50
  # conference participants while it is live. A leg to a phone number runs for at
40
51
  # most what your balance affords at the destination's rate.
52
+ #
53
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
54
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
55
+ # call as text (speech recognised and spoken for the agent) or as audio,
56
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
57
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
58
+ # `fallback` and `limits` say what it may do on a call. The agent's
59
+ # `signing_secret` is shown on create and on
60
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
61
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
62
+ # it is bound to it on `/v3/channels/voice`.
41
63
  # @return [Sentdm::Resources::Voice::Calls::Participants]
42
64
  attr_reader :participants
43
65
 
44
66
  # Some parameter documentations has been truncated, see
45
67
  # {Sentdm::Models::Voice::CallRetrieveParams} for more details.
46
68
  #
47
- # Retrieves one of your calls by id: the parties, the owning number, the current
48
- # status with its failure reason, duration, price, recording availability, and a
49
- # timeline of when the call entered each status.
69
+ # Retrieves one of your calls by id: the parties, the owning number, the phone
70
+ # number the call was connected to and the caller id it showed, the current status
71
+ # with its failure reason, duration, price with the billed legs and what each
72
+ # cost, recording availability, and a timeline of when the call entered each
73
+ # status.
50
74
  #
51
75
  # @overload retrieve(id, x_profile_id: nil, request_options: {})
52
76
  #
@@ -74,16 +98,23 @@ module Sentdm
74
98
  # {Sentdm::Models::Voice::CallListParams} for more details.
75
99
  #
76
100
  # Retrieves a paginated list of your calls, most recent first. Filter by
77
- # direction, status, the owning number, and the time the call started (from and to
78
- # are inclusive). Use the call webhooks for real-time updates; this list is for
79
- # looking calls up afterwards.
101
+ # direction, status, the owning number, the mode (inapp, or agent for calls your
102
+ # voice agents answered), the agent that answered, and the time the call started
103
+ # (from and to are inclusive). Each call carries the phone number it was connected
104
+ # to, the caller id it showed, and the billed legs with what each cost. Use the
105
+ # call webhooks for real-time updates; this list is for looking calls up
106
+ # afterwards.
80
107
  #
81
- # @overload list(direction: nil, from: nil, number: nil, page: nil, page_size: nil, status: nil, to: nil, x_profile_id: nil, request_options: {})
108
+ # @overload list(agent_id: nil, direction: nil, from: nil, mode: nil, number: nil, page: nil, page_size: nil, status: nil, to: nil, x_profile_id: nil, request_options: {})
109
+ #
110
+ # @param agent_id [String, nil] Query param: Optional filter on the voice agent that answered the call, such as
82
111
  #
83
112
  # @param direction [String, nil] Query param: Optional direction filter: outbound for calls placed from your app,
84
113
  #
85
114
  # @param from [Time, nil] Query param: Only calls started at or after this time (ISO 8601)
86
115
  #
116
+ # @param mode [String, nil] Query param: Optional mode filter: inapp for calls routed by your number's callb
117
+ #
87
118
  # @param number [String, nil] Query param: Optional filter on the number that owns the call, one of your voice
88
119
  #
89
120
  # @param page [Integer] Query param: Page number (1-indexed)
@@ -102,7 +133,7 @@ module Sentdm
102
133
  #
103
134
  # @see Sentdm::Models::Voice::CallListParams
104
135
  def list(params = {})
105
- query_params = [:direction, :from, :number, :page, :page_size, :status, :to]
136
+ query_params = [:agent_id, :direction, :from, :mode, :number, :page, :page_size, :status, :to]
106
137
  parsed, options = Sentdm::Voice::CallListParams.dump_request(params)
107
138
  query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
108
139
  @client.request(
@@ -122,8 +153,8 @@ module Sentdm
122
153
  # Ends one of your live calls. The call then ends the way any other call does once
123
154
  # the disconnect is reported: an answered call as COMPLETED with call.completed, a
124
155
  # call still ringing as NO_ANSWER, REJECTED or FAILED with call.failed. A call
125
- # that has already ended answers 409, and so does a call with no phone leg, such
126
- # as one between two app users.
156
+ # that has already ended answers 409, as do a call with no phone leg, such as one
157
+ # between two app users, and a call one of your voice agents answers.
127
158
  #
128
159
  # @overload hangup(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
129
160
  #
@@ -191,9 +222,9 @@ module Sentdm
191
222
  #
192
223
  # Starts or stops recording one of your live calls. Use start to begin recording
193
224
  # mid-call, or stop to end a recording, whether it was started here or by a
194
- # connect answer with record set. A call that has already ended answers 409, and
195
- # so does a call with no phone leg, such as one between two app users, which can't
196
- # be recorded.
225
+ # connect answer with record set. A call that has already ended answers 409, as do
226
+ # a call with no phone leg, such as one between two app users, and a call one of
227
+ # your voice agents answers, neither of which can be recorded this way.
197
228
  #
198
229
  # @overload record(id, action: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
199
230
  #
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ # Phone calls from the numbers you hold, driven by your own callback URL.
7
+ #
8
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
9
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
10
+ # short-lived token that lets a user of your app place and receive calls as that
11
+ # number. When a call arrives or a caller presses a key, a signed question is
12
+ # POSTed to the callback URL and the answer decides the call;
13
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
14
+ # before a real call reaches it, and
15
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
16
+ # The call events themselves (`call.completed` and the rest) arrive through your
17
+ # webhooks.
18
+ #
19
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
20
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
+ # conference participants while it is live. A leg to a phone number runs for at
22
+ # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
34
+ class Catalogue
35
+ # Some parameter documentations has been truncated, see
36
+ # {Sentdm::Models::Voice::CatalogueListParams} for more details.
37
+ #
38
+ # The names a voice agent's `speech.voice` and `speech.language` accept, with the
39
+ # default marked. The list grows as voices are added; a name is never removed
40
+ # without notice.
41
+ #
42
+ # @overload list(x_profile_id: nil, request_options: {})
43
+ #
44
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
45
+ #
46
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
47
+ #
48
+ # @return [Sentdm::Models::Voice::APIResponseOfVoiceCatalogue]
49
+ #
50
+ # @see Sentdm::Models::Voice::CatalogueListParams
51
+ def list(params = {})
52
+ parsed, options = Sentdm::Voice::CatalogueListParams.dump_request(params)
53
+ @client.request(
54
+ method: :get,
55
+ path: "v3/voice/voices",
56
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
57
+ model: Sentdm::Voice::APIResponseOfVoiceCatalogue,
58
+ options: options
59
+ )
60
+ end
61
+
62
+ # @api private
63
+ #
64
+ # @param client [Sentdm::Client]
65
+ def initialize(client:)
66
+ @client = client
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -20,6 +20,17 @@ module Sentdm
20
20
  # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
21
  # conference participants while it is live. A leg to a phone number runs for at
22
22
  # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
23
34
  class Tokens
24
35
  # Some parameter documentations has been truncated, see
25
36
  # {Sentdm::Models::Voice::TokenCreateParams} for more details.
@@ -20,6 +20,17 @@ module Sentdm
20
20
  # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
21
  # conference participants while it is live. A leg to a phone number runs for at
22
22
  # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
23
34
  # @return [Sentdm::Resources::Voice::Calls]
24
35
  attr_reader :calls
25
36
 
@@ -40,9 +51,82 @@ module Sentdm
40
51
  # once one is ready, hang it up, start or stop recording, and add, mute or remove
41
52
  # conference participants while it is live. A leg to a phone number runs for at
42
53
  # most what your balance affords at the destination's rate.
54
+ #
55
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
56
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
57
+ # call as text (speech recognised and spoken for the agent) or as audio,
58
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
59
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
60
+ # `fallback` and `limits` say what it may do on a call. The agent's
61
+ # `signing_secret` is shown on create and on
62
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
63
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
64
+ # it is bound to it on `/v3/channels/voice`.
43
65
  # @return [Sentdm::Resources::Voice::Tokens]
44
66
  attr_reader :tokens
45
67
 
68
+ # Phone calls from the numbers you hold, driven by your own callback URL.
69
+ #
70
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
71
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
72
+ # short-lived token that lets a user of your app place and receive calls as that
73
+ # number. When a call arrives or a caller presses a key, a signed question is
74
+ # POSTed to the callback URL and the answer decides the call;
75
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
76
+ # before a real call reaches it, and
77
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
78
+ # The call events themselves (`call.completed` and the rest) arrive through your
79
+ # webhooks.
80
+ #
81
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
82
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
83
+ # conference participants while it is live. A leg to a phone number runs for at
84
+ # most what your balance affords at the destination's rate.
85
+ #
86
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
87
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
88
+ # call as text (speech recognised and spoken for the agent) or as audio,
89
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
90
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
91
+ # `fallback` and `limits` say what it may do on a call. The agent's
92
+ # `signing_secret` is shown on create and on
93
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
94
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
95
+ # it is bound to it on `/v3/channels/voice`.
96
+ # @return [Sentdm::Resources::Voice::Agents]
97
+ attr_reader :agents
98
+
99
+ # Phone calls from the numbers you hold, driven by your own callback URL.
100
+ #
101
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
102
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
103
+ # short-lived token that lets a user of your app place and receive calls as that
104
+ # number. When a call arrives or a caller presses a key, a signed question is
105
+ # POSTed to the callback URL and the answer decides the call;
106
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
107
+ # before a real call reaches it, and
108
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
109
+ # The call events themselves (`call.completed` and the rest) arrive through your
110
+ # webhooks.
111
+ #
112
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
113
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
114
+ # conference participants while it is live. A leg to a phone number runs for at
115
+ # most what your balance affords at the destination's rate.
116
+ #
117
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
118
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
119
+ # call as text (speech recognised and spoken for the agent) or as audio,
120
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
121
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
122
+ # `fallback` and `limits` say what it may do on a call. The agent's
123
+ # `signing_secret` is shown on create and on
124
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
125
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
126
+ # it is bound to it on `/v3/channels/voice`.
127
+ # @return [Sentdm::Resources::Voice::Catalogue]
128
+ attr_reader :catalogue
129
+
46
130
  # @api private
47
131
  #
48
132
  # @param client [Sentdm::Client]
@@ -50,6 +134,8 @@ module Sentdm
50
134
  @client = client
51
135
  @calls = Sentdm::Resources::Voice::Calls.new(client: client)
52
136
  @tokens = Sentdm::Resources::Voice::Tokens.new(client: client)
137
+ @agents = Sentdm::Resources::Voice::Agents.new(client: client)
138
+ @catalogue = Sentdm::Resources::Voice::Catalogue.new(client: client)
53
139
  end
54
140
  end
55
141
  end
@@ -17,9 +17,17 @@ module Sentdm
17
17
  # Some parameter documentations has been truncated, see
18
18
  # {Sentdm::Models::WebhookCreateParams} for more details.
19
19
  #
20
- # Creates a new webhook endpoint for the authenticated customer.
21
- #
22
- # @overload create(display_name: nil, endpoint_url: nil, event_filters: nil, event_types: nil, retry_count: nil, sandbox: nil, sender_profile: nil, timeout_seconds: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
20
+ # Creates a new webhook endpoint for the authenticated customer. A webhook is
21
+ # version 2 unless the request sets webhook_version to 1: Svix delivers it, signed
22
+ # with the webhook-id, webhook-timestamp and webhook-signature headers, and
23
+ # retries it on its own schedule, so retry_count and timeout_seconds apply to
24
+ # version 1 only. sender_profile applies to version 1 only and is ignored on
25
+ # version 2; is_inheritable applies to version 2 only. A version 1 webhook's
26
+ # response returns its sender_profile selection, with an empty event_types when it
27
+ # is not cloned onto sender profiles; a version 2 webhook's response leaves
28
+ # sender_profile out.
29
+ #
30
+ # @overload create(display_name: nil, endpoint_url: nil, event_filters: nil, event_types: nil, is_inheritable: nil, retry_count: nil, sandbox: nil, sender_profile: nil, timeout_seconds: nil, webhook_version: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
23
31
  #
24
32
  # @param display_name [String] Body param
25
33
  #
@@ -29,13 +37,17 @@ module Sentdm
29
37
  #
30
38
  # @param event_types [Array<String>] Body param
31
39
  #
32
- # @param retry_count [Integer] Body param
40
+ # @param is_inheritable [Boolean] Body param: Also delivers every sender profile's events to this webhook, at the
41
+ #
42
+ # @param retry_count [Integer] Body param: Delivery retries. Applies to version 1 only: Svix retries a version
33
43
  #
34
44
  # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
35
45
  #
36
46
  # @param sender_profile [Sentdm::Models::WebhookCreateParams::SenderProfile, nil] Body param: Request-only: the events an organization webhook's sender profile cl
37
47
  #
38
- # @param timeout_seconds [Integer] Body param
48
+ # @param timeout_seconds [Integer] Body param: Delivery timeout. Applies to version 1 only.
49
+ #
50
+ # @param webhook_version [Integer, nil] Body param: Who delivers the webhook: 2, the default, is delivered by Svix and s
39
51
  #
40
52
  # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
41
53
  #
@@ -62,7 +74,8 @@ module Sentdm
62
74
  # Some parameter documentations has been truncated, see
63
75
  # {Sentdm::Models::WebhookRetrieveParams} for more details.
64
76
  #
65
- # Retrieves a single webhook by ID for the authenticated customer.
77
+ # Retrieves a single webhook by ID for the authenticated customer. A version 1
78
+ # webhook includes its sender_profile selection.
66
79
  #
67
80
  # @overload retrieve(id, x_profile_id: nil, request_options: {})
68
81
  #
@@ -89,9 +102,13 @@ module Sentdm
89
102
  # Some parameter documentations has been truncated, see
90
103
  # {Sentdm::Models::WebhookUpdateParams} for more details.
91
104
  #
92
- # Updates an existing webhook for the authenticated customer.
105
+ # Updates an existing webhook for the authenticated customer. Its version does not
106
+ # change. sender_profile applies to a version 1 webhook and is_inheritable to a
107
+ # version 2 one; retry_count and timeout_seconds apply to version 1 only. A
108
+ # version 1 webhook's response returns its sender_profile selection as saved; a
109
+ # version 2 webhook's response leaves sender_profile out.
93
110
  #
94
- # @overload update(id, display_name: nil, endpoint_url: nil, event_filters: nil, event_types: nil, retry_count: nil, sandbox: nil, sender_profile: nil, timeout_seconds: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
111
+ # @overload update(id, display_name: nil, endpoint_url: nil, event_filters: nil, event_types: nil, is_inheritable: nil, retry_count: nil, sandbox: nil, sender_profile: nil, timeout_seconds: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
95
112
  #
96
113
  # @param id [String] Path param
97
114
  #
@@ -103,6 +120,8 @@ module Sentdm
103
120
  #
104
121
  # @param event_types [Array<String>] Body param
105
122
  #
123
+ # @param is_inheritable [Boolean, nil] Body param: Makes this webhook inheritable by the organization's sender profiles
124
+ #
106
125
  # @param retry_count [Integer] Body param
107
126
  #
108
127
  # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
@@ -136,7 +155,8 @@ module Sentdm
136
155
  # Some parameter documentations has been truncated, see
137
156
  # {Sentdm::Models::WebhookListParams} for more details.
138
157
  #
139
- # Retrieves a paginated list of webhooks for the authenticated customer.
158
+ # Retrieves a paginated list of webhooks for the authenticated customer. Each
159
+ # version 1 webhook includes its sender_profile selection.
140
160
  #
141
161
  # @overload list(is_active: nil, page: nil, page_size: nil, search: nil, x_profile_id: nil, request_options: {})
142
162
  #
@@ -225,9 +245,11 @@ module Sentdm
225
245
  # Some parameter documentations has been truncated, see
226
246
  # {Sentdm::Models::WebhookListEventsParams} for more details.
227
247
  #
228
- # Retrieves a paginated list of delivery events for the specified webhook. If the
229
- # webhook is cloned onto your sender profiles, the list includes what those clones
230
- # received; read payload.account_id to tell whose event it is.
248
+ # Retrieves a paginated list of delivery events for the specified webhook, newest
249
+ # first. If the webhook is cloned onto your sender profiles (version 1) or
250
+ # inheritable by them (version 2, is_inheritable), the list includes their events;
251
+ # read payload.account_id to tell whose event it is. A sender profile may read its
252
+ # organization's inheritable webhook too, and gets the events about itself.
231
253
  #
232
254
  # @overload list_events(id, page: nil, page_size: nil, search: nil, x_profile_id: nil, request_options: {})
233
255
  #
@@ -264,8 +286,11 @@ module Sentdm
264
286
  # Some parameter documentations has been truncated, see
265
287
  # {Sentdm::Models::WebhookRotateSecretParams} for more details.
266
288
  #
267
- # Generates a new signing secret for the specified webhook. The old secret is
268
- # immediately invalidated.
289
+ # Generates a new signing secret for the specified webhook. A version 1 webhook's
290
+ # old secret stops verifying at once. A version 2 webhook's deliveries are signed
291
+ # with the new secret at once, and with the old one as well for the next 24 hours,
292
+ # so a receiver can switch over without rejecting any; after that the old secret
293
+ # no longer verifies.
269
294
  #
270
295
  # @overload rotate_secret(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
271
296
  #
@@ -298,7 +323,10 @@ module Sentdm
298
323
  # Some parameter documentations has been truncated, see
299
324
  # {Sentdm::Models::WebhookTestParams} for more details.
300
325
  #
301
- # Sends a test event to the specified webhook endpoint to verify connectivity.
326
+ # Sends a test event to the specified webhook endpoint to verify connectivity. A
327
+ # version 1 webhook is tested at once and the answer says whether it was
328
+ # delivered; a version 2 webhook's test is queued with Svix, which delivers it
329
+ # right after, and the answer says it was queued.
302
330
  #
303
331
  # @overload test_(id, event_type: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
304
332
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sentdm
4
- VERSION = "0.39.0"
4
+ VERSION = "0.40.0"
5
5
  end
data/lib/sentdm.rb CHANGED
@@ -56,6 +56,7 @@ require_relative "sentdm/internal/calls_page"
56
56
  require_relative "sentdm/internal/contacts_page"
57
57
  require_relative "sentdm/internal/conversations_page"
58
58
  require_relative "sentdm/internal/templates_page"
59
+ require_relative "sentdm/internal/voice_agents_page"
59
60
  require_relative "sentdm/internal/webhook_events_page"
60
61
  require_relative "sentdm/internal/webhooks_page"
61
62
  require_relative "sentdm/models/channels/voice_number"
@@ -172,9 +173,19 @@ require_relative "sentdm/models/user_remove_params"
172
173
  require_relative "sentdm/models/user_response"
173
174
  require_relative "sentdm/models/user_retrieve_params"
174
175
  require_relative "sentdm/models/user_update_role_params"
176
+ require_relative "sentdm/models/voice/agent_create_params"
177
+ require_relative "sentdm/models/voice/agent_delete_params"
178
+ require_relative "sentdm/models/voice/agent_list_params"
179
+ require_relative "sentdm/models/voice/agent_retrieve_params"
180
+ require_relative "sentdm/models/voice/agent_rotate_secret_params"
181
+ require_relative "sentdm/models/voice/agent_update_params"
175
182
  require_relative "sentdm/models/voice/api_response_of_call"
176
183
  require_relative "sentdm/models/voice/api_response_of_call_recordings"
177
184
  require_relative "sentdm/models/voice/api_response_of_calls_list"
185
+ require_relative "sentdm/models/voice/api_response_of_voice_agent"
186
+ require_relative "sentdm/models/voice/api_response_of_voice_agent_secret"
187
+ require_relative "sentdm/models/voice/api_response_of_voice_agents_list"
188
+ require_relative "sentdm/models/voice/api_response_of_voice_catalogue"
178
189
  require_relative "sentdm/models/voice/api_response_of_voice_token"
179
190
  require_relative "sentdm/models/voice/call"
180
191
  require_relative "sentdm/models/voice/call_hangup_params"
@@ -195,7 +206,23 @@ require_relative "sentdm/models/voice/calls/participant_remove_params"
195
206
  require_relative "sentdm/models/voice/calls/participant_update_params"
196
207
  require_relative "sentdm/models/voice/calls_list"
197
208
  require_relative "sentdm/models/voice/call_timeline_entry"
209
+ require_relative "sentdm/models/voice/catalogue_list_params"
198
210
  require_relative "sentdm/models/voice/token_create_params"
211
+ require_relative "sentdm/models/voice/voice_agent"
212
+ require_relative "sentdm/models/voice/voice_agent_audio"
213
+ require_relative "sentdm/models/voice/voice_agent_audio_spec"
214
+ require_relative "sentdm/models/voice/voice_agent_limits"
215
+ require_relative "sentdm/models/voice/voice_agent_limits_spec"
216
+ require_relative "sentdm/models/voice/voice_agent_party"
217
+ require_relative "sentdm/models/voice/voice_agent_party_spec"
218
+ require_relative "sentdm/models/voice/voice_agent_secret"
219
+ require_relative "sentdm/models/voice/voice_agents_list"
220
+ require_relative "sentdm/models/voice/voice_agent_speech"
221
+ require_relative "sentdm/models/voice/voice_agent_speech_spec"
222
+ require_relative "sentdm/models/voice/voice_agent_transcripts"
223
+ require_relative "sentdm/models/voice/voice_agent_transcripts_spec"
224
+ require_relative "sentdm/models/voice/voice_catalogue"
225
+ require_relative "sentdm/models/voice/voice_catalogue_voice"
199
226
  require_relative "sentdm/models/voice/voice_token"
200
227
  require_relative "sentdm/models/webhook_create_params"
201
228
  require_relative "sentdm/models/webhook_delete_params"
@@ -226,7 +253,9 @@ require_relative "sentdm/resources/profiles/campaigns"
226
253
  require_relative "sentdm/resources/templates"
227
254
  require_relative "sentdm/resources/users"
228
255
  require_relative "sentdm/resources/voice"
256
+ require_relative "sentdm/resources/voice/agents"
229
257
  require_relative "sentdm/resources/voice/calls"
230
258
  require_relative "sentdm/resources/voice/calls/participants"
259
+ require_relative "sentdm/resources/voice/catalogue"
231
260
  require_relative "sentdm/resources/voice/tokens"
232
261
  require_relative "sentdm/resources/webhooks"
@@ -0,0 +1,71 @@
1
+ # typed: strong
2
+
3
+ module Sentdm
4
+ module Internal
5
+ class VoiceAgentsPage
6
+ include Sentdm::Internal::Type::BasePage
7
+
8
+ Elem = type_member
9
+
10
+ sig { returns(Data) }
11
+ attr_accessor :data
12
+
13
+ # @api private
14
+ sig { returns(String) }
15
+ def inspect
16
+ end
17
+
18
+ class Data < Sentdm::Internal::Type::BaseModel
19
+ OrHash = T.type_alias { T.any(Data, Sentdm::Internal::AnyHash) }
20
+
21
+ sig { returns(T.nilable(T::Array[T.anything])) }
22
+ attr_reader :agents
23
+
24
+ sig { params(agents: T::Array[T.anything]).void }
25
+ attr_writer :agents
26
+
27
+ sig { returns(T.nilable(Data::Pagination)) }
28
+ attr_reader :pagination
29
+
30
+ sig { params(pagination: Data::Pagination::OrHash).void }
31
+ attr_writer :pagination
32
+
33
+ sig do
34
+ params(
35
+ agents: T::Array[T.anything],
36
+ pagination: Data::Pagination::OrHash
37
+ ).returns(T.attached_class)
38
+ end
39
+ def self.new(agents: nil, pagination: nil)
40
+ end
41
+
42
+ sig do
43
+ override.returns(
44
+ { agents: T::Array[T.anything], pagination: Data::Pagination }
45
+ )
46
+ end
47
+ def to_hash
48
+ end
49
+
50
+ class Pagination < Sentdm::Internal::Type::BaseModel
51
+ OrHash =
52
+ T.type_alias { T.any(Data::Pagination, Sentdm::Internal::AnyHash) }
53
+
54
+ sig { returns(T.nilable(T::Boolean)) }
55
+ attr_reader :has_more
56
+
57
+ sig { params(has_more: T::Boolean).void }
58
+ attr_writer :has_more
59
+
60
+ sig { params(has_more: T::Boolean).returns(T.attached_class) }
61
+ def self.new(has_more: nil)
62
+ end
63
+
64
+ sig { override.returns({ has_more: T::Boolean }) }
65
+ def to_hash
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -20,15 +20,17 @@ module Sentdm
20
20
  sig { params(field: String).void }
21
21
  attr_writer :field
22
22
 
23
- # Body of a call.initiated, call.answered, call.completed, call.failed or
24
- # call.recording_ready event. Which of them occurred is the envelope's event.
23
+ # Body of a call.initiated, call.answered, call.agent_connected, call.completed,
24
+ # call.failed or call.recording_ready event. Which of them occurred is the
25
+ # envelope's event.
25
26
  #
26
27
  # Shaped like the message, inbound, template and channel payloads: account_id
27
28
  # names the account the event is about, channel names the channel, and updated_at
28
29
  # is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
29
- # duration_seconds and price are added on call.completed, reason on call.failed
30
- # and recording_id on call.recording_ready; each is omitted rather than sent as
31
- # null when it does not apply.
30
+ # Every event says how the call is handled in mode, and an agent call names its
31
+ # agent in agent_id. duration_seconds and price are added on call.completed,
32
+ # reason on call.failed and recording_id on call.recording_ready; each is omitted
33
+ # rather than sent as null when it does not apply.
32
34
  #
33
35
  # Casing is snake_case because these ride the same webhook stream customers
34
36
  # already parse message_id from; the question/answer contract is a separate
@@ -72,15 +74,17 @@ module Sentdm
72
74
  # The event family, for example message, templates or contact. Route on this
73
75
  # first, then on event for the specific change.
74
76
  field: nil,
75
- # Body of a call.initiated, call.answered, call.completed, call.failed or
76
- # call.recording_ready event. Which of them occurred is the envelope's event.
77
+ # Body of a call.initiated, call.answered, call.agent_connected, call.completed,
78
+ # call.failed or call.recording_ready event. Which of them occurred is the
79
+ # envelope's event.
77
80
  #
78
81
  # Shaped like the message, inbound, template and channel payloads: account_id
79
82
  # names the account the event is about, channel names the channel, and updated_at
80
83
  # is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
81
- # duration_seconds and price are added on call.completed, reason on call.failed
82
- # and recording_id on call.recording_ready; each is omitted rather than sent as
83
- # null when it does not apply.
84
+ # Every event says how the call is handled in mode, and an agent call names its
85
+ # agent in agent_id. duration_seconds and price are added on call.completed,
86
+ # reason on call.failed and recording_id on call.recording_ready; each is omitted
87
+ # rather than sent as null when it does not apply.
84
88
  #
85
89
  # Casing is snake_case because these ride the same webhook stream customers
86
90
  # already parse message_id from; the question/answer contract is a separate