JSON API


The JSON API allows your bot to send HTTP GET and POST requests and interpret responses.

It allows you to generate dynamic content and get and set user attributes. If you select POST user attributes get to send in the body of the request. GET adds parameters as a query string.

 

JSON-API

 

Select the request type, enter the URL to call and user attributes to get from the user as shown in the above example. Use the response references to send text, text with button and text with quick reply.

  • The JSON API plugin enables you to integrate your backend into your chatbots on Floatbot.
  • The JSON API plugin enables your bot to send HTTP GET and POST requests and interpret responses

    It allows you to

    • Generate dynamic content
    • Get and set user attributes
    • Redirect users to another block in the bot
    • Create postbacks

    If you select POST user attributes get send in the body of the request. GET adds parameters as a query string.The max. timeout is 10 seconds in both cases.

    In your responses, you can

  • Combine several messages in one answer by sending several dictionaries in the messages array.
  • Use any content type header.
  • Send an empty response to not show the user any dynamic content.

Response Reference

Sending text

Use this response to send text messages.


{
	"data":
	[
		{"text": "Welcome to Floatbot!" }
		{"text": "How do you do" }
	]
}

 

Sending Text with Button

Use this response to send text with button.


{
	"data":
	[
		"text": "Welcome to the Floatbot World!",
		"buttons":
		[
			"type":"url",
			"title":"Test",
			"link":"https://floatbot.ai/"
		]
	]
}

Sending Text with Quick Reply

Use this response to send text with Quick Reply.


{
	"data":
	[
		"text": "Welcome to the Floatbot World!",
		"attribute":"f_name",
		"quick_reply":
		[
			{
				"title":"Yes",
			},
			{
				"title":"No",
			}
		]
	]
}