How to send message to Haptik using API?
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Table of Contents
Log Message to Haptik via REST APIURLHeadersPostResponseError ResponseSample CURL commandLog Message to Haptik via REST API
The Log Message API allows you to send messages via a POST
request to the Haptik Platform. The URL for message logging is generated on the Haptik Platform Dashboard.
URL
https://<BASE_URL>/v1.0/log_message_from_user/
Headers
Authorization: Bearer <TOKEN>
client-id: <CLIENT_ID>
Content-Type: application/json
- Authorization - The Authorization header of each HTTP request should be “Bearer” followed by your token which will be provided by Haptik
- client-id - The client id for your account which will be provided by Haptik
- Content-Type - application/json
Post
{
"user": {
"auth_id": "<AUTH_ID>"
},
"message_body": "<MESSAGE_BODY>",
"message_type": 0,
"business_id": 343
}
- auth_id - This is an alphanumeric User identifier from your system
- business_id - This is a numeric identifier for channel/queue that you wish to register the message on.
- message_body - The message body containing the message to be sent to the bot or agent.
- message_type - This defines the processing pipeline for messages, standard messages are of type
0
Response
A successful request to the log message sent API will return a 200
status code with a JSON response object. It will contain a unique message id and other metadata about the message.
{
"message_id": 1411200492,
"message_body": "<MESSAGE_BODY>",
"created_at": "2018-10-04T12:41:27.980Z",
"message_type": 0
}
- message_id - message id generated by haptik system
- message_body - message body that was logged in the haptik system
- created_at - ISO timestamp denoting when the message was created in the haptik system
- message_type - This defines the processing pipeline for messages, standard messages are of type
0
Error Response
If the user with auth_id is not registered, then the API will return a 403
status code.
{
"error_message": "user is not registered"
}
If the Authorization header is missing or invalid, then the API will return a 401
status code.
{
"error_message": "invalid authorization details"
}
Sample CURL command
curl -X POST \
https://<BASE_URL>/v1.0/log_message_from_user/ \
-H 'Authorization: Bearer <TOKEN>' \
-H 'client-id: <CLIENT_ID>' \
-H 'Content-Type: application/json' \
-d '{
"message_body": "<MESSAGE_BODY>",
"business_id": 343,
"message_type": 0,
"user": {"auth_id": "<AUTH_ID>"}
}'