webhooksdatainputstreamcallbackurlfullcontact

FullContact Webhook Callback Fails


I'm using the FullContact Card Reader API. From what I can tell when making a request to process a business card I need to send the FullContact API a image of a business card along with a webhook.

sending script:

<?php
$APIkey = 'my FullContact api key';
$callback_url = 'https://www.my-domain.com/my-callback-listener.php';
$url = "https://api.fullcontact.com/v2/cardReader?format=json&webhookUrl=$callback_url;
$imageAsBase64 = base64_encode(file_get_contents('path-to-image-including-extension'));
$requestBody = array();
$requestBody['front'] = $imageAsBase64;

$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, $url);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connection, CURLOPT_POST, true);
curl_setopt($connection, CURLOPT_POSTFIELDS, json_encode($requestBody));
curl_setopt($connection, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'X-FullContact-APIKey: $APIkey'));  

$result = curl_exec($connection);

echo json_encode(array('result' => $result));
?>

callback listener script:

 <?php
 header('HTTP/1.1 200 OK');
 ?>

I know the sending script is working because the curl result contains an id assigned by the FullContact API. Then, when I reference that id by manually typing the following url into my browser:

https://api.fullcontact.com/v2/cardReader/{id-assigned-from-FullContact}?apiKey={my-FullContact-api-key}

This is what I receive:

{
    "id": "id-assigned-from-FullContact",
    "lastWebhookAttempt": "2017-03-20T18:41:57.000Z",
    "vCardUrl":      "https://d1h3f0foa0xzdz.cloudfront.net/2971518/special-link-to-vcf-card.vcf",
    "status": "CALLBACK_FAILED",
    "webhookAttempts": 5,
    "webhookUrl":      "https://www.my-domain.com/my-callback-listener.php",
    "quality": "LOW",
    "submitted": "2017-03-20T18:28:27.000Z",
    "contact": {
       "photos": [{
          "primary": true,
          "value": "https://d1h3f0foa0xzdz.cloudfront.net/2971518/special-link-to-image-of-business-card.png",
          "type": "BusinessCard"
       }],
       "organizations": [{
          "title": "Senior Sales Consultant",
          "isPrimary": true,
          "name": "Company ABC"
       }],
       "name": {
          "middleName": null,
          "honorificPrefix": null,
          "familyName": "Meek",
          "givenName": "Jack",
          "honorificSuffix": null
       },
       "emails": [{
          "value": "person@something.com",
          "type": "Work"
       }],
       "phoneNumbers": [
          {
             "value": "+1 123-987-6543 ext. 5159069",
             "type": "Work"
          },
          {
             "value": "+1 123-456-6789",
             "type": "Mobile"
          },
          {
             "value": "886 123-4567",
             "type": "Work Fax"
          }
       ],
       "addresses": [{
          "region": null,
          "streetAddress": "1234 Nowhere Dr,",
          "formatted": null,
          "postalCode": "48377",
          "extendedAddress": null,
          "locality": "Novi",
          "type": "Work",
          "country": "United States"
       }]
    }
 }

You can see in the above result the FullContact API is making 5 attempts to call my callback listener script ultimately resulting in CALLBACK_FAILED. However, my callback script only contains HTTP/1.1 200 OK which should work just fine. This tells me my callback script is not reachable for some reason. My site is being hosted on GoDaddy using their shared hosting platform SSL.

Anyone know if GoDaddy blocks certain webhook traffic? Any help would be appreciated!

I tried reviewing the FullContact documentation but, it failed to provide any clear detail on how there webhooks send back data.


Solution

  • So I ended up reaching out to both my web host (GoDaddy) and FullContact. I have a shared hosting platform with GoDaddy so they restrict a ton of port numbers. FullContact assured me they only use either port 80 or 443.

    To solve this one I ended up having to create a local xampp server and make it publicly available. Then I directed FullContact to use my local server as my webhook.

    I ran a few tests and used php to pull the ip address, host name, and port number. Here are the results:


    Test 1.

    Host address: 52.70.48.63

    host name: ec2-52-70-48-63.compute-1.amazonaws.com

    port#: 63498


    Test 2.

    Host address: 52.70.48.63

    host name: ec2-52-70-48-63.compute-1.amazonaws.com

    port#: 4169


    Test 3.

    Host address: 52.70.48.63

    host name: ec2-52-70-48-63.compute-1.amazonaws.com

    port#: 61425


    All the port number returned are blocked by GoDaddy. The only way for me to receive data back from FullContact was to use my local server. Case Closed. Hope This ended up helping someone someday!