How to add buttons to KIK bot to capture user input? - kik

So, I have a KiK bot and want to add buttons to the bottom of the chat window to ask specific questions. The user clicks on one, which is taken as there response and processed as a message. The buttons then change again based on this response.
I've seen it in a lot of other KIK apps, but there's nothing in the KiK API that says how to do it!
Does anyone know how to create these response buttons in KIK? :)

What you're looking for are keyboards (specifically the Suggested Response Keyboard), you can read up on how to use them here: https://dev.kik.com/#/docs/messaging#keyboards

Adding my solution as it may help to someone:
function sendButtons() {
var arrResponse = [{ type: "text", body: "Summer" }, { type: "text", body: "Rainy" }, { type: "text", body: "Winter" }];
var sendingMessage = Bot.Message.text("Which Season do u like the most?")
bot.send(sendingMessage.addResponseKeyboard(arrResponse), recipient);
}
As you can see, you need to create an array of the input to show the user on keyboard.
And then attach this response array to the message.

Related

get started button for fb messenger in dialog flow

I need some help regarding chatbot development. right now i am doing a project wherein im creating a chatbot using dialogflow and im testing it in FB messenger. one of the modules that i need to accomplish is to put a "get started" button to start a chat and a persistent menu in FB messenger. i've tried to search on how to do it but there's no specific tutorial on how to implement it in dialogflow. i never tried any code so far 'coz i don't know where should i put it. i hope someone out there will help me regarding this matter. thank you so much!
You can do these using Postman (free) but first you should have an Access Token
To get your page Access Token:
Head over to your Facebook App that you created for the bot on Facebook Developers
Go to Messenger --> Settings
Access Token Section
Generate an Access Token for your page
GET STARTED BUTTON
After you get your Access Token Go to Postman
Send a POST Request to: https://graph.facebook.com/v2.6/me/thread_settings?access_token=xxxxx
Replace xxxxx with your Access Token previously fetched
Go to Body and insert the following JSON
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"YOU PUT OPTIONAL PAYLOAD HERE"
}
]
}
PERSISTENT MENU
Send a POST Request to: https://graph.facebook.com/v2.6/me/messenger_profile?access_token=xxxxx
Replace xxxxx with your Access Token previously fetched
Go to Body and insert the following JSON (you can edit as you wish)
{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled":false,
"call_to_actions":[
{
"title":"Title 1",
"type":"postback",
"payload":"payload1"
},
{
"title":"Title 2",
"type":"postback",
"payload":"payload 2"
},
{
"title":"Title 3",
"type":"postback",
"payload":"payload 3"
}
]
}
]
}

Discord.js bot Custom presence with image

Currently trying to use setPresence for my bot, and I can get the name but no extra details for the 2nd line and no images.
bot.user.setPresence({
game: {
name: "Ready to brawl!",
application_id: 'the id',
details: "These sharks are ready for a fight.",
type: 0
},
assets: {
large_image: "large",
large_text: "Do not jump into that tank...",
small_image: "small",
small_text: "c!help"
},
status: "dnd"
});
So what shows up is:
My bot is on DND, shows "Playing Ready to brawl!", but nothing else. The details part doesn't show up and there's no large or small image.
I've used a custom presence application before so I assumed you needed your own discord application on the developers site, so I made one. I have the name of it the exact same as the "name: '.' " part and I have the id in the application id part. (I'm not sure if it's bad to share the ID so I excluded it.)
Before I tried using large_image and small_image as pure inputs and gave them links, but neither that nor this application one worked.
So if I'm seriously fucking something up here, help would be appreciated
It's normal, you can't use Rich Presence with a bot actually. Maybe someday Discord will allowed this.

Mention in embed

Is it possible to mention someone in an embed so that they receive a notification?
When I try this code:
message.channel.send({ embed: { fields: [
{
name: "test",
value: args[0]
}
]}});
with args[0] being a mention, the mention in the embed is well displayed (clickable, ...) but the user mentioned doesn't get pinged.
If I ping myself using the command (and mentioning myself in the argument) I'm not pinged and the message isn't displayed as usual when being mentioned (yellow background, ...) but I get my profile info if I click on the #... in the message.
Sadly you can't make a mention notify the mentioned user by using an Embed, a possible workaround is by having the mention in the message content, instead of the embed. For example:
message.channel.send(args[0], { embed: { fields: [
{
name: "test",
value: args[0]
}
]}});
This is a limitation of the Discord API itself.

How to send multiple documents for signature DocuSign for Salesforce

Please can someone assist me. I am new to DocuSign. I have a project I am working on whereby the customer wants to be able to send multiple documents to a recipient for signature. From the standard DocuSign set up, you can add documents upon envelope creation but I am looking for a way to automate this. For instance I created a custom button that automatically sends the envelope to a recepient. But it seems I can only add one document template there. Could someone please advise me on what to actually do or where to look because I cant seem to find anything. I see some recipies on the DocuSign help but they are in python etc and I want instruction on Salesforce.
POST
https://demo.docusign.net/restapi/v2/accounts/[accountId]/envelopes
In your create envelope body, you can specify multiple documents like:
emailSubject: "subject",
recipients: {
signers: [{
recipientId: 1,
email: "signer#email.com",
name: "Signers name"
}]},
documents: [{
documentId: 1,
filePath: 'your/path/here/1',
},
{
documentId: 2,
filePath: 'your/path/here/2',
}],

Get user cover picture by Id

I'm working on a web application which is mostly based of Facebook
Graph API. I hold some user's data - actually , the possible
public data available - such as profile picture, name and id. I
wondered how I'll be able to get a direct link to a user cover picture
of a user only by using his id? and I already got the User ID.
This is the code that I used to get the profile picture & it worked-
<img src="https://graph.facebook.com/{{user.id}}/picture?type=large" style="float:left;"/>
Now I want to get cover picture.
Thanks in advance.
To get the cover picture of a user, make this call-
\GET http://graph.facebook.com/{user-id}?fields=cover
You'll get the image url in source key of the JSON response:
{
cover: {
id: "111222333",
offset_y: 55,
source: "https://scontent-a.xx.fbcdn.net/.....jpg" // that's the cover photo url
},
id: "111222"
}

Resources