For the complete documentation index, see llms.txt. This page is also available as Markdown.

Genesys Cloud Integration

Connect the MaiAgent conversation platform to Genesys Cloud through Open Messaging, covering architecture, OAuth credentials and APIs, two-way message flow, signature verification, error handling, and

This page is for integration developers and customer IT teams who want to connect the MaiAgent conversation platform to Genesys Cloud. The integration uses Genesys Cloud Open Messaging: a visitor chats on a MaiAgent conversation platform (Web Chat, LINE, and so on), MaiAgent sends the message to Genesys Cloud in real time, and replies from the Genesys Cloud side (an agent or a bot) are sent back to MaiAgent, which forwards them to the visitor.

This is the built-in version of "Scenario B" in Third-Party Customer Service System Integration (the visitor is on the MaiAgent conversation platform and the service staff are in your system). MaiAgent already includes the Genesys Cloud message format, OAuth token exchange, and signature verification, so you do not need to write your own relay program.

For step-by-step instructions in the admin console (where to fill in fields and which buttons to click), see Webhook › Genesys Cloud Integration in the User Manual. This page explains the underlying protocol, APIs, and behavior.

API field names use camelCase. The API examples below use https://api.maiagent.ai/api/v1/ as the base URL. For authentication, see Quickstart.

Integration Architecture

The integration consists of three settings on the same conversation platform:

Setting
Direction
Purpose

Genesys Cloud integration (one per conversation platform)

—

Stores the region, Open Messaging Integration ID, and OAuth Client Credentials. MaiAgent uses it to obtain access tokens and build Genesys API URLs; it is shared by all Genesys-format Webhooks under that conversation platform

Incoming/Outgoing Webhook with the Payload format set to Genesys Cloud

MaiAgent → Genesys Cloud

Sends visitor messages (Incoming) and Agent or human replies (Outgoing) to the Genesys Cloud Open Messaging Inbound API

Receive Webhook with the default Payload format set to Genesys Cloud

Genesys Cloud → MaiAgent

Provides a receive URL so that Genesys Cloud can send replies back to MaiAgent

Prerequisites

Prepare the following on the Genesys Cloud side:

  1. Open Messaging integration: Get its Integration ID (in the admin console: Genesys Cloud Admin → Message → Platforms).

  2. OAuth Client: Use the Client Credentials grant type with the conversation:message:create permission, and get the Client ID and Client Secret.

  3. Confirm the region where your Genesys Cloud organization is located, and check it against the Supported Regions below.

On the MaiAgent side, the permissions required to call the integration API below are:

  • Accessible conversation platforms: Organization owners can access all conversation platforms in the organization. Other members can access only the conversation platforms they have been granted access to through groups, and never the organization's MaiGPT conversation platform. A conversation platform you cannot access returns 404.

  • Write operations (PUT, DELETE, test credentials): The member also needs the "Conversation Platform" permission (owners have it when the organization plan includes this permission). Without it, the API returns 403. Queries (GET) only require being logged in.

Genesys Cloud Integration Settings

Each conversation platform can have at most one Genesys Cloud integration.

Fields

Field
Type
Description

region

string

Genesys Cloud region code. See Supported Regions. Required

integrationId

string

Open Messaging Integration ID, up to 64 characters. Required

clientId

string

OAuth Client ID, up to 64 characters. Required

clientSecret

string

OAuth Client Secret. Write-only; never returned in any response. Required when creating; can be omitted in later updates to keep the existing value. Stored encrypted

hasClientSecret

boolean

Read-only. Whether a Client Secret is stored

tokenStatus

string

Read-only. Access token status: active (usable, or no token has been requested yet) / expired (the cached token has expired and will be renewed automatically on the next send) / invalidated (Genesys Cloud rejected these credentials; the Client Secret must be entered again)

regionLabel

string

Read-only. Display name of the region

id, createdAt, updatedAt

—

Read-only

The access token is stored only inside MaiAgent and never appears in API responses.

API

  • PUT with clientSecret: MaiAgent first exchanges a token with Genesys Cloud's /oauth/token using Client Credentials (10-second timeout) to verify the credentials. If this fails, it returns 400 and saves nothing. After verification succeeds, the earlier invalidation flag and the cached token are cleared.

  • PUT without clientSecret (changing only the region or ID): Credentials are not re-verified and the existing Secret is kept. If the integration was already invalidated, the status stays unchanged; you must enter a new Secret to recover it.

  • Test endpoint without clientSecret: The test uses the stored region, Client ID, and Secret. The region/clientId you pass are ignored. If no Secret is stored, it returns 400.

  • Removing the integration: Genesys-format Incoming/Outgoing Webhooks under that conversation platform stop sending from then on (no delivery logs are kept), while the Webhook settings themselves remain.

When setting up or testing credentials fails, the API returns 400. Common detail values are listed below (translated according to Accept-Language):

detail (original English text)

Cause

Unsupported Genesys Cloud region.

region is not in the supported list (test endpoint; for PUT, field validation rejects it first and returns a field error)

Genesys Cloud rejected the client credentials. Please double-check clientId/clientSecret.

Genesys Cloud returned invalid_client or unauthorized_client

Genesys Cloud token endpoint returned an error.

Genesys Cloud returned another error status

Network error talking to Genesys Cloud

Unable to reach Genesys Cloud

client_secret is required for new Genesys Cloud integrations.

clientSecret was not provided on creation

client_secret is required to test credentials.

The test endpoint was called without clientSecret, and this conversation platform has no stored Secret

Supported Regions

MaiAgent determines the domains used for token exchange and message delivery from the region. If your network has outbound restrictions, allow both corresponding domains.

region

Display name

Token exchange domain

API domain

us-east-1

Americas (US East)

login.mypurecloud.com

api.mypurecloud.com

us-east-2

US East 2 (FedRAMP)

login.use2.us-gov-pure.cloud

api.use2.us-gov-pure.cloud

us-west-2

Americas (US West)

login.usw2.pure.cloud

api.usw2.pure.cloud

ca-central-1

Canada

login.cac1.pure.cloud

api.cac1.pure.cloud

sa-east-1

South America

login.sae1.pure.cloud

api.sae1.pure.cloud

eu-west-1

EMEA (Ireland)

login.mypurecloud.ie

api.mypurecloud.ie

eu-west-2

EMEA (London)

login.euw2.pure.cloud

api.euw2.pure.cloud

eu-central-1

EMEA (Frankfurt)

login.mypurecloud.de

api.mypurecloud.de

eu-central-2

EMEA (Zurich)

login.euc2.pure.cloud

api.euc2.pure.cloud

ap-northeast-1

Asia Pacific (Tokyo)

login.mypurecloud.jp

api.mypurecloud.jp

ap-northeast-2

Asia Pacific (Seoul)

login.apne2.pure.cloud

api.apne2.pure.cloud

ap-northeast-3

Asia Pacific (Osaka)

login.apne3.pure.cloud

api.apne3.pure.cloud

ap-southeast-2

Asia Pacific (Sydney)

login.mypurecloud.com.au

api.mypurecloud.com.au

ap-south-1

Asia Pacific (Mumbai)

login.aps1.pure.cloud

api.aps1.pure.cloud

me-central-1

Middle East (UAE)

login.mec1.pure.cloud

api.mec1.pure.cloud

Configure Webhooks

For the common Webhook fields and the management API (/inboxes/{inboxId}/webhooks/), see Webhook › Manage Webhooks by API. The settings used for Genesys Cloud are as follows.

MaiAgent → Genesys Cloud: Incoming/Outgoing

  • Set templatePreset to genesys_cloud. url can be left empty: the destination URL is always built from the integration settings when sending, and the value of the url field is not used.

  • When sending, MaiAgent automatically adds Authorization: Bearer <access token>, so you do not need to put a token in headers.

  • Depending on the direction, requests go to different endpoints of the Genesys Cloud Open Messaging Inbound API:

direction

Message sent

Sent to

incoming

Visitor message

https://{API domain}/api/v2/conversations/messages/{integrationId}/inbound/open/message

outgoing

Reply from an Agent or human service staff in MaiAgent

https://{API domain}/api/v2/conversations/messages/{integrationId}/inbound/open/receipt

  • The genesys_cloud format can be used only with incoming/outgoing. Using it with receive returns 400.

  • If the conversation platform has no Genesys Cloud integration configured, these Webhooks are not sent and no delivery logs are kept.

Genesys Cloud → MaiAgent: Receive

  • Both payloadPreset and secretToken are required; omitting either returns 400. secretToken is write-only and is not returned in queries.

  • After creation, querying this Webhook returns a receiveUrl in the format https://<MaiAgent domain>/api/webhooks/inbox/{inboxId}/{webhookId}/. In the Genesys Cloud Open Messaging integration, set the outbound webhook URL to receiveUrl and set the signing secret to the same secretToken.

Message Format: MaiAgent to Genesys Cloud

Content-Type: application/json. Incoming and Outgoing share the same structure and are distinguished by direction:

Field
Content

channel.messageId

MaiAgent message ID

channel.time

Message creation time (ISO 8601)

channel.to.id

MaiAgent conversation platform ID

channel.from.id

MaiAgent contact ID (the visitor). Genesys Cloud returns this ID when it replies, and MaiAgent uses it to find the visitor to reply to

channel.from.idType

email if the contact has an email, otherwise opaque

channel.from.firstName

Contact name; lastName is always an empty string

text

Message text; an empty string for messages that contain only attachments and no text

direction

Inbound for the Incoming Webhook, Outbound for the Outgoing Webhook

content[]

Present only when there are attachments. mediaType mapping: images and stickers are Image, videos are Video, audio is Audio, everything else is File. url prefers the file URL stored by MaiAgent and falls back to the source URL; mime is inferred from the file name, or application/octet-stream if it cannot be inferred

Message Format: Genesys Cloud to MaiAgent

Signature Verification

MaiAgent accepts only requests with a valid signature. The X-Hub-Signature-256 header must equal sha256= followed by the Base64-encoded value (not hexadecimal) of the HMAC-SHA256 computed over the raw request body with secretToken as the key, compared in constant time. A missing header, a mismatched signature, or a Webhook without a secretToken always returns 403.

This signature is generated by Genesys Cloud and verified by MaiAgent. It is a different mechanism from the X-MaiAgent-Signature-256 (hexadecimal, with a timestamp) that MaiAgent includes when it pushes.

Content That Is Processed

MaiAgent reads the following from the body of the Genesys Cloud outbound webhook:

Field
Purpose

type

Only Text is processed; other types (such as receipts and events) immediately return 200 without creating a message

text

Reply text (leading and trailing whitespace removed)

content[]

Items whose contentType is Attachment and that have attachment.url create attachments. mediaType values Image/Video/Audio map to the same type; everything else becomes a regular file

channel.to.id

The MaiAgent contact ID to reply to, which is the channel.from.id sent earlier

channel.from

Information about the replier (id, idType, firstName, lastName, nickname), stored in the message's metadata.genesys_from

originatingEntity

The source of the reply (for example Human, Bot), stored in the message's metadata.originating_entity

id

Genesys Cloud message ID, used for deduplication

If there is neither text nor attachments, or channel.to.id is missing, the API returns 200 without creating a message.

Writing to the Conversation and Forwarding to the Visitor

  1. MaiAgent finds the contact on this conversation platform by channel.to.id, then takes the contact's most recently active conversation on this conversation platform. If no contact or conversation is found, it returns 200 without creating a message.

  2. If a message with the same Genesys message id has already been stored, it is skipped, so Genesys Cloud retries do not create duplicate messages.

  3. A reply message (Outgoing) is created. The sender is the Agent bound to the conversation platform; if no Agent is bound, the creator of the conversation platform is used. To tell whether the reply came from a human or a bot on the Genesys side, read metadata.originating_entity.

  4. The message is sent through the conversation platform where the visitor is, using the same sending flow as other MaiAgent replies. If there are attachments, they are downloaded before sending; if an individual attachment fails to download, the text and the other attachments are still sent as usual.

  5. This message does not trigger the Outgoing Webhook of the conversation platform again, which prevents the same reply from being sent back to Genesys Cloud.

Relationship to Human Handoff

The Incoming Webhook pushes every visitor message on the conversation platform, regardless of whether the conversation is currently handled by an Agent or a human. The Outgoing Webhook pushes replies from the Agent and from human service staff in the MaiAgent console. When both directions are configured, the Genesys Cloud side can see the full conversation.

Whether the Agent replies automatically is still determined by the human handoff state of the MaiAgent conversation (auto_reply_enabled). For handoff conditions, when the conversation returns to AI, and calling return-to-ai through the API, see Third-Party Customer Service System Integration (Including Human Handoff) and Human Handoff Settings in the User Manual.

Error Handling

MaiAgent to Genesys Cloud

Situation
Behavior

Access token is cached and expires in more than 60 seconds

Used directly

No token, or it expires within 60 seconds

A new token is obtained from Genesys Cloud before sending (10-second timeout)

Genesys Cloud API returns 401

Immediately force-renews the token and resends once, without using the automatic retry quota; if it is still 401, it stops

Genesys Cloud returns invalid_client/unauthorized_client during token exchange

The integration is marked as invalidated (tokenStatus: invalidated) and that message is dropped. From then on, all Genesys-format Webhooks pause sending and keep no delivery logs until clientSecret is entered again with PUT

Timeout, connection failure, 5xx, 429

Per Webhook › Automatic Retry: resent once after about 1, 5, and 15 minutes

Other 4xx

Recorded as failed and not resent

Every request and response sent is kept in the delivery logs (headers are masked). To see where to view them, see Webhook › Delivery Behavior.

Genesys Cloud to MaiAgent

Response
Situation

404

The Webhook does not exist, is disabled, is not of type receive, or the conversation platform ID in the URL does not match the Webhook

403 {"detail": "Invalid signature."}

The signature is missing or does not match, or the Webhook has no secretToken

200

Verification passed. This includes successful writes as well as the skipped cases listed above (not Text, no content, contact or conversation not found, duplicate message)

200

An error occurred during processing (for example, the body is not valid JSON). MaiAgent logs the error and still returns 200

Limitations

  • Each conversation platform can have only one Genesys Cloud integration, shared by all Genesys-format Webhooks under that platform.

  • Regions are limited to the Supported Regions listed above.

  • Of the content Genesys Cloud sends back, only Text-type text and attachments are processed; other message types do not appear in the conversation.

  • Replies are always written to the contact's most recently active conversation on this conversation platform. If the same visitor has multiple conversations at once, you cannot target a different one.

  • The default Payload format for Receive currently supports only Genesys Cloud. For other external platforms, use the API write-back approach in Third-Party Customer Service System Integration.

Last updated

Was this helpful?