From reading the Telegram Bot API i understand it is only possible to either have a ForceReply or Custom Keyboard. Not both at the same time.
But how can i know if the user's input from Custom Keybord is a reply to the bot's message?
I have this code (PHP) running:
apiRequest ( "sendMessage", array (
"text" => "Choose option",
'chat_id' => $chat_id,
'reply_markup' => $keyboardOptions
)
);
resulting in this:
I know i can get the content of clicked button, but the field "reply_to_message" is missing (because it's no reply).
How is PollBot pulling this off? Looks like a ForceReply together with Custom Keybord?
Related
I'm unclear after reading through Slack's documentation around Incoming Webhooks. It seems like there's some ambiguity around Incoming Webhooks vs. posts through their chat API. It sounds like if I call it from https://my-application.yxz/api/notify?key=123123123123, and post to Slack from there, then Slack's action buttons will reply to that same URL, but I can't confirm that.
https://api.slack.com/docs/message-attachments
I'm successfully sending messages to the specified channel, but I can't figure out how to get a response back, or how to change the URL the actions will send their own payload to. Is that even possible?
For context of the code below, I'm using Laravel. Ideally, I wanted to only retain a Slack Webhook URL in the user settings for their store's location so they could receive Slack notifications triggered by our API being hit.
This is the payload I'm sending to the webhook and it works fine, however I would like to add actionable buttons and post the payload back to my external site. I'm not sure if Incoming Webhooks are even the right approach. Can someone shed some light on this?
# $helpdesk => contains webhook URL and other details
# $prompt => just some text
# $prompt_id => id associated with prompt object passed into the function this is found in
# $device => the source of this prompt
$payload = json_encode([
"text" => "A customer at $device->name requires attention",
"username"=>"Our Alert Thing",
"icon_emoji"=>":wave:",
"attachments"=> [
[
"fallback"=> $prompt,
"author_name"=> "Customer # $device->name",
"title"=> $prompt,
"text"=> "Let them know if you can help",
"callback_id"=> "csprompt_".$prompt_id,
"color"=> "#24ACE2",
"actions"=> [
[
"name"=> "action",
"type"=> "button",
"text"=> "I call dibs",
"style"=> "primary",
"value"=> "helping",
],
]
]
]
]);
$res = $client->post($helpdesk->slack_webhook, ['body'=>$payload]);
You can not programmatically set your action URL. Slack will send all interactive message requests (e.g. from a user clicking on one of your buttons) to the "request URL" that you have configured for your Slack app.
Check this link for details on where to find the request URL.
I think technically you can use incoming webhooks, but I would recommend using the API with chat.postMessage, because incoming webhooks are very limited. e.g. they can only be used with one pre-configured channel.
As i checked here the KeyboardButton object in telegram have nothing such as tag or data field. I had this implementation for keyboard of my bot:
$keyboardArray = array('Hello', 'Hi');
apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => 'Hello', 'reply_markup' => array(
'keyboard' => array($keyboardArray),
'one_time_keyboard' => true,
'resize_keyboard' => true)));
Currently pressing a keyboard button, send the label of button to my bot.
I want to know are there any options for telegram keyboard, which it can send special message to bot other than label of keyboard button? For example it send 100 when I press hello, 200 when I press Hi button.
Nope, it is not possible, these Keyboards can only send their own label. What would be possible are InlineKeyboards (see this). There you can specify callback_data, which is given to your server when the key is pressed. You could also specify a URL to be opened on button click. See documentation for InlineKeyboardButton here.
I am using PHP curl to post to https://api.pinterest.com/v1/boards/?access_token=mysecrettoken
I have two parameters, name and description that are being posted.
$data = array( 'name' => 'API Test', 'description' => 'Please ignore just a test' );
What I get back from Pinterest is NULL. It does create the board on Pinterest but I really need to know if it was successful and I need the board id.
What I would expect would be something like below. Which is what I get when using the API explorer.
root:{} 1 item data:{} 3 items url:https://www.pinterest.com/mrnickpowers/api-test/ id:73183631383926646 name:API Test
My curl function for posting works with other endpoints. Anyone have a clue what might be happening here?
Thanks,
Nick
i´ve written a "pushserver" for my app via PHP.
The push notifications i´ve sent via PHP are all received on the device, so far.
But, i can just send/set the "message" and "title", see:
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array(
'message' => $message,
'title' => 'My App',
'vibrate' => 1,
'sound' => 1,
'icon' => "http://example.com/image.jpg",
"style" => "inbox"
),
);
"icon" and "style" are not working (vibrate and sound not tested, yet).
Every link for the parameters i´ve found is broken or kind of "you need to do object.setSomething() in JAVA.
Is there a list anywhere where i can see ALL parameters, which i can send to GCM? No matter, what language i use?
Cheers,
Chris
couple of things need to keep in mind while all the data which you sending from server end
Is there a list anywhere where i can see ALL parameters,
exp :- you can send as many parameters as you want but offcourse there is limitation but not key specific just like you can use "textmessage" instead of "message" but make sure to retrieve the value from same key which you are assigning from server end
1) please make sure that you are getting all the data in gcmintentservice class try to print the log of all intent data.
please remember that this is just a string data it is not going to download the image for you. you have to download using volley library or any suitable library
I have a running workflow which I would like to post fields to via an API call (see below):
$ret = invokeFlowgear(
"https://domain.flowgear.io/salesbooks",
"username",
"password",
30,
array(
'name' => 'Introduction to Data integration with Flowgear',
'isbn' => 'X-XXX-XXXX',
'qis' => 0,
'price' => 250.99,
'author_id' => 3
)
);
Eventually this call should result into the workflow inserting the data onto the table and returning a success message.
What do I need to have this achieved with a workflow via an API?
You need to accept the raw HTTP POST body into the Workflow. To do that, set an appropriate URL ("/salesbooks/") in the workflow detail pane and set the method to POST.
Then drop in a Variable Bar and add the special property FgRequestBody. Optionally also add FgRequestContentType so you can inspect the content type of the message being received.
Create an HTTP POST to that Workflow and you can see what's coming through to the FgRequestBody property (it will show in the Start entry in the activity logs).
If you need to convert between JSON and XML, using JSON Convert.