I am new on working third party API, working on GUPSHUP API and with the help of guzzle I am sending msg to whatsapp but for receiving the message from callback url to my controller what should I use.
Notes-> Callback url which i added on is webhook call back URL , Now when any event happened on that url
how to receive that in my laravel controller, i search all the places where they suggested call webhook client server put a route
Route::webhooks('webhook-receiving-url');
in this i have to put my call back url . but i want to receive this call back url in controller , how to do this , please help me out
Related
I have followed all the steps mentoined here : and although I can sent a post request to my webhook url somehow Telnyx is unable to send the message payload here whenever I receive a message.
here is my code
public function receive_incoming_sms(Request $request){
return response()->json('Successfully Received',200);
}
here is the route defined in api.php
Route::post('/receive_incoming_sms', 'App\Http\Controllers\BucketController#receive_incoming_sms')->name('receive_incoming_sms');
but somehow telnyx is dropping the payload on the failover url which i created on https://webhook.site.
I'm trying to get the Auth working with Facebook but it keeps on telling me that my redirect URL is not working.
In the Valid OAuth Redirect URIs I have the following
https://localhost
The issue is that, I'm passing some additional query string to my callback, like
https://localhost?uuid=something&service=my_service
When attempting to Auth, I do get the request popup and then I get a redirect URL but then Facebook is telling me that the URL is not allowed.
If I test https://localhost?uuid=something&service=my_service in Facebook's Redirect URI Validator it's telling me it's not valid
How can I add a a URL including a dynamic query string ? I've tried
https://localhost*
But Facebook is telling me this is not a valid URL and won't let me save/add this URL.
#ceejayoz put me on the right track, I will answer my own question, that might help someone else.
Additional data must be passed in a state parameter such as
$data = json_encode($some_std_class);
$pdata = $fb_helper->getPersistentDataHandler();
$pdata->set('state', $data);
$login_url = $fb_helper->getLoginUrl($my_url, $my_permissions);
I have an application on Yii2.
I have an external vendor i want to redirect. For example, i am encrypting the current user info, and want to send that to the external vendor, so the user information is automatically populated on his website.
Everything works fine if i do that on the front end side using JS.
The problem i have is only my app server is whitelisted to the vendor. So i need to make the redirection happen on the backend.
I tried several method, and even with Guzzle HTTP, and it doesn't redirect.
TO be clear, i am not looking for a simple redirect, it is a form post on external URL.
I went though this post, but the problem remain the same...
Yii2 how to send form request to external url
Does anybody faced this issue?
If I understand you correctly, you want to POST data received from your frontend to the server of a third party company (let's call them ACME). Your webserver is whitelisted by ACME but your clients are not (which is good). You want to show a page on your server and not a page on the ACME server after the POST, right?
You have to send the data with a separate request from your server to the ACME server. You cannot create a HTML <form> and put the ACME server in the action parameter of it, because the request would be sent from the client and not your backend, failing at the whitelist. After you validate your client input, you can send it with guzzle to ACME.
With the status code you can decide if your request was successful or not. You can read more about guzzle here
The code sample below shows how you could POST the $payload (a fictional blog post if you will) as JSON to the ACME server and output a line with the request result.
$payload = [
'username' => 'john.doe',
'postContent' => 'Hello world',
];
$client = new GuzzleHttp\Client();
$response = $client->post('https://acme.example.org/endpoint',['http_errors' => false, 'json' => $payload]);
if($response->getStatusCode() === 200){
echo "Request OK";
}else{
echo "Request failed with status ".$response->getStatusCode();
}
This is not a duplication of my previous question here.
Am using botman to create a bot for my slack app.
Using the slack api, i have created a bot that i want to connect to botman on my laravel app. Am using ngrok to tunnel localhost. I have to get my url verified first in order to use it for the bot. Well i try to verify the url but i keep getting this error.
Your request URL didn’t respond with the correct challenge value. Update your URL to receive a new request and value.
Checking the ngrok terminal shows that the request from slack is being received and the status is 200. If i reproduce the request using postman, the value of the challenge parameter is returned, on slack i still get the erorr. I use this code to load the slack driver on my routes file.
<?php
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\Drivers\Slack\SlackDriver;
use BotMan\BotMan\Drivers\DriverManager;
Route::match(['get', 'post'],'botman', function () {
DriverManager::loadDriver(SlackDriver::class);
// Create BotMan instance
$config = [
'slack' => [
'token' => '***slack Token***' //slack token
]
];
$botman = BotManFactory::create($config);
// give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
$bot->reply('Hello yourself.');
});
// start listening
$botman->listen();
});
I went a head to try force the response with the challenge parameter in the url like so on my routes file.
$payload = $request->json();
if ($payload->get('type') === 'url_verification') {
return $payload->get('challenge');
}
SlackBot::hears('keyword', function (Bot $bot) {
$bot->respond('lets begin');
});
This still does not work, i still get the URL didn’t respond with the correct challenge value... error.
What am i missing? or how should i use the slack driver to have it respond with the right parameters? The web driver works perfectly.
I noticed that the slack api expects the challenge value in json format.
simply doing return $payload->get('challenge'); . does not do the trick. I changed this to return response->json( return $payload->get('challenge'));. This got my url verified.
Am not sure whether this is an issue with the whole botman slack-driver , I didn't find anyone else with the same issue.
I'm implementing OpenId Connect into my Yii2 app using the yii2-authclient library. I can login and exchange the code for a token with no problems. I've followed most of the code examples on the web and set a successCallback function that gets called once a user successfully logs in. It looks like this:
public function successCallback(ClientInterface $client)
{
$attributes = $client->getUserAttributes();
}
This code gets called, but calling getUserAttributes() results in the following error:
Exception – yii\authclient\InvalidResponseException
Request failed with code: 400, message:
{"error":"invalid_request","error_description":"Token not provided"}
The logs on the id server show a blank client and user, with an error of invalid_token.
I took a close look at the request I make and I see an access_token element. Any ideas what the problem might be? I can provide more information if necessary.
I figured it out. The problem was that the yii2-authclient library was sending the token as a GET parameter and the ID server was expecting it as a POST param. I upgraded the yii2-authclient library and that solved the problem since a recent change sends the parameter as POST instead of GET.