Messaging API
Interacting with the Travtus Messaging API
The Travtus Messaging API allows clients and partners to interact with Travtus Teammates via their own phone number routing or web chat solutions. Follow the instructions below to set up and use the Messaging API.
Request API Credentials
To use the Messaging API, request API credentials by contacting our support team at [email protected].
Involved Users and Systems
The following users and systems are involved in this integration scenario:
- Customer: End user
- Travtus Teammate: The initial point of contact, handles all incoming customer messages until escalation is triggered.
- Travtus Messaging API: Provides an API to receive requests from the Source System and send responses from Travtus Teammate.
- Source System: Provides an SMS channel for customers and integrates with the Travtus Messaging API.
API Endpoint Overview
- POST /v1/sessions: Create a new customer session.
- POST /v1/sessions/session-id-1/messages: Send a message in an existing session.
- POST /v1/webhooks: Set up a webhook to receive API responses.
Authentication
All API requests must be authenticated using the provided API credentials.
Detailed Workflow
The following step-by-step description provides a detailed explanation of the logic and API requests used at each step of the workflow.
Use Case: Create Customer Session
Step 1: Customer Interacts with Source System
The customer sends a message via the Source System (e.g., SMS, web chat).
Step 2: Source System Sends “Create Customer Session” Request
If the customer conversation does not yet have an existing session, the Source System creates a new session for the customer by sending a request to the Travtus Messaging API.
Step 3: Travtus Messaging API Confirms Receipt
Upon receipt of the “create session” request, the Travtus Messaging API will create a new session, returning a 200 status with the sessionId
and userId
.
Once a customer session is created, customer messages can be submitted.
Use Case: Customer Sends a Message
Step 1: Source System Sends Customer Message
The Source System sends the message data to the Travtus Messaging API to create a message in the Travtus system using the supplied sessionId
.
Step 2A: Travtus Messaging API Confirms Receipt
Upon receipt of the “message” request, the Travtus Messaging API adds a new message to the conversation, returning a 200 status.
Step 2B: Session Expired
In case of an expired session, a session_not_found
error is returned.
Step 3: Travtus API Sends “Message” Event with Reply Message
Travtus API replies are sent to the appropriate webhook:
Webhook calls expect to receive an HTTP 200 status response.
Participant types:
bot
: Travtus Teammateagent
: Human agent
Error Handling
Common error responses:
- 400 Bad Request: The request could not be understood or was missing required parameters.
- 401 Unauthorized: Authentication failed or user does not have permissions for the requested operation.
- 404 Not Found: The requested resource could not be found.
- 500 Internal Server Error: An error occurred on the server.
Rate Limits
API rate limits are imposed to ensure fair use. Please contact support for details on rate limits.
Webhook Configuration
To receive responses from the Travtus API, set up a webhook by sending a request to the following endpoint: