DocuSign API callback not sent to application - php

Recently stopped working on new application installation. The application was built in Laravel and from XAMPP installation and Ngrok I am able to create envelopes and to sign them. If application is deployed on any webserver (tested with 2 VPS) callback is not sent at all.
Replacing callback on the online version with Ngrok gave results also on the online Webhook.site I got a callback.
Envelope and Recipients are generated correctly. The code is absolutely the same on the localhost and online version.

the callback from DocuSign must be able to go through firewall etc. and must used TLS 1.2 or later on your end. The request is probably not making it through because of some networking problem on your network/server.
I would recommend you consider using a method where the request doesn't go to you directly but rather to a cloud provider and you have a listener connected to it.
Here is C# code for this (we have a few other langs options if you need):
https://github.com/docusign/connect-csharp-worker-aws
Here is PHP - https://github.com/docusign/connect-php-worker-aws

Related

PHP - Stripe Webhook is giving a TLS Error

I am trying to set up webhooks for Stripe. The webhook connects to https://authdomain.subd.com which then forwards the request (after adding a validation token) to http://www.workdomain.com
Both these urls are hosted on the same server.
Payment Intents generated from http://www.workdomain.com successfully go into Stripe.
(Update: I can also query run successful Stripe commands like \Stripe\Charge::all() from authdomain, which verifies that TLS 1.2 supported)
However the webhook returns a TLS error when trying to connect to https://authdomain.subd.com.
I have whitelisted Stripe's IP as listed here enter link description here
This process is working fine when I test it locally using a CLI, so I know I don't have to install Stripe on my auth layer project.
But for some reason when I try this on my live server it doesn't work on my live server.
Is there any reason this is happening?
Thanks for the help
This can be caused by any number of things, but the most common is an incomplete certificate chain. I'd recommend using Qualys' SSL Labs tool to check your server's TLS configuration. For example, to check the domain you shared:
https://www.ssllabs.com/ssltest/analyze.html?d=https://authdomain.subd.com&hideResults=on
If any of the intermediate chain certificates are marked as "missing" in this report, it can cause Stripe to refuse to connect to your webhook (as Stripe can't tie your TLS certificate back to a known global CA). Usually the fix is to download any missing certificates (the tool tells you which one) and add them to your production TLS configuration / bundle. You may need the help of your hosting company to configure this.
To test your repair, re-run the SSL Labs check after deploying the new certificate bundle and see if it's now resolved. Beyond that, if the problems persist I'd recommend writing Stripe support!

Proper approach to test inbound emails on localhost

I am currently working on a legacy CakePHP application that needs to to able to receive and parse emails using Sendgrid Webhooks. My team does it's development locally on our laptops and utilizes web servers for testing.
This feature should be able to receive an email from from an email client (gmail, etc.), parse it out and create items in the database based off of the email's contents. I am wondering what the most strait forward approach would be to test something like this locally while in development or if I am better off developing this on one of our servers in AWS? I am currently looking at Ngrok following this tutorial, but it is a bit dated and I wonder if there is a better way to handle this.
Also looking at using Mail Mine Parser for PHP, on the application side. If you happen to know of something better I would certainly be interested to know about it.
Thanks in advance for any feedback on the subject!
Handled a similar task using sengrid inbound webhooks and ngrok. The latter allows you to expose a public url on your local laptop/machine where sendgrid can send incoming emails.
Please check:
https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook
https://ngrok.com
I would suggest you test your webhook using ngrok before you set-up your own inbound webhook server.

How to test integrations between local environment and external services (webhooks)

since i started to develop web applications i always found very annoying to inspect external services requests and test my application with "realistic" scenarios. What's the solutions we've got to expose my local development environment to external services?
I am using Laravel Homestead and/or PHP Development Server
Before some time searching for the definitive answer i found a solution that solves all these problems in an efficient, free way, this is Ngrok, a product created by Alan Shreve -- which has worked on giants like Microsoft and Twilio. Alan wrote about the creation of Ngrok and an article on his blog he describes the product as:
"Ngrok is a tunneling, reverse proxy that establishes secure tunnels from a public endpoint to a locally running network service while capturing all traffic for inspection and replay. It is an open-source project on GitHub."
Let's get started:
Well, now that you know a little bit about the tool and why i found it let's demonstrate how to expose a local environment to allow third-party services to submit requests to local environments via Webhook is very simple and the two solutions that I'm going to present have been tested and work with the following scenarios :
Scenario 1: A PHP project using PHP 7.2.6 Development Server
Scenario 2: A Laravel (PHP) project using Laravel Development Server (php artisan serve)
Scenario 3: A Laravel (PHP) project using Laravel Homestead
To do this just follow the steps:
Access the Ngrok website
Register or Login
Download the client based on your OS
Authenticate the client downloaded following the instructions that appear on the same page you've downloaded it.
For the first two scenarios just run the following command
ngrok http <host>:<port>
ex: ngrok http 127.0.0.0.1:666
For the third scenario (if you are using a domain to access the homestead Ex: homestead.test you must rewrite the host-header. But don't worry, to achieve it just increment the command above to something like)
ngrok http <homestead_host_ip>:<port> -host-header=<homestead_domain>
example: ngrok http 192.168.10.10:80 -host-header=homestead.test
VoilĂ , now just point the URL generated by Ngrok in Webhook that you want to test and enjoy this wonderful solution.

automatic pull on production server after push to BitBucket

I develop my code locally, commit it to my local repsoitory and then push it to my Bitbucket server. After that I have to login via ssh to my production server
like this:
ssh my-server#my-host.de
pass: very-secure-passs
cd www/myPage
cd git pull origin master
pass: very-secure-pass
I would like to avoid login to my production server and let him pull automatically.
I want to have 3 repositories (local, BitBucket and production Server), so I cant use this solution: Do an automatic pull request after pushing to server
I found this question A hook that let `pull` from VPS when I `push` to Bitbucket which is exactly what I want, but it is from 2013 and the answer is outdated since BitBucket has changed since then.
I found here https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-I-deploy-my-bitbucket-repo-to-my-production-server/qaq-p/565348 that someone suggested to use a free Plugin called HTTP-Request Hook for Bitbucket Server
set up an automated "Pull": Each time you do a push to your central
repository, your production machine is notified and pulls the
repository on notification. Bitbucket Server offers serval plugins to
support the notification process - the one I use is Http Request Post
Receive Hook: each time a push is made, a configured URL is contacted,
submitting some info. On my production machine I have set up a little
web server, waiting for this HTTP-Request. On receiving the
HTPP-Request I evaluate the given parameters and perform an action
(for example: pulling the repository ...)
Now my questions are:
Is it possible to use a Webhook instead of the HTTP-Request
Hook Plugin?
How should the file on my production server look like so that it will do a pull request when it receives a HTTP-Request? I would be interested in a basic example in PHP.
The webhook documentation you linked is for Bitbucket Cloud (bitbucket.org), not Bitbucket Server (which is self-hosted and has some other URL). If you're using BB Cloud, then the HTTP-Request Hook Plugin won't work, but the documentation you linked will. If you're using BB Server, then you can use https://confluence.atlassian.com/bitbucketserver/managing-webhooks-in-bitbucket-server-938025878.html instead to define a webhook.
For the second half of your question - how to set up your server's end of a webhook - you'll need to have a small service that listens for the incoming webhook, does whatever authentication you want, and then runs your pull method. There are a zillion ways to do this, but most will vary based on your preferred language and security settings and on the network configuration of the server in question. I'd suggest a Google search for "webhook deploy $LANGUAGE" to see how some others have done it with your preferred language, or to see if there's a public repo or gist or snippet out there that you can use.
Instead of directly trying to pull on production server, you can setup a Jenkins job that will push the code to production server on each commit. Using Jenkins you can even customize the solutions to match particular token in commit message.

Restful php client not working on server but works fine in localhost

i need build a restful client on php. i have used pest class which is available on github. my client is working fine on localhost where the web service is hosted on a remote server. but when i uploaded the code to another server it returns timeout. I havent used any extension php (dll files). what can be the issue. please help me. thanx.
How does it execute it's web requests? (Sockets, file_get_contents, curl?) I'd imagine it's an issue of not allowing outbound requests. In that case, contact the server admin and ask them. Try using a demo curl script to see if you can contact google and pull down its index page, that will tell you if you are allowed out bound requests. I had this issue before, where my server was denied outbound requests and just had no results. I would think the server-admin would be able to help here.

Categories