Handling Input Events

Facebook only

Input events are currently only supported for messenger bots.

Link an input event (e.g. user sends an image) to a block. Use this capability to handle and map an user event to a block.

Navigate to Settings -> Events map section. Map an event to an existing block by selecting from the list as shown below:

The mapping event is available in the block as args property and can be accessed via: args.eventType.property

Below is a list of common properties for an event type:

Type Property Comments
image url url of the image
file url url of the file
location lat, long latitude and longitude of the location

For example, if a subscriber sends an image on a facebook bot, it can set as an image place holder in the following way:

TIP

A mustache template is a string that contains any number of mustache tags. Smartloop adopts this most popular template format to process variables. Tags are indicated by the double mustaches that surround them. Here, in the above example triple parenthesis tells the compiler not to encode the url.

Event types can be combined with JSON API, go-to or script blocks to perform various operations from verifying document to serve location-aware contents to your subscribers.

//script block
exports.handler = (context, done) => {
    console.log(context.args.image.url);
    done();
};
Last Updated: 4/2/2019, 6:47:34 PM