Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
TamTam Echo Bot
node v10.24.1
version:
1.0.0
endpoint
share
tweet
Provide bot access token to your enviroment variables as TAMTAM_API_TOKEN or insert it to the code
require('axios'); const { createAPI } = require('tamtam-bot-api'); const api = createAPI(/* TAMTAM_API_TOKEN */); let MARKER = 0; async function startPolling() { const { updates, marker } = await api.getUpdates({ marker: MARKER }); MARKER = marker || MARKER; updates.map(update => { if (update.update_type === 'message_created') { const { body, sender } = update.message; return api.sendMessage({ text: body.text }, { user_id: sender.user_id }); } }); await startPolling(); } startPolling();
Loading…
no comments
sign in
to comment