Custom API

Integrate chat API into application platforms:

  • Generate access token (access token)

  • Integrate VA chat API into the platform according to the parameters below:

// Send message to bot
curl -i \
-H "Content-Type: application/json" \
-H "Authorization: access_token" \
-X POST -d "{ \"userId\": \"123\", \"text\": \"hello\", \"userInfo\": {\"name\": \"user\" }}"\
https://apis.vnlp.ai/custom/webhook

In there:

  • access_token: access code created in the step above

  • userId: used to identify the user (chat with bot)

  • text: user's chat sentence

  • userInfo: includes other user information such as name, phone_number, email...

The customer builds a webhook to receive the results, after the VA bot has finished processing and gives feedback to the user, according to the form:

// Bot respond
curl -i\
-H "Content-Type: application/json" \
-H "Authorization: verify_token" \
-X POST -d "{ \"userId\": \"123\", \"responses\": [], \"intents\": [{\"value\": \"intent_name\", \" confidence\": 90}], \"allParameters\": {\"name\": \"username\"}}"\
partner_webhook

In there:

  • verify_token: customer verification code (yes or no)

  • partner_webhook: webhook the client provides to receive responses

Last updated