Outgoing Messages

Discover the outgoing messages in nandbox app builder.

Send Message

FieldTypeRequiredDescription
methodStringYes"sendMessage"
chat_idStringYesUnique identifier for the target chat or User_id
textStringYesText to send
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the message.
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= of sent message
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND TEXT MESSAGE
if (incomingMsg.getText().toLowerCase().equals("text")) {
    TextOutMessage outmsg = new TextOutMessage();
    Long reference = getUniqueId();
    outmsg.setChatId(incomingMsg.getChat().getId());
    outmsg.setReference(reference);
    outmsg.setText("Text");
    api.send(outmsg);
}
// SEND MESSAGE WITH INLINE MENU
else if (incomingMsg.getText().toLowerCase().equals("inlinemenu")) {
    TextOutMessage outmsg = new TextOutMessage();
    Long reference = getUniqueId();
    outmsg.setChatId(incomingMsg.getChat().getId());
    outmsg.setReference(reference);
    outmsg.setText("https://edition.cnn.com/");
    outmsg.setWebPagePreview(WEB_PREVIEW_INSTANCE_VIEW);

    outmsg.setEcho(1);
    String menuRef = "MAIN_MENU_001";
    Button oneBtn = createButton("RSS", "oneBtnCBInWebView", 1, "RED", "White", null, null);
    oneBtn.setButtonIcon("ic_mood_bad_24dp");
    oneBtn.setButtonIconBgColor("#FFFF44");
    Button secondBtn = createButton("Calendar", "secondBtn", 1, "RED", "White", null, null);
    secondBtn.setButtonIcon("ic_hourglass_full_24dp");
    secondBtn.setButtonIconBgColor("White");
    Button thirdButton = createButton("Feed", "thirdBtn", 1, "RED", "White", null, null);
    thirdButton.setButtonIcon("ic_credit_card_24dp");
    thirdButton.setButtonIconBgColor("Yellow");
    thirdButton.setButtonURL("https://edition.cnn.com/");

    Row firstRow = new Row();
    firstRow.setRowOrder(1);
    firstRow.setButtons(new Button[] { oneBtn, secondBtn, thirdButton });

    Menu inlineMenu = new Menu();
    inlineMenu.setMenuRef(menuRef);
    inlineMenu.setRows(new Row[] { firstRow });
    outmsg.setMenuRef(menuRef);
    outmsg.setInlineMenu(new Menu[] { inlineMenu });
    api.send(outmsg);
}
// below is an example that sends a button on receiving a message
nCallBack.onReceive = (incomingMsg) => {
  // send a button on receiving a message

  // construct the outgoing message
  let outmsg = new TextOutMessage();
  const reference = Id();
  outmsg.chat_id = incomingMsg.chat.id;
  outmsg.reference = reference;
  outmsg.text = "https://edition.cnn.com/";
  outmsg.web_page_preview = OutMessage.WEB_PREVIEW_INSTANCE_VIEW;
  outmsg.echo = 1;

  let menuRef = MAIN_MENU_001;
  let oneBtn = createButton(
    "",
    "oneBtnCBInWebView",
    1,
    "RED",
    "White",
    null,
    null
  );
  oneBtn.button_icon = "ic_ball_ic_24dp";
  oneBtn.button_icon_bgcolor = "#FFFF44";

  let buttons = [];
  buttons.push(oneBtn);

  // a row is an array of buttons
  let rowOrder = 1;
  let firstRow = new Row(buttons, rowOrder);
  let rows = [];
  rows.push(firstRow);

  // a menu is an array of rows
  let inlineMenu = [];
  let firstInlineMenu = new Menu(rows, menuRef);
  inlineMenu.push(firstInlineMenu);

  // the outgoing message in this case contains an inline menu
  outmsg.menu_ref = menuRef;
  outmsg.inline_menu = inlineMenu;

  // send the outgoing message to the server
  api.send(JSON.stringify(outmsg));
};

// use the following function to create your buttons
let createButton = (
  label,
  callback,
  order,
  bgColor,
  txtColor,
  buttonQuery,
  nextMenuRef
) => {
  let btn = new Button();

  btn.button_label = label;
  btn.button_order = order;
  btn.button_callback = callback;
  btn.button_bgcolor = bgColor;
  btn.button_textcolor = txtColor;
  btn.button_query = buttonQuery;
  btn.next_menu = nextMenuRef;

  return btn;
};
{
    "method": "sendMessage",
    "chat_id": "90089668723575679",
    "reference": 6096600070010,
    "text": "https://edition.cnn.com/",
    "echo": 1,
    "menu_ref": "MAIN_MENU_001",
    "inline_menu": [{
            "menu_ref": "MAIN_MENU_001",
            "rows": [{
                    "row_order": 1,
                    "buttons": [{
                            "button_label": "",
                            "button_order": 1,
                            "button_callback": "oneBtnCBInWebView",
                            "button_bgcolor": "RED",
                            "button_textcolor": "White",
                            "button_query": null,
                            "next_menu": null,
                            "button_icon": "ic_ball_ic_24dp",
                            "button_icon_bgcolor": "#FFFF44"
                        }
                    ]
                }
            ]
        }
    ]
}

Send Photo

Use this method to send photos. On success, the sent message is returned.

📘

Bots can currently send photo files of up to 20 MB in size, this limit may be changed in the future.

FieldTypeRequiredDescription
methodStringYes"sendPhoto"
chat_idStringYesUnique identifier for the target chat or User_id
photoStringYesPhoto to send. Pass a file_id as String to send a photo that exists on the nandbox servers.
captionStringOptional"Photo caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND PHOTO
else if (incomingMsg.getText().toLowerCase().equals("photo")) {
	String uploadedPhotoId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/welcome.jpg");
	PhotoOutMessage photoMsg = new PhotoOutMessage();
	photoMsg.setChatId(incomingMsg.getChat().getId());
	photoMsg.setReference(Utils.getUniqueId());
	if (uploadedPhotoId != null) {
		photoMsg.setPhoto(uploadedPhotoId);
		api.send(photoMsg);
	} else {
		System.out.println("Upload Failed");
	}
}
/* use the MediaTansfer in src/util/MediaTransfer class to upload the photo to the server
 then send it */
MediaTransfer.uploadFile(TOKEN, "./your_photo.jpg", config.UploadServer)
  .then((uploadedPhotoId) => {
    let photoMsg = new PhotoOutMessage();
    photoMsg.chat_id = incomingMsg.chat.id;
    photoMsg.reference = Id();
    photoMsg.photo = uploadedPhotoId;
    photoMsg.caption = "Photo From Bot";
    photoMsg.echo = 1;

    api.send(JSON.stringify(photoMsg));
  })
  .catch((e) => console.log("Upload failed", e));
{
    "method": "sendPhoto",
    "chat_id": "90091903321704167",
    "reference": 36006160866836,
    "photo": "f3b0f1e475e5eebf9c320c1231767f3476210a24c04285132cae083494a65468.jpg",
    "caption": "Photo From Bot",
    "echo": 1
}

Send Video

Use this method to send videos. nandbox clients support mp4 videos (other formats maybe sent as Document). On success, the sent message is returned.

📘

Bots can currently send phot files of up to 50 MB in size, this limit may be changed in the future.

FieldTypeRequiredDescription
methodStringYes"sendVideo"
chat_idStringYesUnique identifier for the target chat or User_id
videoStringYesVideo to send. Pass a file_id as String to send a video that exists on the nandbox servers (recommended), pass an HTTP URL as a String for nandbox to get a video from the Internet.
captionStringOptional"Video caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, ID of the original message
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND VIDEO
else if (incomingMsg.getText().toLowerCase().equals("video")) {
	String uploadedVideoId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/recallTest.mp4");
	VideoOutMessage videoMsg = new VideoOutMessage();
	videoMsg.setChatId(incomingMsg.getChat().getId());
	videoMsg.setReference(Utils.getUniqueId());
	videoMsg.setCaption("Video From Bot");
	if (uploadedVideoId != null) {
		videoMsg.setVideo(uploadedVideoId);
		api.send(videoMsg);
	} else {
		System.out.println("Upload Failed");
	}
}
MediaTransfer.uploadFile(TOKEN, "./your_video.mp4", config.UploadServer)
  .then((uploadedVideoId) => {
    let vidoMsg = new VideoOutMessage();
    vidoMsg.chat_id = incomingMsg.chat.id;
    vidoMsg.reference = Id();
    vidoMsg.video = uploadedVideoId;
    vidoMsg.caption = "Video From Bot";
    vidoMsg.echo = 0;

    api.send(JSON.stringify(vidoMsg));
  })
  .catch((e) => console.log("Upload failed", e));
{
    "method": "sendVideo",
    "chat_id": "90091903321704167",
    "reference": 26646740171012,
    "video": "190717a3076b1eeac6ba555a2924179e9046bf2ceb28389f39d22dc697c54219.mp4",
    "caption": "Video From Bot",
    "echo": 0
}

Send Audio

Use this method to send audio files, if you want nandbox clients to display them in the music player. Your audio must be in the .mp3 format. On success, sent message is returned.

📘

Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

FieldTypeRequiredDescription
methodStringYes"sendAudio"
chat_idStringYesUnique identifier for the target chat or User_id
audioStringYesAudio to send. Pass a file_id as String to send an audio that exists on the nandbox server.
performerStringOptionalAudio file performer
titleStringOptionalAudio file title
captionStringOptional"Audio caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message.
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for this message as defined by bot.
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND AUDIO
else if (incomingMsg.getText().toLowerCase().equals("audio")) {
	String uploadedAudioId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/hello.mp3");
	AudioOutMessage audioMsg = new AudioOutMessage();
	audioMsg.setChatId(incomingMsg.getChat().getId());
	audioMsg.setReference(Utils.getUniqueId());
	audioMsg.setCaption("Audio From Bot");
	if (uploadedAudioId != null) {
		audioMsg.setAudio(uploadedAudioId);
		audioMsg.setTitle("Hello");
		audioMsg.setPerformer("Male");
		api.send(audioMsg);
	} else {
		System.out.println("Upload Failed");
	}
}
MediaTransfer.uploadFile(TOKEN, "./your_audio.mp3", config.UploadServer).then(
  (uploadedAudioId) => {
    let audioOutMsg = new AudioOutMessage();
    audioOutMsg.chat_id = incomingMsg.chat.id;
    audioOutMsg.reference = Id();
    audioOutMsg.audio = uploadedAudioId;
    audioOutMsg.performer = "Perfomer Man";
    audioOutMsg.title = " Song";
    audioOutMsg.caption = "Audio From Bot";

    api.send(JSON.stringify(audioOutMsg));
  }
);
{
    "method": "sendAudio",
    "chat_id": "90089668723575679",
    "reference": 64818504566661,
    "audio": "a2517a187f5c78f3b3b5b6e535e7ab6be54e524e7f94b718b079b82a9c008ee6.mp3",
    "performer": "Perfomer Man",
    "title": " Song",
    "caption": "Audio From Bot"
}

Send Voice

Use this method to send voice note. If you want nandbox clients to display the file as a playable voice message, your voice audio must be in an .ogg file encoded with OPUS (other format may be sent as Audio or Document). On success, the sent message is returned.

📘

Bots can currently send voice note files of up to 50 MB in size, this limit may be changed in the future.

FieldTypeRequiredDescription
methodStringYes"sendVoice"
chat_idStringYesUnique identifier for the target chat or User_id
sizeStringOptionalSize of document
voiceStringYesVoice note to send. Pass a file_id as String to send a voice note that exists on the nandbox servers .
captionStringOptional"Voice note caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
String uploadedVoiceId = MediaTransfer.uploadFile(TOKEN, "< .ogg File Path >");
if (uploadedVoiceId != null) {
  //
  VoiceOutMessage voiceMsg = new VoiceOutMessage();
  voiceMsg.setChatId(incomingMsg.getChat().getId());
  voiceMsg.setReference(getUniqueId());
  voiceMsg.setVoice(uploadedVoiceId);
  voiceMsg.setEcho(0);
  api.send(voiceMsg);
  //
}
if (incomingMsg.isVoiceMsg()) {
  let voiceOutMsg = new VoiceOutMessage();
  voiceOutMsg.chat_id = incomingMsg.chat.id;
  voiceOutMsg.reference = Id();
  voiceOutMsg.voice = incomingMsg.voice.id;
  voiceOutMsg.size = 700;
  voiceOutMsg.caption = "Vocie From Bot";

  api.send(JSON.stringify(voiceOutMsg));
}
{
    "method": "sendVoice",
    "chat_id": "90089668723575679",
    "reference": 95959775121117,
    "voice": "8a94888c62b2f3b632c4bc00da4387b8a465e5ee8d521bf428b49625c0dee3b9.m4a",
    "size": 700,
    "caption": "Vocie From Bot"
}

Send Document

Use this method to send general files. On success, the sent message is returned.

📘

Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

FieldTypeRequiredDescription
methodStringYes"sendDocument"
chat_idStringYesUnique identifier for the target chat or User_id
nameStringOptionalName of document
sizeStringOptionalSize of document
documentStringYesDocument to send. Pass a file_id as String to a file that exists on the nandbox servers (recommended)
captionStringOptional"Photo caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND DOCUMENT

else if (incomingMsg.getText().toLowerCase().equals("document")) {
	api.sendText(incomingMsg.getChat().getId(),"Uploading the document to the server...");
	String uploadedDocumentId = MediaTransfer.uploadFile(TOKEN, System.getProperty("user.dir") + "/src/main/resources/upload/malala.pdf");
	DocumentOutMessage documentMsg = new DocumentOutMessage();
	documentMsg.setChatId(incomingMsg.getChat().getId());
	documentMsg.setReference(Utils.getUniqueId());
	documentMsg.setCaption("Audio From Bot");
	if (uploadedDocumentId != null) {
		documentMsg.setDocument(uploadedDocumentId);
		documentMsg.setName("Malala Book");
		api.send(documentMsg);
	} else {
		System.out.println("Upload Failed");
	}
}
MediaTransfer.uploadFile(
  TOKEN,
  "./your_document.pdf",
  config.UploadServer
).then((uploadedDocumentId) => {
  let documentOutMsg = new DocumentOutMessage();
  documentOutMsg.chat_id = incomingMsg.chat.id;
  documentOutMsg.reference = Id();
  documentOutMsg.document = uploadedDocumentId;
  documentOutMsg.name = "Document renamed inside Bot";
  documentOutMsg.caption = "Document From Bot";

  api.send(JSON.stringify(documentOutMsg));
});
{
    "method": "sendDocument",
    "chat_id": "90091903321704167",
    "reference": 96181774767671,
    "caption": "from all option send",
    "name": null,
    "size": null
}

Send Location

Use this method to send location and point of map. On success, the sent message is returned.

FieldTypeRequiredDescription
methodStringYes"sendLocation"
chat_idStringYesUnique identifier for the target chat or User_id
longitudeStringYeslongitude
latitudeStringYeslatitude
nameStringOptionalLocation name
detailsStringOptionalLocation details
captionStringOptional"Location caption 0-256 characters
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND LOCATION
else if (incomingMsg.getText().toLowerCase().equals("location")) {
	LocationOutMessage locMsg = new LocationOutMessage();
	locMsg.setChatId(incomingMsg.getChat().getId());
	locMsg.setReference(Utils.getUniqueId());
	locMsg.setName("Cairo International Airport");
	locMsg.setDetails("Cairo, Egypt");
	locMsg.setLatitude("30.102366");
	locMsg.setLongitude("31.426319");
	locMsg.setCaption("Cairo Airport Location From Bot");
	api.send(locMsg);
}
let locationOutMsg = new LocationOutMessage();
locationOutMsg.chat_id = incomingMsg.chat.id;
locationOutMsg.reference = Id();
locationOutMsg.name = incomingMsg.location.name;
locationOutMsg.details = incomingMsg.location.details;
locationOutMsg.latitude = incomingMsg.location.latitude;
locationOutMsg.longitude = incomingMsg.location.longitude;
locationOutMsg.caption = "Location From Bot";

api.send(JSON.stringify(locationOutMsg));
{
    "method": "sendLocation",
    "chat_id": "90089668723575679",
    "reference": 80613906787070,
    "latitude": "29.9740559",
    "longitude": "31.482059",
    "caption": "Location From Bot"
}

Send Contact

Use this method to send phone contact. On success, the sent message is returned.

FieldTypeRequiredDescription
methodStringYes"sendContact"
chat_idStringYesUnique identifier for the target chat or User_id
phone_numberStringYesphone number
nameStringYesContact name
disable_web_page_previewBooleanOptionalDisables link previews for links in this message
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
reply_to_message_idStringOptionalIf the message is a reply, unique identification for the original (parent) message.
referenceLongYesUnique local identifier for the target chat/user
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
echoIntegerOptional1= repeat message 0= no echo
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message.
inline_menuArray of MenuOptionalInline menu object to hold menus.If both inline_menu and menu_ref are defined. Priority for inline_menu.
chat_settingsIntegerOptional1= if you want to send to bot chat settings
// SEND CONTACT
else if (incomingMsg.getText().toLowerCase().equals("contact")) {
	ContactOutMessage contactMsg = new ContactOutMessage();
	contactMsg.setChatId(incomingMsg.getChat().getId());
	contactMsg.setReference(Utils.getUniqueId());
	contactMsg.setName("KFC");
	contactMsg.setPhoneNumber("19019");
	api.send(contactMsg);
}
let contactOutMsg = new ContactOutMessage();
contactOutMsg.chat_id = incomingMsg.chat.id;
contactOutMsg.reference = Id;
contactOutMsg.name = "KFC";
contactOutMsg.phoneNumber = "19019";

api.sendContact(
  incomingMsg.chat.id,
  contactOutMsg.phoneNumber,
  contactOutMsg.name
);
{
    "method": "sendContact",
    "chat_id": "90089668723575679",
    "reference": 16350635381030,
    "name": "Youssef Sayed"
}

Update Message

Use this message to update existing message sent. On success, the sent message is returned with status "updated"

FieldTypeRequiredDescription
methodStringYes"updateMessage"
message_idStringYesOld message ID that you want to edit it
referenceLongYesUnique local identifier for the target chat/user
textStringConditionalOnly use if you want to update Message has type of "text"
captionStringConditionalOnly use if you want to update Message has type of other than "text" e.g. photo, video, audio,..etc.
chat_idStringYesUnique identifier for the target chat or User_id
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
menu_refStringOptionalMenu reference for existing predefined Menu. The menu will be displayed as inline menu associated to the message. To hide the inline menu from message set menu_ref to empty String .
inline_menuArray of MenuOptionalInline menu object to hold menus. Previous menu will be dropped and replaced by the updated one.If both inline_menu and menu_ref is defined. Priority for inline_menu unless menu_ref is set to empty String .
UpdateOutMessage updateOutMessage = new UpdateOutMessage();
updateOutMessage.setMessageId("i1_iWBJSzaA129813");
updateOutMessage.setText("new edits");
updateOutMessage.setMenuRef("myMenuRef");
api.send(updateOutMessage);
const newMsg = new UpdateOutMessage();
newMsg.message_id = incomingMsg.message_id;
newMsg.text = "new edits";
newMsg.reference = incomingMsg.reference;
newMsg.to_user_id = incomingMsg.from.id;
newMsg.chat_id = incomingMsg.chat.id;
api.send(JSON.stringify(newMsg));
{
    "method": "updateMessage",
    "message_id": "i1_iWBJSzaA129813",
    "text": "new edits",
    "reference": 2372,
    "to_user_id": "90089668723575679",
    "chat_id": "90089668723575679"
}

Set Chat Menu

Use this message to set normal keypad menus "Chat Menu". This message will overwrite the existing Chat Menus. If bot wants to update specific item in the Chat Menus, bot must send the entire menus again to the target chat. On success, setChatMenu_ack will be returned.

FieldTypeRequiredDescription
methodStringYes"setChatMenu"
menusMenuYesNew or updated Menus
chat_idStringYesUnique identifier for the target chat or User_id
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
 // SEND CHAT MENU
else if (incomingMsg.getText().toLowerCase().equals("chatmenu")) {
    String chatId = incomingMsg.getChat().getId();

    new Utils().setNavigationButton(chatId, "mainMenu", api);

    Button menuBtn1 = createButton("مصراوي", "mainCB", 1, "Gray", "Red", null, null);
    menuBtn1.setButtonIcon("ic_smoke_free_24dp");
    menuBtn1.setButtonIconBgColor("#00FFFF");
    Button menuBtn2 = createButton("Funny", "funnyCB", 1, "Gray", "Red", null, null);
    menuBtn2.setButtonIcon("ic_timeline_24dp");

    Button menuBtn3 = createButton("Option", "optionCB", 1, "Gray", "Red", null, null);
    menuBtn3.setButtonIcon("ic_pregnant_woman_24dp");
    menuBtn3.setButtonIconBgColor("orange");
    SetChatMenuOutMessage outmsg = new SetChatMenuOutMessage();

    Row firstRow = new Row();
    firstRow.setRowOrder(1);
    firstRow.setButtons(new Button[] { menuBtn1, menuBtn2, menuBtn3 });

    Menu chatMenu = new Menu();
    String menuRef = "mainMenu";
    chatMenu.setMenuRef(menuRef);
    chatMenu.setRows(new Row[] { firstRow });

    outmsg.setChatId(incomingMsg.getChat().getId());
    outmsg.setMenus(new Menu[] { chatMenu });

    api.send(outmsg);
}
let outmsg = new SetChatMenuOutMessage();

let chat_id = incomingMsg.chat.id;

Utility.setNavigationButton(chat_id, "mainMenu", api);

let menuBtn1 = createButton(
  "No Smoking",
  "mainCB",
  1,
  "Gray",
  "Red",
  null,
  null
);
menuBtn1.button_icon = "ic_smoke_free_24dp";
menuBtn1.button_icon_bgcolor = "#00FFFF";

let buttons = [];
buttons.push(menuBtn1);

let rowOrder = 1;
let firstRow = new Row(buttons, rowOrder);

let rows = [];
rows.push(firstRow);

let menuRef = "mainMenu";
let chatMenu = new Menu(rows, menuRef);
let menus = [];
menus.push(chatMenu);

outmsg.chat_id = incomingMsg.chat.id;
outmsg.menus = menus;

api.send(JSON.stringify(outmsg));
{
    "method": "setChatMenu",
    "chat_id": "4522291356145774",
    "menus": [{
            "menu_ref": "KEY1",
            "rows": [{
                    "buttons": [{
                            "next_menu": null,
                            "button_span": "1",
                            "button_order": "1",
                            "button_textcolor": "white",
                            "button_callback": "B1",
                            "button_bgcolor": "black",
                            "button_label": "B1",
                            "button_url": "abc",
                            "button_query": "abc"
                        }
                    ],
                    "row_order": "1"
                }
            ]
        }
    ]
}

Inline Search Answer

FieldTypeRequiredDescription
methodStringYes"inlineSearchAnswer"
to_user_idStringYesThe user id you want to sent to him
resultsResultsYesArray of media information
next_offsetStringYesPass the offset that a client should send in the next search with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination
chat_idStringYesChat id
search_idStringYesUnique id of this message

The following data structures represents custom keypad menus with reply options

InlineSearchAnswer inlineSearchAnswer = new InlineSearchAnswer();

inlineSearchAnswer.setChatId(incomingMsg.getChat().getId());
inlineSearchAnswer.setToUserId(incomingMsg.getFrom().getId());
inlineSearchAnswer.setSearchId(1);

Result results = new Result();
results.setId("8b6229eefde75174b6cb5474b38e7f2f55a280a17ccc1f18a3ed6f5416890070.mp4");
results.setCaption("test Video caption");
results.setDescription("Test Video desc");
results.setTitle("Test Video title");

Result results2 = new Result();
results2.setId("d2ba4e79f2e240d145e8be48f1ef98ece2f283193bce80f1b7ddbd0e8daae23a.gif");

results2.setCaption("test GIF caption");
results2.setDescription("Test GIF desc");
results2.setTitle("Test GIF title");

Result results3 = new Result();
results3.setId("4bdb5b65838706092cff9de33694641aa0b7a02899b0884d07df2f58374bf40d.jpg");
results3.setCaption("test Photo caption");
results3.setDescription("Test Photo desc");
results3.setTitle("Test Photo title");
ArrayList<Result> multiResults = new ArrayList<Result>();
multiResults.add(results3);
multiResults.add(results2);
multiResults.add(results);
inlineSearchAnswer.setResults(multiResults);

api.send(inlineSearchAnswer);

let inlineSearchAnswer = new InlineSearchAnswer();
inlineSearchAnswer.chatId = incomingMsg.chat.id;
inlineSearchAnswer.toUserId = incomingMsg.from.id;
inlineSearchAnswer.searchId = 1;

let results = new Result();
results.id = "8b6229eefde75174b6cb5474b38e7f2f55a280a17ccc1f18a3ed6f5416890070.mp4";
results.caption = "test Video caption";
results.description = "Test Video desc";
results.title = "Test Video title";

let results2 = new Result();
results2.id = "d2ba4e79f2e240d145e8be48f1ef98ece2f283193bce80f1b7ddbd0e8daae23a.gif";
results2.caption = "test GIF caption";
results2.description = "Test GIF desc";
results2.title = "Test GIF title";

let results3 = new Result();
results3.id = "4bdb5b65838706092cff9de33694641aa0b7a02899b0884d07df2f58374bf40d.jpg";
results3.caption = "test Photo caption";
results3.description = "Test Photo desc";
results3.title = "Test Photo title";

let multiResults = [];
multiResults.push(results3);
multiResults.push(results2);
multiResults.push(results);
inlineSearchAnswer.results(multiResults);

api.send(inlineSearchAnswer);
	
{
    "method": "inlineSearchAnswer",
    "results": [{
            "title": "any catchy title",
            "caption": "any valid caption",
            "height": 10,
            "width": 40,
            "description": "a descriptive decription"
        }
    ],
    "next_offset": "",
    "chat": {
        "id": "90089668723575679",
        "type": "Mobile"
    },
    "to_user_id": "90089668723575679",
    "search_id": 1589060
}

Set Navigation Button

Use this method to set the navigation button with the menu reference. When navigation button is pressed the referenced menu will be displayed as normal keypad menu "Chat Menu".

FieldTypeRequiredDescription
methodStringYes"setNavigationButton"
navigation_buttonsmenu_refStringArray of ButtonYesArray of Button.Menu unique identifier that reference the next menu to navigate to it when the navigation button pressed.
chat_idStringYesUnique identifier for the target chat or User_id
to_user_idStringOptionalif reply or send message to target user within a group chat or channel, unique identifier of the target user.
String chatId = incomingMsg.getChat().getId();
Utils.setNavigationButton(chatId, "mainMenu", api);

public static void setNavigationButton(String chatId, String nextMenu, Api api) {
	Button navigationButton = new Button();
	navigationButton.setNextMenu(nextMenu);
	SetNavigationButtonOutMessage navMsg = new SetNavigationButtonOutMessage();
	navMsg.setChatId(chatId);
	navMsg.setNavigationButtons(new Button[] { navigationButton });
	api.send(navMsg);
}
 static setNavigationButton(chatId, nextMenu, api){
        let fb = new Button();
        fb.next_menu = nextMenu;
        let navMsg = new SetNavigationButtonOutMessage();
        navMsg.chat_id = chatId;
        navMsg.navigation_buttons = []
        navMsg.navigation_buttons.push(fb);

        api.send(JSON.stringify(navMsg));
}
{
    "navigation_buttons": [{
            "next_menu": "MainMenu"
        }
    ],
    "method": "setNavigationButton",
    "chat_id": "900812584759703670"
}

Get User

Use this method to get Group or Channel information. On success, Chat is returned.

FieldTypeRequiredDescription
methodStringYes"getChat"
chat_idStringYesUnique identifier for Group or Channel.
// The object will be received in the onReceive callback.

else if(text.equals("getUser")){
	api.getUser(incomingMsg.getFrom().getId());

}
api.getUser(user.id);
{
    "method": "getUser",
    "user_id": "4521191845180798"
}

Use this method to get profile for a user. On success, User is returned.

FieldTypeRequiredDescription
methodStringYes"getUser"
user_idStringYesUnique identifier for this user or bot.

Get Chat

Use this method to get Chat Member user public profile. On success, ChatMember is returned.

FieldTypeRequiredDescription
methodStringYes"getChatMember"
chat_idStringYesUnique identifier for Group or Channel where member belongs to.
user_idStringYesUnique identifier for this user member.
// The object will be received in the onReceive callback.

else if(text.equals("getChat")){
	api.getChat(incomingMsg.getChat().getId());
}
api.getChat(chat.id);
{
    "method": "getChat",
    "chat_id": "4522291356145774"
}

Get Chat Member

api.getChatMember(incomingMsg.getChat().getId(), incomingMsg.getFrom().getId());
api.getChatMember(chat.id, user.id);
{
    "method": "getChatMember",
    "chat_id": "4522291356145774",
    "user_id": "4521191845180798"
}

Get Chat Administrators

Use this method to get Chat Administrators. On success, ChatAdministrators message will received .

FieldTypeRequiredDescription
methodStringYes"getChatAdministrators"
chat_idStringYesUnique identifier for Group or Channel.
api.getChatAdministrators(incomingMsg.getChat().getId());
api.getChatAdministrators(chat.id);
{
    "method": "getChatAdministrators",
    "chat_id": "4522291356145774"
}

Ban Chat Member

Use this method to ban a Chat Member from accessing Chat. On success, ChatMember is returned with status "banned". Ban is a black list, user will not be able to join Chat again.

FieldTypeRequiredDescription
methodStringYes"banChatMember"
chat_idStringYesUnique identifier for Group or Channel where member belongs to.
user_idStringYesUnique identifier for this user member.
String chatId = "4522291356145774";
String userId = "90089584758972053";
api.banChatMember(chatId, userId);
let chatId = "4522291356145774";
let userId = "90089584758972053";
api.banChatMember(chatId, userId);
{
    "method": "banChatMember",
    "chat_id": "4522291356145774",
    "user_id": "90089584758972053"
}

Unban Chat Member

Use this method to unban a Chat Member from accessing Chat. On success, ChatMember is returned with status "Active". unBan is remove from black list, user will be able to join Chat once again.

FieldTypeRequiredDescription
methodStringYes"unbanChatMember"
chat_idStringYesUnique identifier for Group or Channel where member used to belong to.
user_idStringYesUnique identifier for the banned user.
String chatId = "4522291356145774";
String userId = "90089584758972053";
api.unbanChatMember(chatId, userId);
let chatId = "4522291356145774";
let userId = "90089584758972053";
api.unbanChatMember(chatId, userId);
{
    "method": "unbanChatMember",
    "chat_id": "4522291356145774",
    "user_id": "90089584758972053"
}

Remove Chat Member

Use this method to remove a Chat Member from Chat. On success, ChatMember is returned with status "removed". Remove user is a temprorary kicking the user out from the Group or Channel. User will be able to join Chat once again.

FieldTypeRequiredDescription
methodStringYes"removeChatMember"
chat_idStringYesUnique identifier for Group or Channel where member used to belong to.
user_idStringYesUnique identifier for the banned user.
String chatId = "4522291356145774";
String userId = "90089584758972053";
api.removeChatMember(chatId, userId);
let chatId = "4522291356145774";
let userId = "90089584758972053";
api.removeChatMember(chatId, userId);
{
    "method": "removeChatMember",
    "chat_id": "4522291356145774",
    "user_id": "90089584758972053"
}

Set Chat

Use this method to set Chat Group or Channel information. On success, chat is returned.

FieldTypeRequiredDescription
methodStringYes"setChat"
chatChatYesUnique identifier for Group or Channel.
Chat chat = new Chat();
chat.setTitle("NEW TITLE");
chat.setId("4522291356145774");
api.setChat(chat);
let chat = new Chat();
chat.title = "NEW TITLE";
chat.id = "4522291356145774";
api.setChat(chat);
{
    "method": "setChat",
    "chat": {
        "id": "4522291356145774",
        "name": "CHANGE 3",
        "photo": {
            "id": "8d7773be38db78.jpg"
        }
    }
}

Add Blacklist

Use this method to add black list.

FieldTypeRequiredDescription
methodStringYes"addBlacklist"
chatChatYesUnique identifier for Group or Channel.
usersArray of StringYesAdd list of users (mobile or Email) to black list
ArrayList<String> users = new ArrayList<>();
users.add("16136147500");
users.add("[email protected]");
api.addBlackList(incomingMsg.getChat().getId(), users);


public void addBlackList(String chatId, List<String> users) {
	AddBlackListOutMessage addBlackListOutMessage = new AddBlackListOutMessage();
	addBlackListOutMessage.setChatId(chatId);
	addBlackListOutMessage.setUsers(users);
	api.send(addBlackListOutMessage);
}

AddBlackListOutMessage addBlackListOutMessage = new AddBlackListOutMessage();
addBlackListOutMessage.setChatId(chatId);
addBlackListOutMessage.setUsers(users);
api.send(addBlackListOutMessage);
let users = [];

users.push("16136147500");
users.push("[email protected]");

api.addBlackList(incomingMsg.chat.id, users);
{
    "method": "addBlacklist",
    "users": ["16136147500", "[email protected]"],
    "chat_id": "90090684293612221"
}

Add Whitelist

Use this method to add white list.

FieldTypeRequiredDescription
methodStringYes"addWhitelist"
chatChatYesUnique identifier for Group or Channel.
usersArray of UsersWhiteListUserYesAdd Array of Users
ArrayList<String> tagsList = new ArrayList<>();
tagsList.add("1");
tagsList.add("2");
ArrayList<WhiteListUser> whiteListUsersArray = new ArrayList<>();
WhiteListUser whiteListUser = new WhiteListUser();
whiteListUser.setSignupUser("16136147500");
whiteListUser.setTags(tagsList);
whiteListUsersArray.add(whiteListUser);
api.addWhiteList(incomingMsg.getChat().getId(), whiteListUsersArray);

public void addWhiteList(String chatId, List<WhiteListUser> whiteListUsers) {
	AddWhiteListOutMessage addWhiteistOutMessage = new AddWhiteListOutMessage();
	addWhiteistOutMessage.setChatId(chatId);
	addWhiteistOutMessage.setWhiteListUser(whiteListUsers);
	api.send(addWhiteistOutMessage);
}
let tagsList = [];
tagsList.push("1");
tagsList.push("2");

let whiteListUsersArray = [];
let whiteListUser = new WhiteListUser();
whiteListUser.signup_user = "16136147500";
whiteListUser.tags = tagsList;

whiteListUsersArray.push(WhiteListUser);

api.addWhiteList(incomingMsg.chat.id, whiteListUsersArray);
{
    "method": "addWhitelist",
    "users": [{
            "signup_user": "16136147500",
            "tags": ["1", "2"]
        }
    ],

    "chat_id": "90090684293612221"
}

Add Blacklist Patterns

Use this method to add black list patterns:

FieldTypeRequiredDescription
methodStringYes"addBlacklistPatterns"
chatChatYesUnique identifier for Group or Channel.
dataArray of DataYesAdd Array of Data
ArrayList<Data> dataList = new ArrayList<>();
Data data = new Data();
data.setPattern("44444*");
data.setExample("44444444");
dataList.add(data);
Data data2 = new Data();
data2.setPattern("222*");
data2.setExample("222222222");
dataList.add(data2);
api.addBlacklistPatterns(incomingMsg.getChat().getId(), dataList);

public void addBlacklistPatterns(String chatId, List<Data> data) {
	AddBlacklistPatternsOutMessage addBlacklistPatternsOutMessage = new AddBlacklistPatternsOutMessage();
	addBlacklistPatternsOutMessage.setChatId(chatId);
	addBlacklistPatternsOutMessage.setData(data);
	api.send(addBlacklistPatternsOutMessage);
}
let dataList = [];

let data = new Data();
data.pattern = "44444*";
data.example = "44444444";

dataList.push(data);

let data2 = new Data();
data2.pattern = "222*";
data2.example = "222222222";

dataList.push(data2);

api.addBlackListPatterns(chat.id, dataList);
{
    "method": "addBlacklistPatterns",
    "data": [{
            "pattern": "44444*",
            "example": "44444444"
        }, {
            "pattern": "222*",
            "example": "222222222"
        }
    ],
    "chat_id": "90090684293612221"
}

Add Whitelist Patterns

Use this method to add white list patterns:

FieldTypeRequiredDescription
methodStringYes"addWhitelistPatterns"
chatChatYesUnique identifier for Group or Channel.
dataArray of DataYesAdd Array of Data
ArrayList<Data> dataList = new ArrayList<>();
Data data = new Data();
data.setPattern("4444*");
data.setExample("444444");
dataList.add(data);
api.addWhitelistPatterns(incomingMsg.getChat().getId(), dataList);


public void addWhitelistPatterns(String chatId, List<Data> data) {
	AddWhitelistPatternsOutMessage addWhitelistPatternsOutMessage = new AddWhitelistPatternsOutMessage();
	addWhitelistPatternsOutMessage.setChatId(chatId);
	addWhitelistPatternsOutMessage.setData(data);
	api.send(addWhitelistPatternsOutMessage);
}
let dataList = [];

let data = new Data();
data.pattern = "4444*";
data.example = "444444";

dataList.push(data);

api.addWhitelistPatterns(incomingMsg.chat.id, dataList);
{
    "method": "addWhitelistPatterns",
    "data": [{
            "pattern": "44444*",
            "example": "44444444"
        }
    ],
    "chat_id": "90090684293612221"
}

Delete Blacklist

FieldTypeRequiredDescription
methodStringYes"deleteBlacklist"
chatChatYesUnique identifier for Group or Channel.
usersArray of StringYesAdd list of users (mobile or Email) to black list
ArrayList<String> users = new ArrayList<>();
users.add("111133");
api.deleteBlackList(incomingMsg.getChat().getId(), users);

public void deleteBlackList(String chatId, List<String> users) {
	DeleteBlackListOutMessage deleteBlackListOutMessage = new DeleteBlackListOutMessage();
	deleteBlackListOutMessage.setChatId(chatId);
	deleteBlackListOutMessage.setUsers(users);
	api.send(deleteBlackListOutMessage);
}
let users = [];
users.push("111133");

api.deleteBlackList(incomingMsg.chat.id, users);
{
    "method": "deleteBlacklist",
    "users": ["111133"],
    "chat_id": "90090684293612221"
}

Use this method to delete black list:

Delete Whitelist

Use this method to delete white list:

FieldTypeRequiredDescription
methodStringYes"deleteWhitelist"
chatChatYesUnique identifier for Group or Channel.
usersArray of StringYesAdd list of users (mobile or Email) to black list
ArrayList<String> users = new ArrayList<>();
users.add("111133");
api.deleteWhiteList(incomingMsg.getChat().getId(), users);

public void deleteWhiteList(String chatId, List<String> users) {
	DeleteWhiteListOutMessage deleteWhiteListOutMessage = new DeleteWhiteListOutMessage();
	deleteWhiteListOutMessage.setChatId(chatId);
	deleteWhiteListOutMessage.setUsers(users);
	api.send(deleteWhiteListOutMessage);
}
let users = [];
users.push("111133");

api.deleteWhiteList(incomingMsg.getChat().getId(), users);
{
    "method": "deleteWhitelist",
    "users": ["111133"],
    "chat_id": "90090684293612221"
}

Delete Blacklist Pattern

Use this method to delete black list pattern:

FieldTypeRequiredDescription
methodStringYes"deleteBlacklistPatterns"
chatChatYesUnique identifier for Group or Channel.
patternArray of StringYesAdd list of pattern
ArrayList<String> pattern = new ArrayList<>();
pattern.add("222*");
api.deleteBlackListPatterns(incomingMsg.getChat().getId(), pattern);

public void deleteBlackListPatterns(String chatId, List<String> pattern) {
	DeleteBlackListPatternsOutMessage deleteBlackListPatterns = new DeleteBlackListPatternsOutMessage();
	deleteBlackListPatterns.setChatId(chatId);
	deleteBlackListPatterns.setPattern(pattern);
	api.send(deleteBlackListPatterns);
}
let pattern = [];
pattern.push("222*");
api.deleteBlackListPatterns(incomingMsg.chat.id, pattern);
{
    "method": "deleteBlacklistPatterns",
    "pattern": ["222*"],
    "chat_id": "90090684293612221"
}

Delete Whitelist Pattern

Use this method to delete white list pattern:

FieldTypeRequiredDescription
methodStringYes"deleteWhitelistPatterns"
chatChatYesUnique identifier for Group or Channel.
patternArray of StringYesAdd list of pattern
ArrayList<String> pattern = new ArrayList<>();
pattern.add("5555*");
api.deleteWhiteListPatterns(incomingMsg.getChat().getId(), pattern);

public void deleteWhiteListPatterns(String chatId, List<String> pattern) {
	DeleteWhiteListPatternsOutMessage deleteWhiteListPatterns = new DeleteWhiteListPatternsOutMessage();
	deleteWhiteListPatterns.setChatId(chatId);
	deleteWhiteListPatterns.setPattern(pattern);
	api.send(deleteWhiteListPatterns);
}
let pattern = [];
pattern.push("5555*");
api.deleteWhiteListPatterns(incomingMsg.chat.id, pattern);
{
    "method": "deleteWhitelistPatterns",
    "pattern": ["5555*"],
    "chat_id": "90090684293612221"
}

Recall Message

Use this message to recall existing Message sent .

FieldTypeRequiredDescription
methodStringYes"recallMessage"
chat_idStringYesUnique identifier of chat id
message_idStringYesGlobal Unique identifier for message requested to be recalled.
referenceLongYesUnique local identifier for the target chat/user
from_user_idStringOptionalOriginal sender id Mandatory in case the bot is the admin of the Chat
else if(text.equals("recallMessage")){
	RecallOutMessage outmsg = new RecallOutMessage();
	outmsg.setMessageId("<message_id>");
	outmsg.setChatId("<chat_id>");
	outmsg.setReference(Utils.getUniqueId());
	// make sure to replace message id and chat id with real values
    api.send(outmsg);
}
let recallOutMessage = new RecallOutMessage();
recallOutMessage.chatId = "90090684265384780";
recallOutMessage.messageId = "d1_CIRKHD6C12617260";
recallOutMessage.reference = 6915;
recallOutMessage.setFromUserId = "90089584801498185";
{
    "method": "recallMessage",
    "chat_id": "4522291356145774",
    "message_id": "d2_F4k48l1t12617132"
}

Get Blacklist

Use this method to get black list. On success, blacklist is returned.

FieldTypeRequiredDescription
methodStringYes"getBlacklist"
chat_idStringYesUnique identifier for Group or Channel where member belongs to.
page_sizeString
api.getBlackList(incomingMsg.getChat().getId());

public void getBlackList(String chatId) {
	GetBlackListOutMessage getBlackListOutMessage = new GetBlackListOutMessage();
	getBlackListOutMessage.setChatId(chatId);
	api.send(getBlackListOutMessage);
}
api.getBlackList(incomingMsg.chat.id);
{
    "method": "getBlacklist",
    "chat_id": "90090684293612221"
}

Get Whitelist

Use this method to get white list. On success, whitelist is returned.

FieldTypeRequiredDescription
methodStringYes"getWhitelist"
chat_idStringYesUnique identifier for Group or Channel where member belongs to.
page_sizeString
api.getWhiteList(incomingMsg.getChat().getId());

public void getWhiteList(String chatId) {
	GetWhiteListOutMessage getWhiteListOutMessage = new GetWhiteListOutMessage();
	getWhiteListOutMessage.setChatId(chatId);
	api.send(getWhiteListOutMessage);
}
api.getWhiteList(chat.id);
{
    "method": "getWhitelist",
    "chat_id": "90090684293612221"
}

Set My Profile

Use this method to set Bot Profile. On success, myProfile is returned.

FieldTypeRequiredDescription
methodStringYes"setMyProfile"
userUserYesBot profile user object
page_sizeString
else if(text.equals("setMyProfile")){
	JSONObject obj = new JSONObject();
	obj.put("name", "updated Bot Name");
	api.setMyProifle(new User(obj));
}
let user = new User();
user.profile = "other";
user.status = "I am set My profile Bot 2 ";
let photo = new Photo();
photo.id = "e801b7277dbd921376f26b13aeadf0ee4b49950a66641f2761863a823e035845.jpg";

api.setMyProifle(user);
{
    "method": "setMyProfile",
    "user": {
        "profile": "Other",
        "status": "OTHER PROFILE",
        "photo": {
            "id": "95d4438d7773be38db78.jpg"
        }
    }
}

Get My Profiles

Use this method to get Bot Profile. On success, myProfile is returned.

FieldTypeRequiredDescription
methodStringYes"getMyProfiles"
// The object will be received in the onReceive callback.

else if(text.equals("getMyProfile")){
	api.getMyProfiles();
}
api.getMyProfiles();
{
    "method": "getMyProfiles"
}

Set Workflow

Use this method to set workflow cells' properties. On success, an array of workflow cells will be returned.

FieldTypeRequiredDescription
methodStringYes"setWorkflow"
user_idStringYesUnique identifier for the target user.
screen_idStringYesUnique identifier for the target screen. The screen must be one of the existing predefined screens created within your App using nandbox App Builder’s workflow.
workflow_cellArray of Workflow CellYesArray of target cells within the target screen. The cell properties will be set within the target cell.
referenceLongYesUnique local identifier for the message.
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.