What are the requirements for APIs used on Haptik?

Here we highlight the requirements for APIs that are used on the Haptik for the development of bots. We will be consuming API endpoints in scenarios where data needs to be fetched from the database and presented to the end-user on the bot screen.

In order to call the APIs for development purposes, there are certain prerequisites that are listed below -

  1. All APIs should preferably be Restful APIs that use HTTPS requests to GET, PUT, POST, and DELETE data.
  2. Request and Response must be JSON preferably.
  3. API endpoints must be publicly accessible. In case they are not publicly accessible, Haptik’s IPs must be whitelisted to be able to be accessed.
  4. Each endpoint should contain the following details:
    1. Endpoint URL.
    2. The path to call each endpoint.
    3. Which HTTP methods can be used with each endpoint.
    4. Authentication and other headers are required with each request.
    5. Explanation of what request data is mandatory and what is optional.
    6. Example Request Body.
    7. Example Response Body.
    8. Possible Error Scenarios and Status Codes.
    9. If there is authentication, please provide authentication steps in detail.
  5. APIs should have a stable Staging/Test environment that can be used during development.  
  6. Test accounts/IDs that can be used for testing (as applicable). For eg.  dummy mobile numbers,  sample user IDs, sample tracking IDs, etc.
  7. Technical SPOC who is equipped to answer any queries/clarifications regarding the APIs.

Required API Details for Testing (SAMPLE FORMAT)

Sr. No.
Data
Example
1
API name
API to generate OTP
2
Method
POST
3
Endpoint URL
4
Headers
  • Authorization : Bearer <<token>>
  • Content-Type : application/json
5
Request body
Request:
{
    "mobileNo":"9928056506",
    "Attempt id" : "1"
}
6
Success Response
{
  status:"success",
  status_code:"SUCC001",
  message:"Request Successful"
}
7
Error Response
{
  "status": "error",
  "status_code": "ERR002",
  "message": "Request Failed"
}
8
Partner Code
"{partnercode}"
9

Consumer Key, Consumer Secret, User ID and Call back URL

If we are using these or similar, the key name should be properly mentioned. Eg: consumer_key
10

HTTP Status Codes

Code              Message

SUCC001       Request Successful

ERR001          Request Failed

Note:

These requirements may vary according to APIs.

Can’t find what you’re looking for? Email us at support@haptik.ai.