Skip to main content

ConversationsService

Struct ConversationsService 

Source
pub struct ConversationsService { /* private fields */ }
Expand description

Access to the Conversations API. Obtained via Ghl::conversations.

Implementations§

Source§

impl ConversationsService

Source

pub async fn search( &self, location_id: &str, query: Option<&str>, limit: u32, ) -> Result<ConversationPage>

GET /conversations/search — find threads in a location.

Source

pub async fn messages( &self, conversation_id: &str, limit: u32, ) -> Result<MessagePage>

GET /conversations/{id}/messages — messages in a thread, newest first.

Source

pub async fn send_message( &self, message: SendMessage, ) -> Result<SendMessageResult>

POST /conversations/messages — send an SMS, email, or channel message.

Source§

impl ConversationsService

Source

pub async fn create_conversation( &self, body: &CreateConversationDto, ) -> Result<CreateConversationSuccessResponse>

Available on crate feature conversations only.

Create Conversation

Creates a new conversation with the data provided

POST /conversations/

Requires scope: conversations.write.

Source

pub async fn get_transcription_by_message_id( &self, location_id: &str, message_id: &str, ) -> Result<GetMessageTranscriptionResponseDto>

Available on crate feature conversations only.

Get transcription by Message ID

Get the recording transcription for a message by passing the message id

GET /conversations/locations/{locationId}/messages/{messageId}/transcription

Requires scope: conversations/message.readonly.

Source

pub async fn download_transcription_by_message_id( &self, location_id: &str, message_id: &str, ) -> Result<Value>

Available on crate feature conversations only.

Download transcription by Message ID

Download the recording transcription for a message by passing the message id

GET /conversations/locations/{locationId}/messages/{messageId}/transcription/download

Requires scope: conversations/message.readonly.

Source

pub async fn send_a_new_message( &self, body: &SendMessageBodyDto, ) -> Result<SendMessageResponseDto>

Available on crate feature conversations only.

Send a new message

Post the necessary fields for the API to send a new message.

POST /conversations/messages

Requires scope: conversations/message.write.

Source

pub async fn cancel_a_scheduled_email_message( &self, email_message_id: &str, ) -> Result<CancelScheduledResponseDto>

Available on crate feature conversations only.

Cancel a scheduled email message.

Post the messageId for the API to delete a scheduled email message.

DELETE /conversations/messages/email/{emailMessageId}/schedule

Source

pub async fn get_email_by_id( &self, id: &str, ) -> Result<GetEmailMessageResponseDto>

Available on crate feature conversations only.

Get email by Id

GET /conversations/messages/email/{id}

Source

pub async fn export_messages_by_location_id( &self, params: &ExportMessagesByLocationIdParams, ) -> Result<ExportMessagesResponseDto>

Available on crate feature conversations only.

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.).

GET /conversations/messages/export

Requires scope: conversations/message.readonly.

Source

pub async fn add_an_inbound_message( &self, body: &ProcessMessageBodyDto, ) -> Result<ProcessMessageResponseDto>

Available on crate feature conversations only.

Add an inbound message

Post the necessary fields for the API to add a new inbound message.

POST /conversations/messages/inbound

Requires scope: conversations/message.write.

Source

pub async fn add_an_external_outbound_call( &self, body: &ProcessOutboundMessageBodyDto, ) -> Result<ProcessMessageResponseDto>

Available on crate feature conversations only.

Add an external outbound call

Post the necessary fields for the API to add a new outbound call.

POST /conversations/messages/outbound

Requires scope: conversations/message.write.

Source

pub async fn send_a_review_reply_to_google_my_business( &self, body: &SendReviewReplyDto, ) -> Result<SendMessageResponseDto>

Available on crate feature conversations only.

Send a review reply to Google My Business

Post a reply to a customer review on Google My Business

POST /conversations/messages/review-reply

Requires scope: conversations/message.write.

Source

pub async fn upload_file_attachments( &self, body: &Value, ) -> Result<UploadFilesResponseDto>

Available on crate feature conversations only.

Upload file attachments

Post the necessary fields for the API to upload files. The files need to be a buffer with the key “fileAttachment”. The allowed file types are: JPG JPEG PNG MP4 MPEG ZIP RAR PDF DOC DOCX TXT MP3 WAV The API will return an object with the URLs

POST /conversations/messages/upload

Requires scope: conversations/message.write.

Source

pub async fn complete_file_upload( &self, body: &CompleteFileUploadDto, ) -> Result<CompleteFileUploadResponseDto>

Available on crate feature conversations only.

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.

POST /conversations/messages/upload/complete

Requires scope: conversations/message.write.

Source

pub async fn initiate_file_upload_to_gcs( &self, body: &InitiateFileUploadDto, ) -> Result<InitiateFileUploadResponseDto>

Available on crate feature conversations only.

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.

POST /conversations/messages/upload/initiate

Requires scope: conversations/message.write.

Source

pub async fn get_message_by_message_id( &self, id: &str, ) -> Result<GetMessageResponseDto>

Available on crate feature conversations only.

Get message by message id

Get message by message id.

GET /conversations/messages/{id}

Requires scope: conversations/message.readonly.

Source

pub async fn add_message_attachments( &self, message_id: &str, body: &AddMessageAttachmentsDto, ) -> Result<Value>

Available on crate feature conversations only.

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.

PUT /conversations/messages/{messageId}/attachments

Requires scope: conversations/message.write.

Source

pub async fn get_recording_by_message_id( &self, message_id: &str, location_id: &str, ) -> Result<Value>

Available on crate feature conversations only.

Get Recording by Message ID

Get the recording for a message by passing the message id

GET /conversations/messages/{messageId}/locations/{locationId}/recording

Requires scope: conversations/message.readonly.

Source

pub async fn cancel_a_scheduled_message( &self, message_id: &str, ) -> Result<CancelScheduledResponseDto>

Available on crate feature conversations only.

Cancel a scheduled message.

Post the messageId for the API to delete a scheduled message.

DELETE /conversations/messages/{messageId}/schedule

Requires scope: conversations/message.write.

Source

pub async fn update_message_status( &self, message_id: &str, body: &UpdateMessageStatusDto, ) -> Result<SendMessageResponseDto>

Available on crate feature conversations only.

Update message status

Post the necessary fields for the API to update message status.

PUT /conversations/messages/{messageId}/status

Requires scope: conversations/message.write.

Source

pub async fn get_all_custom_subtypes( &self, params: &GetAllCustomSubtypesParams, ) -> Result<Value>

Available on crate feature conversations only.

Get All Custom Subtypes

Get all custom subtypes for a location

GET /conversations/preferences/custom-subtypes

Source

pub async fn create_custom_subtype( &self, params: &CreateCustomSubtypeParams, body: &CreateCustomSubtypeDto, ) -> Result<Value>

Available on crate feature conversations only.

Create Custom Subtype

Create a new custom subtype for a location. Requires agency or account admin role.

POST /conversations/preferences/custom-subtypes

Source

pub async fn update_custom_subtype( &self, id: &str, params: &UpdateCustomSubtypeParams, body: &UpdateCustomSubtypeDto, ) -> Result<Value>

Available on crate feature conversations only.

Update Custom Subtype

Update or archive a custom subtype. Requires agency or account admin role.

PUT /conversations/preferences/custom-subtypes/{id}

Source

pub async fn get_contact_unsubscription_status( &self, params: &GetContactUnsubscriptionStatusParams, ) -> Result<Value>

Available on crate feature conversations only.

Get Contact Unsubscription Status

Get all subscription statuses for a contact (all emails or specific email)

GET /conversations/preferences/unsubscriptions/status

Source

pub async fn user_subscription_change( &self, body: &UserSubscriptionChangeDto, ) -> Result<Value>

Available on crate feature conversations only.

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.

POST /conversations/preferences/unsubscriptions/user-change

Source

pub async fn agent_ai_bot_is_typing_a_message_indicator_for_live_chat( &self, body: &UserTypingBody, ) -> Result<CreateLiveChatMessageFeedbackResponse>

Available on crate feature conversations only.

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

POST /conversations/providers/live-chat/typing

Requires scope: conversations/livechat.write.

Source

pub async fn search_conversations( &self, params: &SearchConversationsParams, ) -> Result<SendConversationResponseDto>

Available on crate feature conversations only.

Search Conversations

Returns a list of all conversations matching the search criteria along with the sort and filter options selected.

GET /conversations/search

Requires scope: conversations.readonly.

Source

pub async fn delete_conversation( &self, conversation_id: &str, ) -> Result<DeleteConversationSuccessfulResponse>

Available on crate feature conversations only.

Delete Conversation

Delete the conversation details based on the conversation ID

DELETE /conversations/{conversationId}

Requires scope: conversations.write.

Source

pub async fn get_conversation( &self, conversation_id: &str, ) -> Result<GetConversationByIdResponse>

Available on crate feature conversations only.

Get Conversation

Get the conversation details based on the conversation ID

GET /conversations/{conversationId}

Requires scope: conversations.readonly.

Source

pub async fn update_conversation( &self, conversation_id: &str, body: &UpdateConversationDto, ) -> Result<GetConversationSuccessfulResponse>

Available on crate feature conversations only.

Update Conversation

Update the conversation details based on the conversation ID

PUT /conversations/{conversationId}

Requires scope: conversations.write.

Source

pub async fn get_messages_by_conversation_id( &self, conversation_id: &str, params: &GetMessagesByConversationIdParams, ) -> Result<GetMessagesByConversationResponseDto>

Available on crate feature conversations only.

Get messages by conversation id

Get messages by conversation id.

GET /conversations/{conversationId}/messages

Requires scope: conversations/message.readonly.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more