Smartsheet - An error occurred during SSL handshake - smartsheet-api

It would be extremely useful to replace our existing interface with Smartsheets, since the client already uses Smartsheets and our prototype is a bit clunky. To that end, I'm building a prototype in order to the learn the Smartsheet API, and it breaks when I try to set up a webhook.
Here's the output when I attempt to update/enable a webhook:
{"message": "SUCCESS",
"resultCode": 0,
"result": {
"id": 4253946970695556,
"name": "Webhook_test",
"apiClientId": "3oqnphhimgqzyimk40",
"apiClientName": "ChoiceIP",
"scope": "sheet",
"scopeObjectId": 7055538769946500,
"events": [
"*.*"
],
"callbackUrl": "https://ghwd.net/write_requests_to_log.php",
"sharedSecret": "kpnc4nz7gwy91yjzcah2s6neq",
"enabled": false,
"status": "DISABLED_VERIFICATION_FAILED",
"disabledDetails": "An error occurred during SSL handshake. (ref id: fwhc0949r7km)",
"version": 1,
"createdAt": "2016-07-06T12:04:13Z",
"modifiedAt": "2016-07-07T06:04:20Z"
}
}
Here's the code from the script that is supposed to create a response:
$headers = getallheaders();
if( isset( $headers['smartsheet-hook-challenge'] ) ) {
header("Smartsheet-Hook-Response: " . $headers['smartsheet-hook-challenge']);
echo $headers['smartsheet-hook-challenge'];
return;
} else if( isset( $_POST['smartsheet-hook-challenge'] ) ) {
header("Smartsheet-Hook-Response: " . $_POST['smartsheet-hook-challenge']);
echo $_POST['smartsheet-hook-challenge'];
return;
} else {
header("Smartsheet-Hook-Response: debug");
}
Why is the SSL handshake failing?

You will need to have a valid SSL certificate setup for the domain ghwd.net or use a domain that has a valid SSL certificate.
When you create a webhook, Smartsheet will first try to connect to your callback URL over a secure connection. If a secure connection cannot be made the webhook will be disabled with the status you are seeing, DISABLED_VERIFICATION_FAILED.
Smartsheet Webhook Documentation

Related

Dialogflow - Firestore - Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500

I am trying for a fulfillment in Dialogflow using Firebase. There is data in Firestore and the intent is expected to retrieve the results based on the given parameter in the related intent. The intent is enables for webhook call. But the intent returns with one of the predefined responses.
I always get the error "message": "Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500."
Following is the Diagnostic Info from the test console
{
"responseId": "e27d24ba-cb14-4170-a7d8-a97314aee001-cad07fe1",
"queryResult": {
"queryText": "novaluron",
"parameters": {
"chemical": "novaluron"
},
"allRequiredParamsPresent": true,
"fulfillmentText": "This molecule is useful",
"fulfillmentMessages": [
{
"text": {
"text": [
"This molecule is useful"
]
}
}
],
"intent": {
"name": "projects/ppcagent-ahe9/agent/intents/6d9df198-9517-4d61-a480-87c158accdc5",
"displayName": "ChemicalDetails"
},
"intentDetectionConfidence": 0.3,
"diagnosticInfo": {
"webhook_latency_ms": 106
},
"languageCode": "en",
"sentimentAnalysisResult": {
"queryTextSentiment": {
"score": 0.3,
"magnitude": 0.3
}
}
},
"webhookStatus": {
"code": 14,
"message": "Webhook call failed. Error: UNAVAILABLE, State: URL_UNREACHABLE, Reason: UNREACHABLE_5xx, HTTP status code: 500."
}
}
Any help will be greatly appreciated.
This error could be due to different reasons, you can check these points:
Use of insecure connection.
You need to use HTTP requests. The service must use HTTPS and the URL must be publicly accessible in order for the fulfillment to function. DialogFlow does not support self-signed SSL certs. For information on SSL setup:
Permission errors.
Server files and folders need correct permissions and ownerships set in order to work properly. If Websites request files for which the server has no access then it will lead to an error.You can see more documentation about permission.
Bad scripting.
You need to check the code and check if there are any errors and modify them.

The server didn't receive response from Facebook Webhook

I'm trying to integrate webhook into my project, I have verified the webhook successfully, but when I send sample data to the server, my server does not receive anything, my project developed on Codeigniter.
I tried using postman to post Json data to the webhook url that was authenticated, my server received
Postman: [POST] https://xxxxxx.xxx/api/webhook
[RAW]
{
"field": "conversations",
"value": {
"page_id": 4444444,
"thread_id": "t_mid.14833205540:9182a4e489"
}
}
Code:
public function webhook(){
if (isset($_GET['hub_mode']) && isset($_GET['hub_challenge']) && isset($_GET['hub_verify_token'])) {
if ($_GET['hub_verify_token'] == 'EcyUykjnmredclnuYFLShBKHfutRFfDRdfdfb'){
echo $_GET['hub_challenge'];
}
}
$data = file_get_contents("php://input",true);
$myfile = fopen("./my-assets/uploads/text.txt", "w");
fwrite($myfile, $data);
fclose($myfile);
http_response_code(200);
}

Logout - Taleo User

I'm accessing the taleo api. I'm able to open the connection with the hosturl, username and password. But when I try to close or logout the session am unable to do it.
I have opened up the 20 connections now.
How to reset all those connections now?
Logout Request :
POST https://abc.tbe.taleo.net/xxxxx/ats/api/v1/logout
Logout response :
{
"response": {},
"status": {
"success": false,
"detail": {
"errormessage": "Login session for token null is expired or invaid.",
"error": "Login session for token null is expired or invalid.",
"operation": "internal",
"errorcode": "500"
}
}
}
Finally I got the answer. We need to add the authorization token as the cookie like follows .
add in the Header :
Cookie authToken="authorization_token"
Note: authorization_token between quotes

Different authorization header for each operation in a Guzzle client service description

The API I'm accessing requires a custom authorization header that is a combination of the publicKey that is passed in when the client is instantiated and the complete URI of the API endpoint. I want to pull the baseUrl and operation uri out of the service description and use them to create the authorization header, but I can't figure out how to do this when calling the instantiated client.
This is the service description:
{
"name": "FranchiseSystem",
"apiVersion": "1",
"baseUrl": "https://apidev.example.com",
"description": "REST API client",
"operations": {
"GetFranchiseList": {
"httpMethod": "GET",
"uri": "v1/franchise",
"summary": "Returns an array of franchises."
},
"GetReviews": {
"httpMethod": "GET",
"uri": "v1/review",
"summary": "Returns an array of reviews."
}
}
}
This is the client setup:
$testClient = new JunknetClient([
'publicKey' => '1234567890',
]);
This is the call to the instantiated client with the name of the operation:
$result = $testClient->GetFranchiseList();
or:
$result = $testClient->GetReviews();
When testClient->GetFranchiseList is called, I need to create the authorization header using the publicKey and the values of baseUrl and uri for GetFranchiseList.
When testClient->GetReviews is called, I need to create the authorization header using the publicKey and the values of baseUrl and uri for GetReviews.
You might want to have a look at the following links from the Guzzle docs.
Request Options - Headers
Authentication Parameters
I was able to solve my problem by using and event emitter and subscriber. It's a bit messy, but it get's the job done.
private function handleCredentialsOptions(Collection $config) {
//Build authorization header from $config values
$this->getHttpClient()->getEmitter()->on('before',
function (BeforeEvent $e) use(&$config) {
$this->getHttpClient()->setDefaultOption('headers', [
'Authentication' => '',
]);
$path = $e->getRequest()->getUrl();
$authValue = $config['publicKey'].';;';
$authValue .= time().';';
$authValue .= strtoupper(md5($config['privateKey'] . $path));
$this->getHttpClient()->setDefaultOption('headers', [
'Authentication' => $authValue,
]);
});
}

Not getting post notification from facebook for realtime api

I'm trying to get the realtime updates to my app from facebook using their realtime api. I have configured my subscription.
{
"data": [
{
"object": "user",
"callback_url": "https://myappname.herokuapp.com/realtime.php",
"fields": [
"activities",
"feed",
"is_app_user",
"likes",
"online_presence",
"photos",
"picture",
"status",
"wall_count"
],
"active": true
}
]
}
I have created an endpoint which simply logs the request when I get a post request. But I don't seem to be getting any calls from facebook. If I manually do a post to the end point, it logs the post body json. I have checked the heroku logs but there is no trace of post request form fb, only my manual request is present.
<?php
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe') {
echo $_GET['hub_challenge'];
} else if ($method == 'POST') {
$data = file_get_contents("php://input");
$json = json_decode($data, true);
error_log("update recieved");
error_log('updates = ' . print_r(json, true));
pg_close($db);
}
?>
I have did a callback request test specified by
https://graph.facebook.com/yourappid/subscriptions?access_token=youraccesstoken&object=user&fields=feed&verify_token=yourownsecretstringsetinyourphpfile&method=post&callback_url=http://www.yourwebsite.com/facebook_subscribe.php
which returned me null indicating subscription is success.
I have made a few status updates and likes but I'm not getting any updates from fb. Am I missing something out here?
Thanks in advance.
It's a bug but FB has labelled it as invalid.
Upvote this: https://developers.facebook.com/bugs/394779173962716