I set my telegram bot webhook, but do not send the telegram. Why? - bots

I set webhook my telegram bot with setwebhook method but when I send a message in bot don't take this in my URL.
https://api.telegram.org/bot<token>/setwebhook?url=https://www.example.com/bot/temp.php
In my host I use PHP language for take and analysis and answer that. and I user this command for get updates from bot.
$update = file_get_contents(“php://input”);
But after run this line $update is empty.
I haven't problem with take updates without setwebhook bot when I use webhook don't take data.
result run getWebhookinfo is:
{"ok":true,"result":{"url":"https://example.com/bot/temp.php","has_custom_certificate":false,"pending_update_count":0,"max_connections":40}}
Do I have to be true "has_custom_cere"?
Thanks for help me

Mohammad, I think a PHP error occurred when telegram sends the request to you. Following code should works fine for getting the Telegram request.
$json = file_get_contents('php://input');
$request = json_decode($json);
I think your script stop before this code. I suggest you to enable PHP debug mode and check the error log.

You can find out problem via following method:
Check getWebhookInfo method, make sure your webhook URL is correct, and no last_error_message field.
POST similar data to your server, here is some data you can use in curl -d JSON, just copy it and run on your own server.
At last, check your CDN config (if you had applied on that server), temporary disable flooding or any check.

What is the outcome of the /getwebhookinfo method and could you post it here?
Please check if you SSL certificate valid (happend once to me) and what shows if you call the website in your browser (any php errors?).
I would have commented that, but I don´t have enough rep... Sorry :/

Please follow this way and if you don't get answer, your PHP has problem :
1- Revoke your Auth Key from BotFather by typing /revoke
2- Reset your Webbhook by new Auth Key :
https://api.telegram.org/bot<token>/setWebhook?url=https://www.website.com/bot_path
Notice #1 : setWebhook is case sensitive and W keyword must be capital.
Notice #2 : If you're using CMS such as Codeigniter, Laravel, Zend etc. It doesn't need to put .php after your bot_path and if not use it.
Notice #3 : If you want to delete last Webhook that you have set, You just need to write above url without ?url= at the rest.
3- After all you receive this message from telegram :
{"ok":true,"result":true,"description":"Webhook was set"}
Now you can test your Bot, But be aware that do this way to check your Auth Key and If there is no problem, absolutely your PHP code has problem. If you have problem yet please contact me on website to solve it Graphap and then put the right answer here.
I've told to recheck this way because I had problem frequently because of Auth Key which not working But now it works as well.

Related

Zapier Webhook issue

I've set up a ZAP so that when a subscriber is added to my aweber email list they are automatically added to a product in my membership plugin called DAP or digital access pass.
As per the instructions of the membership plugins developers, I am using a webhook in the zapier 'post' section.
It's not working. Quite simply the webhook doesn't appear to be calling anything.
Now, weird thing is that zapier logs show the webhook has been sent and has had success. But from DAP's end nothing is being received.
The support team at DAP tell me that the script isn't being called, because nothing appears in their logs.
They show me this by putting the webhook URL into a browser and calling it that way, and THEN the relevant info arrives in the DAP logs.
Zapier told me they do not trouble shoot and so advised that I post here.
Would appreciate any help. Thank you very much.
Dan
You can easily test if Zapier is making a call or not by sending the request to http://requestb.in
Steps:
Create a request bin and copy the URL.
Request bin screenshot
In Zapier, replace the webhooks post URL with the requestb.in URL.
Now, whenever the Webhook makes a post request, you should be able to visit the inspect page of your bin and check if a request was received. Just add ?inspect to the end of the URL. For example, if your Request bin URL is https://requestb.in/wbto8jwb then you should visit https://requestb.in/wbto8jwb?inspect
The inspect page will show all the requests received.
With this, you will know if Zapier is sending the requests. If the requests are being received by request bin then there is something which needs to be fixed by DAP.
Note that it could also be something in the configuration of the Webhook that is causing the request to not be recognised by DAP. It will help if you add more details to your question - what format is the DAP team expecting to receive the data in?
Below is a sample Webhook implementation in Zapier.
I have added a hook to POST data to a request bin (https://requestb.in/wbto8jwb)
Webhook POST screenshot
When I test this step, the request is received in the Request Bin Inspect page (https://requestb.in/wbto8jwb?inspect).
Request Bin Screenshot
More reading:
https://zapier.com/help/webhooks/
Update:
You can also make a direct call to the DAP API by using a tool like https://www.hurl.it/. From the drop down in destination, select POST and put the URL here. Click on Add body and paste the raw data from request bin. Now ask the DAP team to check if the request was received.

Slack API send commands via webhook

I am not sure if what I am trying to do is even possible. I have a Slack App and via that SlackApp I want to control another Slack App which is not mine.
That's probably too abstract, so let's get into detail:
There is the SlackApp Foodtrain. If you are a user you just type "/lunchtrain Location Time" and it does it's job. I want my App to activate a Lunchtrain but if I just send a Message via Webhook thats '/lunchtrain Location Time' it doesn't activate the command. You can see it in plaintext. Is there any way to do this properly?
Thanks everybody for the help!
The official Slack API does not allow you to issue slash commands, but there is an undocumented API method called chat.command that has this functionality.
Usage example:
https://slack.com/api/chat.command?token=TOKEN&channel=C123456789&command=/who
Check out the documentation for the method on this github for details.

Cannot set the webhook of my Telegram Bot

I set the webhook of my Telegram Bot and it seems to work fine, but the bot doesn't reply when I try to write him. The code of the file I indicated as webhook is correct (I checked it with getupdates method) and the server where it's hosted has the SSL certificate.
Trying to see the result of the method getWebhookInfo I checked up that the error was "Wrong response from the webhook: 410 Gone".
Anyone could help me to find out where the problem is?
I recommend you to copy the url you received from getWebhookInfo and then POST some valid JSON to it (e.g. on linux with curl, examples here: Telegram Guide).
WRON RESPONSE FROM WEBHOOK indicates that there is a problem with your web server configuration or something elso on the way in.
"410 Gone" is returned by your webserver, so maybe your .httaccess config is wrong (if using Apachee).

How can I create an authenticated scraper for Amazon product detail in Node.js?

I'm creating a script that grabs all the shipped items from Amazon and notifies me.
Authentication is needed to see the products though.
I've already tried sending a post request through "request" which returns an error because of the cookies and extra parameters needed.
It would be easy using cheerio afterwards to get the data if the authentication works.
Does anyone have any idea on how we can authenticate successfully?
The link from the email is: https://www.amazon.com/ap/signin/185-3199906-8918341?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyour-account%2Forder-details%2F185-3199906-8918341%3Fie%3DUTF8%26eoid%3D1%253A1%253Arv%252FYwjiYmnOZY9MYltVnDyf2l6p5pMkMx9deoUeiiw%252FKpPrtZrWqs5l1GGQPVb%2520qaJqHXyCkPEpLZnmDZamKkVDWhtu3dKlW5Gx7Uvxtzs0xlPJ25vduijJrPpHt79P%2520RRZHopOtAyOP4s82VLoeeiDQgq%2520FCP540H%2520UYAV7goZQxB29WObWAVh8VveTwEeWenY3sTx8ZI9%252FBLM2BSqS3IUIURW8mzMnAB9t7wglUiAcoR%252FcUhSIx%25201eNV4MspVAp7fLkeANag72BxgmsjFfRhnsxfji1VhZXLawqFeK9SBnvbUfkNWUC%2520IXWh6VcuoStBG3x%2520ZUkzGHw1ORi4J%2520Hg%253D%253D%26orderID%3D105-6914722-5422613%26ref_%3DTE_simp_on_T1&pageId=webcs-yourorder&showRmrMe=1
You cannot guarantee any of the form input values of the sign in page. So you must also scrape the login form.
Here is the process:
In your server, make Request to the URL in your question
Using Cheerio parse the DOM and grab all of the form fields from "#ap_signin_form".
Add in your data (Username/Pass) then make a POST request to the form action "https://www.amazon.com/ap/signin" (This should also be scraped)
Hopefully that will get you past the login screen. You will need to ensure all future requests pass the cookies set from login.
Now this kind of thing is clearly against most TOS's so I would urge caution in doing this kind of thing often.

MassPay API Using NVP returns "Security Header Is Not Valid"

I'm trying to follow the instructions at https://developer.paypal.com/docs/classic/mass-pay/integration-guide/MassPayUsingAPI/#id101DEJ0100A for paying a customer. https://www.paypal.com/us/cgi-bin/webscr?cmd=_profile-api-signature# tells me the API username, API password and and signature. I paste those values directly into my program, and POST those parameters (as well as other parameters) to https ://api-3t.paypal.com/nvp and I get this response back:
TIMESTAMP=2015%2d05%2d06T23%3a58%3a01Z&CORRELATIONID=6eef131f4a296&ACK=Failure&VERSION=2%2e3&BUILD=16566018&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Security%20error&L_LONGMESSAGE0=Security%20header%20is%20not%20valid&L_SEVERITYCODE0=Error
Any tips for troubleshooting what might be going on here?
Thanks in advance!
Kevin
That error means the API credentials you're using are not accurate. Double the check the values themselves and make sure you didn't miss any characters or add any extra white space on the ends of the values. Also, make sure you're not sending sandbox credentials to the live PayPal server or vice-verse. That's usually what's happening when people run into this.

Resources