Class: HighLevel::Resources::Conversations
- Defined in:
- lib/high_level/resources/conversations.rb
Instance Method Summary collapse
-
#add_an_inbound_message(body:, **_opts) ⇒ Object
Add an inbound message.
-
#add_an_outbound_message(body:, **_opts) ⇒ Object
Add an external outbound call.
-
#add_message_attachments(message_id:, body:, **_opts) ⇒ Object
Add message attachments.
-
#cancel_scheduled_email_message(email_message_id:, **_opts) ⇒ Object
Cancel a scheduled email message.
-
#cancel_scheduled_message(message_id:, **_opts) ⇒ Object
Cancel a scheduled message.
-
#complete_file_upload(body:, **_opts) ⇒ Object
Complete file upload.
-
#create_conversation(body:, **_opts) ⇒ Object
Create Conversation.
-
#create_custom_subtype(body:, location_id: nil, **_opts) ⇒ Object
Create Custom Subtype.
-
#delete_conversation(conversation_id:, **_opts) ⇒ Object
Delete Conversation.
-
#download_message_transcription(location_id:, message_id:, **_opts) ⇒ Object
Download transcription by Message ID.
-
#export_messages_by_location(location_id: nil, limit: nil, cursor: nil, sort_by: nil, sort_order: nil, conversation_id: nil, contact_id: nil, channel: nil, start_date: nil, end_date: nil, **_opts) ⇒ Object
Export messages by location ID.
-
#get_all_custom_subtypes(location_id: nil, **_opts) ⇒ Object
Get All Custom Subtypes.
-
#get_contact_unsubscription_status(location_id: nil, contact_id: nil, email: nil, **_opts) ⇒ Object
Get Contact Unsubscription Status.
-
#get_conversation(conversation_id:, **_opts) ⇒ Object
Get Conversation.
-
#get_email_by_id(**_opts) ⇒ Object
Get email by Id.
-
#get_message(**_opts) ⇒ Object
Get message by message id.
-
#get_message_recording(location_id:, message_id:, **_opts) ⇒ Object
Get Recording by Message ID.
-
#get_message_transcription(location_id:, message_id:, **_opts) ⇒ Object
Get transcription by Message ID.
-
#get_messages(conversation_id:, last_message_id: nil, limit: nil, type: nil, **_opts) ⇒ Object
Get messages by conversation id.
-
#initiate_file_upload(body:, **_opts) ⇒ Object
Initiate file upload to GCS.
-
#live_chat_agent_typing(body:, **_opts) ⇒ Object
Agent/Ai-Bot is typing a message indicator for live chat.
-
#search_conversation(location_id: nil, contact_id: nil, assigned_to: nil, followers: nil, mentions: nil, query: nil, sort: nil, start_after_date: nil, id: nil, limit: nil, last_message_type: nil, last_message_action: nil, last_message_direction: nil, status: nil, sort_by: nil, sort_score_profile: nil, score_profile: nil, score_profile_min: nil, score_profile_max: nil, start_date: nil, end_date: nil, **_opts) ⇒ Object
Search Conversations.
-
#send_a_new_message(body:, **_opts) ⇒ Object
Send a new message.
-
#send_review_reply(body:, **_opts) ⇒ Object
Send a review reply to Google My Business.
-
#update_conversation(conversation_id:, body:, **_opts) ⇒ Object
Update Conversation.
-
#update_custom_subtype(id:, body:, location_id: nil, **_opts) ⇒ Object
Update Custom Subtype.
-
#update_message_status(message_id:, body:, **_opts) ⇒ Object
Update message status.
-
#upload_file_attachments(body:, **_opts) ⇒ Object
Upload file attachments.
-
#user_subscription_change(body:, **_opts) ⇒ Object
User Subscription Change.
Methods inherited from Base
Constructor Details
This class inherits a constructor from HighLevel::Resources::Base
Instance Method Details
#add_an_inbound_message(body:, **_opts) ⇒ Object
Add an inbound message
Post the necessary fields for the API to add a new inbound message. <br />
187 188 189 190 191 192 193 194 |
# File 'lib/high_level/resources/conversations.rb', line 187 def (body:, **_opts) request( method: :post, path: "/conversations/messages/inbound", security: ["bearer"], body: body ) end |
#add_an_outbound_message(body:, **_opts) ⇒ Object
Add an external outbound call
Post the necessary fields for the API to add a new outbound call.
199 200 201 202 203 204 205 206 |
# File 'lib/high_level/resources/conversations.rb', line 199 def (body:, **_opts) request( method: :post, path: "/conversations/messages/outbound", security: ["bearer"], body: body ) end |
#add_message_attachments(message_id:, body:, **_opts) ⇒ Object
Add message attachments
Set attachments on an existing message (replaces existing). Maximum 5 URLs. Supported for TYPE_CUSTOM_CALL (34) and TYPE_CALL (1) with subType EXTERNAL_CALL.
282 283 284 285 286 287 288 289 |
# File 'lib/high_level/resources/conversations.rb', line 282 def (message_id:, body:, **_opts) request( method: :put, path: "/conversations/messages/#{}/attachments", security: ["bearer"], body: body ) end |
#cancel_scheduled_email_message(email_message_id:, **_opts) ⇒ Object
Cancel a scheduled email message.
Post the messageId for the API to delete a scheduled email message. <br />
129 130 131 132 133 134 135 |
# File 'lib/high_level/resources/conversations.rb', line 129 def (email_message_id:, **_opts) request( method: :delete, path: "/conversations/messages/email/#{}/schedule", security: [] ) end |
#cancel_scheduled_message(message_id:, **_opts) ⇒ Object
Cancel a scheduled message.
Post the messageId for the API to delete a scheduled message. <br />
223 224 225 226 227 228 229 |
# File 'lib/high_level/resources/conversations.rb', line 223 def (message_id:, **_opts) request( method: :delete, path: "/conversations/messages/#{}/schedule", security: ["bearer"] ) end |
#complete_file_upload(body:, **_opts) ⇒ Object
Complete file upload
Validates the uploaded file in GCS and returns the public URL. Call this endpoint after successfully uploading the file to the signed URL.
258 259 260 261 262 263 264 265 |
# File 'lib/high_level/resources/conversations.rb', line 258 def complete_file_upload(body:, **_opts) request( method: :post, path: "/conversations/messages/upload/complete", security: ["bearer"], body: body ) end |
#create_conversation(body:, **_opts) ⇒ Object
Create Conversation
Creates a new conversation with the data provided
339 340 341 342 343 344 345 346 |
# File 'lib/high_level/resources/conversations.rb', line 339 def create_conversation(body:, **_opts) request( method: :post, path: "/conversations/", security: ["bearer"], body: body ) end |
#create_custom_subtype(body:, location_id: nil, **_opts) ⇒ Object
Create Custom Subtype
Create a new custom subtype for a location. Requires agency or account admin role.
70 71 72 73 74 75 76 77 78 |
# File 'lib/high_level/resources/conversations.rb', line 70 def create_custom_subtype(body:, location_id: nil, **_opts) request( method: :post, path: "/conversations/preferences/custom-subtypes", security: [], params: { "locationId" => location_id }.compact, body: body ) end |
#delete_conversation(conversation_id:, **_opts) ⇒ Object
Delete Conversation
Delete the conversation details based on the conversation ID
47 48 49 50 51 52 53 |
# File 'lib/high_level/resources/conversations.rb', line 47 def delete_conversation(conversation_id:, **_opts) request( method: :delete, path: "/conversations/#{conversation_id}", security: ["bearer"] ) end |
#download_message_transcription(location_id:, message_id:, **_opts) ⇒ Object
Download transcription by Message ID
Download the recording transcription for a message by passing the message id
316 317 318 319 320 321 322 |
# File 'lib/high_level/resources/conversations.rb', line 316 def (location_id:, message_id:, **_opts) request( method: :get, path: "/conversations/locations/#{location_id}/messages/#{}/transcription/download", security: %w[bearer Location-Access] ) end |
#export_messages_by_location(location_id: nil, limit: nil, cursor: nil, sort_by: nil, sort_order: nil, conversation_id: nil, contact_id: nil, channel: nil, start_date: nil, end_date: nil, **_opts) ⇒ Object
Export messages by location ID
Export messages for a specific location with cursor-based pagination support. Response includes messageType (string), source, and subType fields. The channel parameter is optional - if not provided, all non-email message types will be returned including activity messages (opportunity updates, appointments, etc.).
140 141 142 143 144 145 146 147 |
# File 'lib/high_level/resources/conversations.rb', line 140 def (location_id: nil, limit: nil, cursor: nil, sort_by: nil, sort_order: nil, conversation_id: nil, contact_id: nil, channel: nil, start_date: nil, end_date: nil, **_opts) request( method: :get, path: "/conversations/messages/export", security: ["bearer"], params: { "locationId" => location_id, "limit" => limit, "cursor" => cursor, "sortBy" => sort_by, "sortOrder" => sort_order, "conversationId" => conversation_id, "contactId" => contact_id, "channel" => channel, "startDate" => start_date, "endDate" => end_date }.compact ) end |
#get_all_custom_subtypes(location_id: nil, **_opts) ⇒ Object
Get All Custom Subtypes
Get all custom subtypes for a location
58 59 60 61 62 63 64 65 |
# File 'lib/high_level/resources/conversations.rb', line 58 def get_all_custom_subtypes(location_id: nil, **_opts) request( method: :get, path: "/conversations/preferences/custom-subtypes", security: [], params: { "locationId" => location_id }.compact ) end |
#get_contact_unsubscription_status(location_id: nil, contact_id: nil, email: nil, **_opts) ⇒ Object
Get Contact Unsubscription Status
Get all subscription statuses for a contact (all emails or specific email)
96 97 98 99 100 101 102 103 |
# File 'lib/high_level/resources/conversations.rb', line 96 def get_contact_unsubscription_status(location_id: nil, contact_id: nil, email: nil, **_opts) request( method: :get, path: "/conversations/preferences/unsubscriptions/status", security: [], params: { "locationId" => location_id, "contactId" => contact_id, "email" => email }.compact ) end |
#get_conversation(conversation_id:, **_opts) ⇒ Object
Get Conversation
Get the conversation details based on the conversation ID
24 25 26 27 28 29 30 |
# File 'lib/high_level/resources/conversations.rb', line 24 def get_conversation(conversation_id:, **_opts) request( method: :get, path: "/conversations/#{conversation_id}", security: ["bearer"] ) end |
#get_email_by_id(**_opts) ⇒ Object
Get email by Id
118 119 120 121 122 123 124 |
# File 'lib/high_level/resources/conversations.rb', line 118 def get_email_by_id(**_opts) request( method: :get, path: "/conversations/messages/email/#{id}", security: [] ) end |
#get_message(**_opts) ⇒ Object
Get message by message id
Get message by message id.
152 153 154 155 156 157 158 |
# File 'lib/high_level/resources/conversations.rb', line 152 def (**_opts) request( method: :get, path: "/conversations/messages/#{id}", security: ["bearer"] ) end |
#get_message_recording(location_id:, message_id:, **_opts) ⇒ Object
Get Recording by Message ID
Get the recording for a message by passing the message id
294 295 296 297 298 299 300 |
# File 'lib/high_level/resources/conversations.rb', line 294 def (location_id:, message_id:, **_opts) request( method: :get, path: "/conversations/messages/#{}/locations/#{location_id}/recording", security: %w[bearer Location-Access] ) end |
#get_message_transcription(location_id:, message_id:, **_opts) ⇒ Object
Get transcription by Message ID
Get the recording transcription for a message by passing the message id
305 306 307 308 309 310 311 |
# File 'lib/high_level/resources/conversations.rb', line 305 def (location_id:, message_id:, **_opts) request( method: :get, path: "/conversations/locations/#{location_id}/messages/#{}/transcription", security: %w[bearer Location-Access] ) end |
#get_messages(conversation_id:, last_message_id: nil, limit: nil, type: nil, **_opts) ⇒ Object
Get messages by conversation id
Get messages by conversation id.
163 164 165 166 167 168 169 170 |
# File 'lib/high_level/resources/conversations.rb', line 163 def (conversation_id:, last_message_id: nil, limit: nil, type: nil, **_opts) request( method: :get, path: "/conversations/#{conversation_id}/messages", security: ["bearer"], params: { "lastMessageId" => , "limit" => limit, "type" => type }.compact ) end |
#initiate_file_upload(body:, **_opts) ⇒ Object
Initiate file upload to GCS
Generates a signed URL for direct file upload to Google Cloud Storage. Returns a signed URL valid for 15 minutes. Upload file via PUT request, then call /complete to finalize.
246 247 248 249 250 251 252 253 |
# File 'lib/high_level/resources/conversations.rb', line 246 def initiate_file_upload(body:, **_opts) request( method: :post, path: "/conversations/messages/upload/initiate", security: ["bearer"], body: body ) end |
#live_chat_agent_typing(body:, **_opts) ⇒ Object
Agent/Ai-Bot is typing a message indicator for live chat
Agent/AI-Bot will call this when they are typing a message in live chat message
327 328 329 330 331 332 333 334 |
# File 'lib/high_level/resources/conversations.rb', line 327 def live_chat_agent_typing(body:, **_opts) request( method: :post, path: "/conversations/providers/live-chat/typing", security: ["Location-Access"], body: body ) end |
#search_conversation(location_id: nil, contact_id: nil, assigned_to: nil, followers: nil, mentions: nil, query: nil, sort: nil, start_after_date: nil, id: nil, limit: nil, last_message_type: nil, last_message_action: nil, last_message_direction: nil, status: nil, sort_by: nil, sort_score_profile: nil, score_profile: nil, score_profile_min: nil, score_profile_max: nil, start_date: nil, end_date: nil, **_opts) ⇒ Object
Search Conversations
Returns a list of all conversations matching the search criteria along with the sort and filter options selected.
12 13 14 15 16 17 18 19 |
# File 'lib/high_level/resources/conversations.rb', line 12 def search_conversation(location_id: nil, contact_id: nil, assigned_to: nil, followers: nil, mentions: nil, query: nil, sort: nil, start_after_date: nil, id: nil, limit: nil, last_message_type: nil, last_message_action: nil, last_message_direction: nil, status: nil, sort_by: nil, sort_score_profile: nil, score_profile: nil, score_profile_min: nil, score_profile_max: nil, start_date: nil, end_date: nil, **_opts) request( method: :get, path: "/conversations/search", security: ["bearer"], params: { "locationId" => location_id, "contactId" => contact_id, "assignedTo" => assigned_to, "followers" => followers, "mentions" => mentions, "query" => query, "sort" => sort, "startAfterDate" => start_after_date, "id" => id, "limit" => limit, "lastMessageType" => , "lastMessageAction" => , "lastMessageDirection" => , "status" => status, "sortBy" => sort_by, "sortScoreProfile" => sort_score_profile, "scoreProfile" => score_profile, "scoreProfileMin" => score_profile_min, "scoreProfileMax" => score_profile_max, "startDate" => start_date, "endDate" => end_date }.compact ) end |
#send_a_new_message(body:, **_opts) ⇒ Object
Send a new message
Post the necessary fields for the API to send a new message.
175 176 177 178 179 180 181 182 |
# File 'lib/high_level/resources/conversations.rb', line 175 def (body:, **_opts) request( method: :post, path: "/conversations/messages", security: ["bearer"], body: body ) end |
#send_review_reply(body:, **_opts) ⇒ Object
Send a review reply to Google My Business
Post a reply to a customer review on Google My Business
211 212 213 214 215 216 217 218 |
# File 'lib/high_level/resources/conversations.rb', line 211 def send_review_reply(body:, **_opts) request( method: :post, path: "/conversations/messages/review-reply", security: ["bearer"], body: body ) end |
#update_conversation(conversation_id:, body:, **_opts) ⇒ Object
Update Conversation
Update the conversation details based on the conversation ID
35 36 37 38 39 40 41 42 |
# File 'lib/high_level/resources/conversations.rb', line 35 def update_conversation(conversation_id:, body:, **_opts) request( method: :put, path: "/conversations/#{conversation_id}", security: ["bearer"], body: body ) end |
#update_custom_subtype(id:, body:, location_id: nil, **_opts) ⇒ Object
Update Custom Subtype
Update or archive a custom subtype. Requires agency or account admin role.
83 84 85 86 87 88 89 90 91 |
# File 'lib/high_level/resources/conversations.rb', line 83 def update_custom_subtype(id:, body:, location_id: nil, **_opts) request( method: :put, path: "/conversations/preferences/custom-subtypes/#{id}", security: [], params: { "locationId" => location_id }.compact, body: body ) end |
#update_message_status(message_id:, body:, **_opts) ⇒ Object
Update message status
Post the necessary fields for the API to update message status.
270 271 272 273 274 275 276 277 |
# File 'lib/high_level/resources/conversations.rb', line 270 def (message_id:, body:, **_opts) request( method: :put, path: "/conversations/messages/#{}/status", security: ["bearer"], body: body ) end |
#upload_file_attachments(body:, **_opts) ⇒ Object
Upload file attachments
Post the necessary fields for the API to upload files. The files need to be a buffer with the key “fileAttachment”. <br /><br /> The allowed file types are: <br/> <ul><li>JPG</li><li>JPEG</li><li>PNG</li><li>MP4</li><li>MPEG</li><li>ZIP</li><li>RAR</li><li>PDF</li><li>DOC</li><li>DOCX</li><li>TXT</li><li>MP3</li><li>WAV</li></ul> <br /><br /> The API will return an object with the URLs
234 235 236 237 238 239 240 241 |
# File 'lib/high_level/resources/conversations.rb', line 234 def (body:, **_opts) request( method: :post, path: "/conversations/messages/upload", security: ["bearer"], body: body ) end |
#user_subscription_change(body:, **_opts) ⇒ Object
User Subscription Change
Process subscription change initiated by a user (admin/agent). Supports individual custom subscription changes and resub all functionality. Legal forms are automatically created for user-initiated resubscribe actions on custom subscriptions.
108 109 110 111 112 113 114 115 |
# File 'lib/high_level/resources/conversations.rb', line 108 def user_subscription_change(body:, **_opts) request( method: :post, path: "/conversations/preferences/unsubscriptions/user-change", security: [], body: body ) end |