gohighlevel-php-sdk

Conversation Resource

Conversation

The Conversation class serves as the main entry point for managing conversations. It allows you to perform CRUD operations on conversations and provides access to sub-resources for handling messages, emails, and searching.


get(string $conversationId): array|string

Retrieves a single conversation by its ID. This method corresponds to the GET /conversations/{conversationId} endpoint.


update(string $conversationId, array $params): array|string

Updates an existing conversation. This method corresponds to the PUT /conversations/{conversationId} endpoint.


delete(string $conversationId): array|string

Deletes a conversation. This method corresponds to the DELETE /conversations/{conversationId} endpoint.


create(array $params): array|string

Creates a new conversation. This method corresponds to the POST /conversations/ endpoint.


email(): EmailContract

Returns an instance of the Email resource for managing conversation-related emails.


message(): MessageContract

Returns an instance of the Message resource for managing messages within conversations.


search(): SearchContract

Returns an instance of the Search resource for searching conversations.


Email

The Email class, a sub-resource of Conversation, provides methods for managing email messages.


get(string $id): array|string

Retrieves a specific email message by its ID. This method corresponds to the GET /conversations/messages/email/{id} endpoint.


cancelSchedule(string $emailMessageId): array|string

Cancels a scheduled email message. This method corresponds to the DELETE /conversations/messages/email/{emailMessageId}/schedule endpoint.


Message

The Message class, a sub-resource of Conversation, provides a comprehensive set of methods for sending, retrieving, and managing messages of various types (e.g., SMS, MMS, etc.) within conversations.


get(string $id): array|string

Retrieves a single message by its ID. This method corresponds to the GET /conversations/messages/{id} endpoint.


byConversation(string $conversationId, $queryParams = []): array|string

Retrieves all messages for a specific conversation. This method corresponds to the GET /conversations/{conversationId}/messages endpoint.


send(string $type, string $contactId, $params = []): array|string

Sends a new message (e.g., SMS, MMS, email, etc.) to a contact. This method corresponds to the POST /conversations/messages endpoint.


inbound(string $type, string $conversationId, string $conversationProviderId, array $params = []): array|string

Simulates an inbound message to a conversation. This is typically used for testing or integrating with third-party providers. The method corresponds to the POST /conversations/messages/inbound endpoint.


outbound(string $type, string $conversationId, string $conversationProviderId, array $params = []): array|string

This method appears to be a duplicate of the inbound method in the provided code, and it also calls the POST /conversations/messages/inbound endpoint.


cancel(string $messageId): array|string

Cancels a scheduled message. This method corresponds to the DELETE /conversations/messages/{messageId}/schedule endpoint.


upload(string $conversationId, string $locationId, array $attachmentUrls): array|string

This method seems to be incorrectly implemented, as the upload method in the provided code is trying to use attachmentUrls in the Payload::upload() call, which is not a standard way to upload files via multipart/form-data. The GoHighLevel API typically expects a multipart array with name, contents, and filename for file uploads. The provided code is likely to fail as written.


updateStatus(string $messageId, $params = []): array|string

Updates the status of a message. The provided method implementation doesn’t pass any parameters to the API call, which is likely incorrect. The GoHighLevel API for this endpoint expects a body with a status field.


getRecording(string $locationId, string $messageId): array|string

Retrieves the recording for a voice message (e.g., call). This method corresponds to the GET /conversations/messages/{messageId}/locations/{locationId}/recording endpoint.


getTranscript(string $locationId, string $messageId): array|string

Retrieves the transcript for a voice message. This method corresponds to the GET /conversations/locations/{locationId}/messages/{messageId}/transcription endpoint.


downloadTranscript(string $locationId, string $messageId): array|string

Downloads the transcript for a voice message. This method corresponds to the GET /conversations/locations/{locationId}/messages/{messageId}/transcription/download endpoint.


The Search class, a sub-resource of Conversation, provides a method for searching conversations.


make(string $locationId, $parameters = []): array|string

Searches for conversations based on various criteria within a specified location. This method corresponds to the GET /conversations/search endpoint.