Different objects sent to the bot

Every time a message is sent from the user to the bot, these objects are sent in the JSON format to the event parameter of handler methods inside the IDE Bot Builder.

Object NameSample ValueDescriptionRemarks
contextobj {"botname":"demobot",
"channeltype":"twitter",
"contextid":"john",
"contexttype":"p2p"}
JSON object defining various parameters and ways of conversation.channeltype - the messaging channel name from where the user interacts with the bot.
contextid / channelid - The user id of a user on the particular messaging channel.
contexttype - The type of conversation.
senderobj{"channelid":"john",
"channeltype":"twitter",
"display":"John Doe"}
JSON object identifying the user details. This is useful in the case of a group on a messaging channel.
messageobj{"text":"Hi",
"type":"msg"}
JSON object for messages from the user.
channeltwitterThe channel from where the user is interacting with the bot.
botnamedemobotThe name of the bot.
sender195173This is the user id of the user on the messaging channel who has started the conversation with the bot.
messageHiThe message sent by the user to the bot.

These are the properties to access the objects in the IDE Bot Builder.

Property NameDescription
event.messageReturns the message from the user to the bot. This can be text or image URL or location URL etc.
event.senderReturns the user id of the user from the messaging channel.
event.channelReturns the messaging channel name from where the user is conversing with the bot.
event.botnameReturns the name of the bot.
event.senderobj.channelidReturns the user id of the user from the messaging channel.
event.senderobj.channeltypeReturns the messaging channel name from where the user is conversing with the bot.
event.senderobj.displayReturns the display name of the user on a messaging channel from where he/she is conversing with the bot
event.messageobj.textReturns the message from the user to the bot. This can be text or image URL or location URL etc.
event.messageobj.typeReturns the message type from the user. It can be msg or image or location etc.
event.messageobj.latitudeReturns the latitude of the location sent by the user to the bot.
event.messageobj.longitudeReturns the longitude of the location sent by the user to the bot.
event.messageobj.addressReturns the address of the location sent by the user to the bot.
event.messageobj.urlReturns the image URL of the image sent by the user to the bot.
event.contextobj.botnameReturns the name of the bot.
event.contextobj.channeltypeReturns the messaging channel name from where the user is conversing with the bot.
event.contextobj.contextidReturns the user id of the user from the messaging channel.
event.contextobj.contexttypeReturns the type of conversation.
event.getrespReturns the response of an HTTP/HTTPs call into the HttpResponseHandler function.
event.dbvalReturns the response of the database call into the DbGetHandler or DbPutHandler function.
event.paramsReturns the URL parameters sent to the bot through an HTTP call to the bot. For example - if one of the parameters is "message" then to access it use 'event.params.message' in the HttpEndpointHandler function.

Sample JSON for text message

{
  "botname": "demobot",
  "contextobj": {
    "botname": "demobot",
    "channeltype": "fb",
    "contextid": "1951021",
    "contexttype": "p2p"
  },
  "messageobj": {
    "text": "Hi",
    "type": "msg"
  },
  "senderobj": {
    "channelid": "1951021",
    "channeltype": "fb",
    "display": "John"
  },
  "channel": "fb",
  "sender": "1951021",
  "message": "Hi"
}

Sample JSON for location from the user

{
  "botname": "demobot",
  "contextobj": {
    "botname": "demobot",
    "channeltype": "telegram",
    "contextid": "195173611",
    "contexttype": "p2p"
  },
  "messageobj": {
    "address": "",
    "latitude": "19.145313",
    "longitude": "72.855748",
    "text": "https://www.google.com/maps/?q=19.145313,72.855748",
    "type": "location"
  },
  "senderobj": {
    "channelid": "195173611",
    "channeltype": "telegram",
    "display": "Shreyans"
  },
  "channel": "telegram",
  "sender": "195173611",
  "message": "https://www.google.com/maps/?q=19.145313,72.855748"
}

Sample JSON for image from the user

{
  "botname": "rildemo",
  "contextobj": {
    "botname": "demobot2",
    "channeltype": "telegram",
    "contextid": "195173611",
    "contexttype": "p2p"
  },
  "messageobj": {
    "imgData": "{\"botname\":\"rildemo\",\"contextObj\":{\"botname\":\"demobot2\",\"channeltype\":\"telegram\",\"contextid\":\"195173611\",\"contexttype\":\"p2p\"},\"url\":\"https://api.telegram.org/file/bot183230543:AAHr9nQwmXVsGZzS8zk6gd-bd0pBC_kl5N4/photo/file_119.jpg\"}",
    "text": "https://api.telegram.org/file/bot183230543:AAHr9nQwmXVsGZzS8zk6gd-bd0pBC_kl5N4/photo/file_119.jpg",
    "type": "image",
    "url": "https://api.telegram.org/file/bot183230543:AAHr9nQwmXVsGZzS8zk6gd-bd0pBC_kl5N4/photo/file_119.jpg"
  },
  "senderobj": {
    "channelid": "195173611",
    "channeltype": "telegram",
    "display": "Shreyans"
  },
  "channel": "telegram",
  "sender": "195173611",
  "message": "https://api.telegram.org/file/bot183230543:AAHr9nQwmXVsGZzS8zk6gd-bd0pBC_kl5N4/photo/file_119.jpg"
}