This documentation includes all JavaScript methods available in Code Block as part of Processes.
Table of Contents
- API for Orders
- API for Products
- API for Returns
- API for Subscriptions
- API for Ticketing
- API for Block
- API for CRM
- API for AI
- API for Interaction
- API for HTTP
- API for Availability
- API for UI
- API for Inbox
- API for Files
Finishes the current block with the given status. This function does not have to be explicitly called in most cases, as the block will automatically finish when JavaScript evaluation completes.
| Name | Type | Description |
|---|---|---|
| result | "success" | "failure" | The completion status of the block. If result is not provided, defaults to success (optional) |
| reason | string | reason; the reason will be printed to session log if result is failure, otherwise it's ignored (optional) |
Retrieves the current user's information
User information object
Retrieves the last incoming message or null if none
The last message or null if no messages exist
Retrieves the list of conversation messages
Array of Messages
Logs a message to session log
| Name | Type | Description |
|---|---|---|
| message | string | The message |
| dumpContext | boolean | dump the entire context/store into session log (default: false) |
interaction.getPlaintextTranscript({ timeFrom, timeTo, timezoneOffsetMinutes, hideRealAgentNames, }: { timeFrom?: number; timeTo?: number; timezoneOffsetMinutes?: number; hideRealAgentNames?: boolean; }): string
Retrieves the plaintext transcript of the conversation.
| Name | Type | Description |
|---|---|---|
| options | object | Options for retrieving the transcript. |
| options.timeFrom | number | The start time (in milliseconds since epoch) to filter the transcript. |
| options.timeTo | number | The end time (in milliseconds since epoch) to filter the transcript. |
| options.timezoneOffsetMinutes | number | The timezone offset in minutes to adjust timestamps. |
| options.hideRealAgentNames | boolean | Whether to hide real agent names in the transcript. |
The plaintext transcript of the conversation.
Retrieves the plaintext transcript of the conversation.
The plaintext transcript of the conversation.
interaction.getHtmlTranscript({ timeFrom, timeTo, timezoneOffsetMinutes, hideRealAgentNames, }: { timeFrom?: number; timeTo?: number; timezoneOffsetMinutes?: number; hideRealAgentNames?: boolean; }): string
Retrieves the HTML transcript of the conversation.
| Name | Type | Description |
|---|---|---|
| options | object | Options for retrieving the transcript. |
| options.timeFrom | number | The start time (in milliseconds since epoch) to filter the transcript. |
| options.timeTo | number | The end time (in milliseconds since epoch) to filter the transcript. |
| options.timezoneOffsetMinutes | number | The timezone offset in minutes to adjust timestamps. |
| options.hideRealAgentNames | boolean | Whether to hide real agent names in the transcript. |
The HTML transcript of the conversation.
Retrieves the HTML transcript of the conversation.
The HTML transcript of the conversation.
Writes data to the structured session store.
| Name | Type | Description |
|---|---|---|
| key | string | The key to write to |
| value | any | The value to write |
Reads a value from a specific key from the structured session store
| Name | Type | Description |
|---|---|---|
| key | string | The key to read from |
The value or null if the value does not exist
Writes data to the raw session store
| Name | Type | Description |
|---|---|---|
| key | string | The key to write to |
| value | any | The raw value to write |
Reads a value from a specific key from the raw session store
| Name | Type | Description |
|---|---|---|
| key | string | The key to read from |
The raw value or null if the raw value does not exist
Reads all values from the structured session store
Object containing all key-value pairs
Reads all values from the raw session store
Object containing all key-value pairs
Writes a single value to the CRM
| Name | Type | Description |
|---|---|---|
| key | string | The key to write to |
| value | any | The value to write |
Writes multiple values to the CRM
| Name | Type | Description |
|---|---|---|
| data | Record<string, any> | Object containing multiple key-value pairs |
Retrieves the current user's information. Contains data written to the CRM earlier via write/writeMany, as well as default parameters that exist on the User object and parameters set by other parts of the system
User information object
Generates a completion for a given prompt
| Name | Type | Description |
|---|---|---|
| prompt | string | The input prompt |
An object with outcome and LLM response
| Name | Type |
|---|---|
| outcome | "success" | "failure" |
| value | string | null |
ai.completions.generate(prompt: string, config?: { asJson?: boolean }): { outcome: "success" | "failure", value: object | string | null }
Generates a completion for a given prompt
| Name | Type | Description |
|---|---|---|
| prompt | string | The input prompt |
| config | object | The optional configuration object for the request |
| config.asJson | boolean | Whether to return the response as a JSON object (default: false) |
An object with outcome and LLM response
| Name | Type |
|---|---|
| outcome | "success" | "failure" |
| value | object | string | null |
Recognizes the intent of a given message
| Name | Type | Description |
|---|---|---|
| message | string | The input message |
Intent recognition result or null
http.get(url: string, config?: { headers?: Record<string, string>; timeout?: number }): HttpResponse
Sends a GET request to the specified URL
| Name | Type | Description |
|---|---|---|
| url | string | The URL to send the request to |
| config | object | The optional configuration object for the request (optional) |
| config.headers | Record<string, string> | Headers (key-value pairs) to include in the request (optional) |
| config.timeout | number | The timeout in milliseconds (default: 30000). The maximum allowed value is 30000. |
The HTTP response
http.post(url: string, config?: { headers?: Record<string, string>; data: any; timeout?: number }): HttpResponse
Sends a POST request to the specified URL with the given configuration.
| Name | Type | Description |
|---|---|---|
| url | string | The endpoint to send the request to. |
| config | object | The optional configuration object for the request. |
| config.headers | Record<string, string> | Headers (key-value pairs) to include in the request (optional) |
| config.data | any | The payload to send in the request body. |
| config.timeout | number | The timeout in milliseconds (default: 30000). The maximum allowed value is 30000. |
The HTTP response
http.put(url: string, config?: { headers?: Record<string, string>; data: any; timeout?: number }): HttpResponse
Sends a PUT request to the specified URL with the given configuration.
| Name | Type | Description |
|---|---|---|
| url | string | The endpoint to send the request to. |
| config | object | The optional configuration object for the request. |
| config.headers | Record<string, string> | Headers (key-value pairs) to include in the request (optional) |
| config.data | any | The payload to send in the request body. |
| config.timeout | number | The timeout in milliseconds (default: 30000). The maximum allowed value is 30000. |
The HTTP response
http.patch(url: string, config?: { headers?: Record<string, string>; data: any; timeout?: number }): HttpResponse
Sends a PATCH request to the specified URL with the given configuration.
| Name | Type | Description |
|---|---|---|
| url | string | The endpoint to send the request to. |
| config | object | The optional configuration object for the request. |
| config.headers | Record<string, string> | Headers (key-value pairs) to include in the request (optional) |
| config.data | any | The payload to send in the request body. |
| config.timeout | number | The timeout in milliseconds (default: 30000). The maximum allowed value is 30000. |
The HTTP response
http.delete(url: string, config?: { headers?: Record<string, string>; timeout?: number }): HttpResponse
Sends a DELETE request to the specified URL with the given configuration.
| Name | Type | Description |
|---|---|---|
| url | string | The endpoint to send the request to. |
| config | object | The optional configuration object for the request. |
| config.headers | Record<string, string> | Headers (key-value pairs) to include in the request (optional) |
| config.timeout | number | The timeout in milliseconds (default: 30000). The maximum allowed value is 30000. |
The HTTP response
Checks if a handover instance is within working hours
| Name | Type | Description |
|---|---|---|
| handoverId | string | The handover instance ID to check |
true if within working hours, false otherwise
Sends a custom event to the chat widget.
| Name | Type | Description |
|---|---|---|
| name | string | The name of the event |
| params | Record<string, any> | Optional parameters to include with the event |
Searches for orders by order number across all integrations.
| Name | Type | Description |
|---|---|---|
| orderNumber | string | The order number to search for. |
An array of orders matching the order number.
Searches for orders by order number in specific integrations.
| Name | Type | Description |
|---|---|---|
| orderNumber | string | The order number to search for. |
| integrationIds | string[] | The integration IDs to search within. |
An array of orders matching the order number.
Searches for orders by email across all integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. |
An array of orders matching the email.
Searches for orders by email in specific integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. | |
| integrationIds | string[] | The integration IDs to search within. |
An array of orders matching the email.
Searches for orders by phone number across all integrations.
| Name | Type | Description |
|---|---|---|
| phoneNumber | string | The phone number to search for. |
An array of orders matching the phone number.
Searches for orders by phone number in specific integrations.
| Name | Type | Description |
|---|---|---|
| phoneNumber | string | The phone number to search for. |
| integrationIds | string[] | The integration IDs to search within. |
An array of orders matching the phone number.
Gets an order by ID from a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to get. |
| integrationId | string | The integration ID to get the order from. |
The order information or null if no order is found.
integrations.orders.cancel(orderId: string, integrationId: string, refund: RefundConfig): IntegrationResponse
Cancels an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to cancel. |
| integrationId | string | The integration ID to cancel the order from. |
| refund | RefundConfig | The refund configuration. |
A response object with the outcome and value/reason.
integrations.orders.refund(orderId: string, integrationId: string, refund: RefundConfig): IntegrationResponse
Refunds an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to refund. |
| integrationId | string | The integration ID to refund the order from. |
| refund | RefundConfig | The refund configuration. |
A response object with the outcome and value/reason.
integrations.orders.updateShippingAddress(orderId: string, integrationId: string, address: UpdateAddress): IntegrationResponse
Updates the shipping address of an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to update. |
| integrationId | string | The integration ID to update the order from. |
| address | UpdateAddress | The new shipping address. |
A response object with the outcome and value/reason.
integrations.orders.updatePhoneNumber(orderId: string, integrationId: string, phoneNumber: string): IntegrationResponse
Updates the phone number of an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to update. |
| integrationId | string | The integration ID to update the order from. |
| phoneNumber | string | The new phone number. |
A response object with the outcome and value/reason.
integrations.orders.updateEmail(orderId: string, integrationId: string, email: string): IntegrationResponse
Updates the email of an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to update. |
| integrationId | string | The integration ID to update the order from. |
| string | The new email. |
A response object with the outcome and value/reason.
integrations.orders.addNote(orderId: string, integrationId: string, note: string): IntegrationResponse
Adds a note to an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to update. |
| integrationId | string | The integration ID to update the order from. |
| note | string | The note to add. |
A response object with the outcome and value/reason.
integrations.orders.addTags(orderId: string, integrationId: string, tags: string[]): IntegrationResponse
Adds tags to an order in a specific integration.
| Name | Type | Description |
|---|---|---|
| orderId | string | The order ID to update. |
| integrationId | string | The integration ID to update the order from. |
| tags | string[] | The tags to add. |
A response object with the outcome and value/reason.
Searches for products in a specific integration.
| Name | Type | Description |
|---|---|---|
| options | ProductCatalogueSearchOptions | The options for the search. |
An array of products. Returns an empty array if none are found.
Searches for returns by customer email across all integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. |
An array of returns matching the email.
Searches for returns by customer email in specific integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. | |
| integrationIds | string[] | The integration IDs to search within. |
An array of returns matching the email.
Processes a return in a specific integration.
| Name | Type | Description |
|---|---|---|
| returnId | string | The return ID to process. |
| integrationId | string | The integration ID to process the return from. |
A response object with the outcome and value/reason.
Cancels a return in a specific integration.
| Name | Type | Description |
|---|---|---|
| returnId | string | The return ID to cancel. |
| integrationId | string | The integration ID to cancel the return from. |
A response object with the outcome and value/reason.
Closes a return in a specific integration.
| Name | Type | Description |
|---|---|---|
| returnId | string | The return ID to close. |
| integrationId | string | The integration ID to close the return from. |
A response object with the outcome and value/reason.
Flags a return in a specific integration.
| Name | Type | Description |
|---|---|---|
| returnId | string | The return ID to flag. |
| integrationId | string | The integration ID to flag the return from. |
A response object with the outcome and value/reason.
integrations.returns.createReturnLink(orderId: string, orderIntegrationId: string): IntegrationResponse
Creates a return link for a provided order.
| Name | Type | Description |
|---|---|---|
| orderId | string | The ID of an order. |
| orderIntegrationId | string | The integration ID for an order. |
A result for create return link action.
Searches for subscriptions by customer email across all integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. |
An array of subscriptions matching the email.
integrations.subscriptions.searchByEmail(email: string, integrationIds: string[]): SubscriptionDetails[]
Searches for subscriptions by customer email in specific integrations.
| Name | Type | Description |
|---|---|---|
| string | The email to search for. | |
| integrationIds | string[] | The integration IDs to search within. |
An array of subscriptions matching the email.
integrations.subscriptions.cancel( subscriptionId: string, integrationId: string, sendEmail: boolean, cancellationReason: string, cancellationReasonComments?: string ): IntegrationResponse
Cancels a subscription in a specific integration.
| Name | Type | Description |
|---|---|---|
| subscriptionId | string | The subscription ID to cancel. |
| integrationId | string | The integration ID to cancel the subscription from. |
| sendEmail | boolean | Whether to send an email notification to the customer. |
| cancellationReason | string | The reason for cancellation. |
| cancellationReasonComments | string | Comments for the cancellation reason (optional). |
A response object with the outcome and value/reason.
integrations.subscriptions.reschedule( subscriptionId: string, integrationId: string, nextChargeAt: number ): IntegrationResponse
Reschedules a subscription in a specific integration.
| Name | Type | Description |
|---|---|---|
| subscriptionId | string | The subscription ID to reschedule. |
| integrationId | string | The integration ID to reschedule the subscription from. |
| nextChargeAt | number | The timestamp for the next charge in milliseconds. |
A response object with the outcome and value/reason.
integrations.tickets.create( integrationId: string, subject: string, content: string, isHtmlContent: boolean, note: string, requester: RequesterInfo, tags: string[], fields: CustomField[], zendeskExtraProperties?: ZendeskTicketExtraProperties ): IntegrationResponse
Creates a new ticket in a specific integration.
| Name | Type | Description |
|---|---|---|
| integrationId | string | The integration ID to create the ticket in. |
| subject | string | The subject of the ticket. |
| content | string | The content of the ticket. |
| isHtmlContent | boolean | Whether the content is HTML. |
| note | string | A note for the ticket (optional). Leave as empty string if not needed. |
| requester | RequesterInfo | Information about the requester. |
| tags | string[] | Tags to add to the ticket. |
| fields | CustomField[] | Custom fields for the ticket. |
| zendeskExtraProperties | ZendeskTicketExtraProperties | Extra properties for Zendesk tickets (optional). |
A response object with the outcome and value/reason.
integrations.tickets.createWithTransfer( integrationId: string, subject: string, content: string, isHtmlContent: boolean, note: string, requester: RequesterInfo, tags: string[], fields: CustomField[], zendeskExtraProperties?: ZendeskTicketExtraProperties ): IntegrationResponse
Creates a new ticket and marks the conversation as transferred.
| Name | Type | Description |
|---|---|---|
| integrationId | string | The integration ID to create the ticket in. |
| subject | string | The subject of the ticket. |
| content | string | The content of the ticket. |
| isHtmlContent | boolean | Whether the content is HTML. |
| note | string | A note for the ticket (optional). Leave as empty string if not needed. |
| requester | RequesterInfo | Information about the requester. |
| tags | string[] | Tags to add to the ticket. |
| fields | CustomField[] | Custom fields for the ticket. |
| zendeskExtraProperties | ZendeskTicketExtraProperties | Extra properties for Zendesk tickets (optional). |
A response object with the outcome and value/reason.
integrations.inbox.create( mailboxId: string, requester: RequesterInfo, subject: string, content: string, attachments: { url: string; fileName?: string }[], queueAlias?: string ): InboxTicketsCreateResponse
Creates a new ticket in Inbox.
| Name | Type | Description |
|---|---|---|
| mailboxId | string | The mailbox ID to create the ticket in. |
| requester | RequesterInfo | Information about the requester. |
| subject | string | The subject of the ticket. |
| content | string | The content of the ticket. |
| attachments | object[] | Attachments to include with the ticket. |
| attachments.url | string | The URL of the attachment. |
| attachments.fileName | string | The file name of the attachment (optional). |
| queueAlias | string | Queue alias for routing (optional). |
An object with outcome and conversationId/reason.
integrations.inbox.createWithTransfer( mailboxId: string, requester: RequesterInfo, subject: string, content: string, attachments: { url: string; fileName?: string }[], queueAlias?: string ): InboxTicketsCreateResponse
Creates a new Inbox ticket and marks the conversation as transferred.
| Name | Type | Description |
|---|---|---|
| mailboxId | string | The mailbox ID to create the ticket in. |
| requester | RequesterInfo | Information about the requester. |
| subject | string | The subject of the ticket. |
| content | string | The content of the ticket. |
| attachments | object[] | Attachments to include with the ticket. |
| attachments.url | string | The URL of the attachment. |
| attachments.fileName | string | The file name of the attachment (optional). |
| queueAlias | string | Queue alias for routing (optional). |
An object with outcome and conversationId/reason.
files.getPublicUrl(file: { type: "File"; fileId: string }, options?: { ttlMinutes?: number }): string | null
Generates a public URL for a file.
| Name | Type | Description |
|---|---|---|
| file | object | The file object. |
| file.type | "File" | Must be "File". |
| file.fileId | string | The ID of the file. |
| options | object | Configuration for URL generation (optional). |
| options.ttlMinutes | number | Time-to-live in minutes (default: 24 hours). |
The public URL or null if the file is not found.
Represents a message in the interaction
| Name | Type | Description |
|---|---|---|
| author | "User" | "Chatbot" | The author of the message |
| content | string | The content of the message |
| timeMillis | number | The time of the message in milliseconds |
Represents the intent result
| Name | Type | Description |
|---|---|---|
| id | string | The intent ID |
| name | string | The intent name |
| confidence | number | The confidence level |
Represents the user information
| Name | Type | Description |
|---|---|---|
| userId | string | The user ID |
| string | null | The email of the user or null if not provided | |
| phoneNumber | string | null | The phone number of the user or null if not provided |
| platformId | string | The platform ID |
| language | string | The language of the user |
Represents the user information available through CRM
| Name | Type | Description |
|---|---|---|
| name | string | null | The name of the user or null if not provided |
| firstName | string | null | The first name of the user or null if not provided |
| lastName | string | null | The last name of the user or null if not provided |
| phoneNumber | string | null | The phone number of the user or null if not provided |
| string | null | The email of the user or null if not provided | |
| locale | string | null | The locale of the user or null if not provided |
| language | string | null | The language of the user or null if not provided |
| timeZone | string | null | The time zone of the user or null if not provided |
| authenticated | string | null | The authentication status or null if not provided |
| accessToken | string | null | The access token or null if not provided |
| [key: string] | string | null | Custom properties can be added with string keys |
Represents the HTTP response
| Name | Type | Description |
|---|---|---|
| outcome | "success" | "failure" | The outcome of the response, either "success" or "failure" |
| status | number | The status code of the response (optional) |
| body | object | string | The body of the response. Either an object (parsed JSON) when backend responds with ContentType: application/json or a string when ContentType: text/plain (optional) |
| error | string | The error message in case of a connection error (optional) |
Represents a price summary for an order
| Name | Type | Description |
|---|---|---|
| currency | string | The currency of the price |
| subtotal | number | The subtotal amount |
| discount | number | The discount amount |
| shipping | number | The shipping amount |
| tax | number | The tax amount |
| total | number | The total amount |
Represents a line item in an order
| Name | Type | Description |
|---|---|---|
| id | string | The ID of the line item |
| productId | string | The product ID |
| variantId | string | The variant ID |
| title | string | The title of the product |
| description | string | null | The description of the product |
| price | number | The price of the product |
| currency | string | The currency of the price |
| quantity | number | The quantity ordered |
| shopUrl | string | null | The shop URL |
| imageUrl | string | null | The image URL |
| sku | string | null | The SKU |
| requiresShipping | boolean | null | Whether physical shipping is required |
Represents a fulfillment for an order
| Name | Type | Description |
|---|---|---|
| id | string | The ID of the fulfillment |
| createdAtMillis | number | null | The creation time in milliseconds |
| deliveryProvider | string | null | The delivery provider |
| status | string | null | The status of the fulfillment |
| trackingNumber | string | null | The tracking number |
| trackingUrl | string | null | The tracking URL |
| estimatedDeliveryAtMillis | number | null | The estimated delivery time in milliseconds |
| deliveredAtMillis | number | null | The actual delivery time in milliseconds |
Represents an address
| Name | Type | Description |
|---|---|---|
| name | string | null | The name associated with the address (optional) |
| addressLine1 | string | null | The first line of the address (optional) |
| addressLine2 | string | null | The second line of the address (optional) |
| zip | string | null | The ZIP/postal code (optional) |
| city | string | null | The city (optional) |
| province | string | null | The province/state (optional) |
| country | string | null | The country (optional) |
| provinceCode | string | null | The province/state code (optional) |
| countryCode | string | null | The country code (optional) |
Represents an address with required fields
| Name | Type | Description |
|---|---|---|
| name | string | The name associated with the address |
| addressLine1 | string | The first line of the address |
| addressLine2 | string | null | The second line of the address |
| zip | string | The ZIP/postal code |
| city | string | The city |
| province | string | null | The province/state |
| country | string | The country |
| provinceCode | string | null | The province/state code |
| countryCode | string | null | The country code |
Represents a delivery method
| Name | Type | Description |
|---|---|---|
| name | string | The name of the delivery method |
| providerName | string | null | The provider name |
| providerCode | string | null | The provider code |
Represents contact details
| Name | Type | Description |
|---|---|---|
| string | null | The email address | |
| phoneNumber | string | null | The phone number |
Represents a custom property for an order
| Name | Type | Description |
|---|---|---|
| key | string | The key of the property |
| label | string | The label of the property |
| value | string | The value of the property |
Represents data of an order
| Name | Type | Description |
|---|---|---|
| orderId | string | The unique identifier of the order |
| orderNumber | string | The order number |
| status | string | The status of the order |
| createdAt | number | The creation time in milliseconds |
| priceSummary | PriceSummary | The price summary of the order |
| lineItems | LineItem[] | The line items in the order |
| fulfillments | Fulfillment[] | The fulfillments for the order |
| billingAddress | Address | null | The billing address |
| shippingAddress | Address | null | The shipping address |
| tags | string[] | The tags associated with the order |
| adminUrl | string | null | The admin URL for the order |
| storeUrl | string | null | The store URL for the order |
| financialStatus | string | null | The financial status of the order |
| fulfillmentStatus | string | null | The fulfillment status of the order |
| deliveryMethods | DeliveryMethod[] | The delivery methods for the order |
| contactDetails | ContactDetails | null | The contact details for the order |
| processedAt | number | null | The processing time in milliseconds |
| customProperties | OrderCustomProperty[] | The custom properties for the order |
| integrationId | string | null | The integration ID for the order (optional) |
Represents a variant of a product in the catalogue
| Name | Type | Description |
|---|---|---|
| variantId | string | The unique identifier of the variant |
| title | string | The title of the variant |
| minPrice | number | The minimum price of the variant |
| maxPrice | number | The maximum price of the variant |
| imageUrl | string | null | The image URL |
| sku | string | null | The SKU |
| requiresShipping | boolean | null | Whether physical shipping is required |
Represents a product in the catalogue
| Name | Type | Description |
|---|---|---|
| productId | string | The unique identifier of the product |
| title | string | The title of the product |
| shopUrl | string | The shop URL |
| imageUrl | string | null | The image URL |
| tags | string[] | The tags associated with the product |
| skus | string[] | The SKUs associated with the product |
| variants | CatalogueProductVariant[] | The variants associated with the product |
Represents a refund configuration for an order
| Name | Type | Description |
|---|---|---|
| currency | string | The currency of the refund |
| reason | "RESTOCK" | "DAMAGED" | "CUSTOMER" | "OTHER" | The reason for the refund |
| notifyCustomer | boolean | Whether to notify the customer about the refund (default: false) |
| note | string | Note for the refund (optional) |
| refundLineItems | { itemId: string; quantity: number; restockType: "CANCEL" | "RETURN" | "NO_RESTOCK"; }[] | Line items to be refunded (default: []) |
| refundCustomAmount | number | Custom amount to refund (optional) |
| refundShipping | number | Shipping refund (optional) |
Represents options for searching products in the catalogue
| Name | Type | Description |
|---|---|---|
| integrationId | string | The integration ID to limit the search to (optional) |
| query | string | The query to search for (optional) |
| tags | string[] | The tags to search within (optional) |
| page | number | The page number to search on (default: 1) (optional) |
| entriesPerPage | number | The number of entries per page (default: 20) (optional) |
Represents a return item
| Name | Type | Description |
|---|---|---|
| id | string | The ID of the return item |
| name | string | The name of the item |
| sku | string | null | The SKU of the item |
| quantity | number | The quantity returned |
| price | number | The price of the item |
| currency | string | The currency of the price |
| shopUrl | string | null | The shop URL for the item |
| imageUrl | string | null | The image URL for the item |
| reasonType | string | null | The reason type for the return |
| reasonName | string | null | The reason name for the return |
| compensationType | string | null | The compensation type for the return |
Represents shipping details for a return
| Name | Type | Description |
|---|---|---|
| trackingNumber | string | null | The tracking number |
| trackingUrl | string | null | The tracking URL |
| carrier | string | null | The carrier name |
| method | string | null | The shipping method |
| cost | number | null | The shipping cost |
| currency | string | null | The currency of the cost |
Represents details of a return
| Name | Type | Description |
|---|---|---|
| returnId | string | The unique identifier of the return |
| statusType | string | The status type of the return |
| statusName | string | The status name of the return |
| orderNumber | string | The order number associated with the return |
| items | ReturnItem[] | The items in the return |
| shipping | ReturnShipping | null | The shipping details for the return |
| currency | string | The currency of the return |
| totalAmount | number | The total amount of the return |
| adminUrl | string | null | The admin URL for the return |
| portalUrl | string | null | The portal URL for the return |
| integrationId | string | The integration ID for the return |
Represents details of a subscription
| Name | Type | Description |
|---|---|---|
| subscriptionId | string | The unique identifier of the subscription |
| status | string | The status of the subscription |
| title | string | The title of the subscription |
| createdAt | number | The creation time in milliseconds |
| cancelledAt | number | null | The cancellation time in milliseconds (if cancelled) |
| cancellationReason | string | null | The reason for cancellation (if cancelled) |
| price | number | The price of the subscription |
| quantity | number | The quantity of the subscription |
| currency | string | The currency of the subscription |
| firstChargeAt | number | null | The time of the first charge in milliseconds |
| lastChargeAt | number | null | The time of the last charge in milliseconds |
| nextChargeAt | number | null | The time of the next charge in milliseconds |
| adminUrl | string | null | The admin URL for the subscription |
| integrationId | string | null | The integration ID for the subscription |
| shippingAddress | Address | null | The shipping address |
Represents information about the requester for a ticket
| Name | Type | Description |
|---|---|---|
| string | The email of the requester | |
| name | string | The name of the requester (optional) |
| phone | string | The phone number of the requester (optional) |
Represents a custom field for a ticket
| Name | Type | Description |
|---|---|---|
| key | string | The key of the custom field |
| value | string | The value of the custom field |
Represents extra properties for a Zendesk ticket
| Name | Type | Description |
|---|---|---|
| brandId | number | The brand ID (optional) |
| productId | number | The product ID (optional) |
| ccEmails | string[] | CC email addresses (required) |
Represents a response from an integration operation
| Name | Type | Description |
|---|---|---|
| outcome | "success" | "failure" | The outcome of the operation, either "success" or "failure" |
| value | string | The value returned if the operation was successful (usually the ID of the entity) (optional) |
| reason | string | The reason for failure if the operation failed (optional) |
Represents a response from creating a ticket in Inbox
| Name | Type | Description |
|---|---|---|
| outcome | "success" | "failure" | The outcome of the ticket creation, either "success" or "failure" |
| conversationId | string | The ID of the created conversation if successful (optional) |
| reason | string | The reason for failure if the ticket creation failed (optional) |