API Reference

@frontend-sdk/gorgias - v0.26.0

Interfaces

Functions

useChat

Const useChat(options): ChatStatus

Install Gorgias Chat widget.

Parameters

NameType
optionsUseChatOptions

Returns

ChatStatus


useChatActions

Const useChatActions(): ChatActions

Get available chat actions.
Should be used only after useChat.

Returns

ChatActions


useChatState

Const useChatState(): ChatState

Get current chat state.
Should be used only after useChat.

Returns

ChatState

Interface: ChatActions

Properties

clear

Readonly clear: () => void

Type declaration

▸ (): void

Remove all chat data from localStorage

Returns

void


close

Readonly close: () => void

Type declaration

▸ (): void

Close chat popup

Returns

void


open

Readonly open: () => void

Type declaration

▸ (): void

Open chat popup

Returns

void


setShopifyContext

Readonly setShopifyContext: (context: ShopifyContext) => void

Type declaration

▸ (context): void

Set Shopify context.
This is useful when using Gorgias chat widget in a headless Shopify.

Parameters
NameType
contextShopifyContext
Returns

void


setUserEmail

Readonly setUserEmail: (email: string) => void

Type declaration

▸ (email): void

Set user email associated to the current chat conversation

Parameters
NameType
emailstring
Returns

void

Interface: ChatState

Properties

isOpened

Readonly isOpened: boolean

Indicates whether chat popup is opened

Interface: ShopifyContext

Properties

cart

Optional Readonly cart: ShopifyCart

Shopify Cart of the Shopify user currently using the chat.
The cart details will be displayed in the sidebar of the ticket on the helpdesk application.


customerId

Optional Readonly customerId: number

Shopify customer id


domain

Readonly domain: string

Shopify permanent domain that contains .myshopify.com

Interface: UseChatOptions

Properties

apiBaseURL

Readonly apiBaseURL: string

Gorgias API base URL


chatAppId

Readonly chatAppId: string

Gorgias chat app id


chatBaseURL

Readonly chatBaseURL: string

Gorgias chat base URL