Skip to content

Instantly share code, notes, and snippets.

@khaled-11
khaled-11 / sample.js
Last active February 13, 2021 18:50
Botai API endpoint sample.
// This is POST endpoint in Node.js (Express) server.
app.post(`/botai_end`, async function(request, response) {
// Prepare template response items.
var elements = []
elements[elements.length]={"title": "test 1" ,"image_url":"https://e55321204fac.ngrok.io/s_3.jpg", "subtitle":"test", "default_action": {"type": "web_url","url": `https://botai.me`,"messenger_extensions": "true","webview_height_ratio": "full"},"buttons":[{"type":"web_url","url":"https://botai.me","title":"See More"}]}
elements[elements.length]={"title": "Test 2" ,"image_url":"https://e55321204fac.ngrok.io/s_3.jpg", "subtitle":"test", "default_action": {"type": "web_url","url": `https://botai.me`,"messenger_extensions": "true","webview_height_ratio": "full"},"buttons":[{"type":"web_url","url":"https://botai.me","title":"See More"}]}
elements[elements.length]={"title": "test 3" ,"image_url":"https://e55321204fac.ngrok.io/s_3.jpg", "subtitle":"test", "default_action": {"type": "web_url","url": `https://botai.me`,"messenger_extensions": "t
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Browser Controller</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="controls">
<center>