Developer Features


The plugin allows you to create server-side integrations or define your conversation logic based on dynamic content. You can make the following HTTP requests:

  • GET
  • POST
  • PUT

In addition, you can pass query string parameters, POST body, and headers to address a various type of custom implementation. It is possible to use user variables as parameters using the double braces syntax to pass user input and NLP response. Here is an example of how to use JSON API in order to pull data from a third-party API:

The response is saved in variable. This can be used inside the text element to print out the result in the following way:

JSON API allows you to implement the following use-cases:

  1. Retrieve dynamic content.
  2. Create server-side integrations, where it will send data to an endpoint whenever a conversation reaches a certain point.
  3. Trigger an event.

Script Block

Script Block allows you to quickly write custom logic inside the conversation builder. Click on script button in the toolbar as shown below to insert a script block:

The entire conversation context is available in the script block. This will let you write custom logic based on user input, entities and variables. The example below shows how to pull data from a weather API and then set it as a context variable for use in the builder:

//script block
import request from 'request';

// get a free API key from
const appId = 'PASTE_YOUR_API_KEY';

exports.handler = (context, done) => {
        url : '',
        qs : {
            lat : context.nlp.entities.location[0].lat,
            lon : context.nlp.entities.location[0].lng,
            appid: appId,
            units: 'imperial'
        json : true
    }, (err, reponse, body)=>{
        if (err){
        // save 
        context.vars.set("weatherData", body);

context parameter have the following properties:

Property Name Description
args [User input]
nlp Contains entities and intents for an expression.
vars Set or get vars to use in the current context.

The args object contains the following properties:

Property Name Description Type
sender Unique sender ID String
text Input text.(e.g. Where is San Francisco?) String
event Event to trigger an intent. Either text or event is required. Object

event contains the name of the event that is triggered for a user action:

Property Name Description Type
name Name of the event (e.g. start) that corresponds to an intent name String

You can use variables inside the builder in the following way using the double braces syntax:

You can also output in script block using the extension module in the following way:

import Ext from "recime-bot-extension";
const __ = Ext.default;

exports.handler = (context, done) => {
    done(__.text("Hello world"));

Script block can be useful in the following scnearios:

  • Retrieving data from your existing API that you want inject in your conversation context.
  • Construct dynamic response based on user input and entities.

The following modules are allowed inside Script Block:

Capturing User Location

In order to offer location-aware content, promotions to your users, your bot can capture location as user input.

In order to capture a user location, create a "location" block. Location is sent as an user input and can be accessed as a variable in the following way:

args.location contains the following properties:

Name Description
lat latitude
long longitude

You can use this variable in JSON API plugin as POST or query string parameter to offer specific content from your database or capture location as part of qualifying a user.

How to send a location to the bot?

A user can send location in the following way for messenger platform:

How can I send my current location in Messenger

In Viber, it is available as a toolbar button, clicking on it will bring up the map to pin your location:

In Telegram, tap on the attachment button and choose Location:

Last Updated: 11/3/2018, 1:52:37 PM