Common Flow Example
This example walks through a complete workflow that you’ll use frequently when integrating with the Gleap API.Step 1: Create or Find a Session
First, create a session to represent a user or contact. If a session with the sameuserId already exists, you can use that session ID instead.
Endpoint: POST /v3/sessions
Request:
Save the
_id or id from the response - you’ll need it to create a ticket linked to this session.Step 2: Create a Ticket
Now create a ticket and link it to the session you just created. The ticket represents a support request, bug report, or feature request. Endpoint:POST /v3/tickets
Request:
Save the
_id or id from the ticket response - you’ll need it to add comments to this ticket.Step 3: Create a Comment
Add a comment to the ticket. Comments can be simple text or rich formatted content. You can also attach files. Endpoint:POST /v3/messages
Request (Simple Text Comment):
Step 4: Create a Customer Comment
You can also create a comment that appears as if it’s from the customer (session) rather than from an agent. This is useful when you want to add a comment on behalf of the customer. Endpoint:POST /v3/messages
Request:
By including the
session field in the request, the comment will appear as if it came from the customer (session) rather than from an agent (user). Omit the session field to create an agent comment.