Ninja -> Square - Create New Client Not working

Hey Everyone, thanks in advance for the help. I’m trying to setup Zapier to create a square contact when a new client is setup in InvoiceNinja. Im new to all of this so im hoping Im missing something silly. When i do the test feature with Zapier it works great. When i actually add a client to InvoiceNinja, Zapier throws the error “Could not create a customer. At least one of given_name, family_name, company_name, email_address, or phone_number is required for a customer”

I’ve mapped the fields square should be receiving (at least i believe), i’ll add a screenshot below.
It looks like Zapier isn’t pulling the fields from Invoice Ninja.
Ive reached out to Zapier Support, but was curious if anyone here has experienced this.

Here is my fields i mapped:


Here is what Zapier is showing as data out from InvoiceNinja:
id: LYqaQlenjk
user_id: VolejRejNm
assigned_user_id: VolejRejNm
name: Dummy 3
private_notes: this is number 3
balance: 0
paid_to_date: 0
credit_balance: 0
last_login: 0
client_hash: ougDB8BVofEwhUORALdb5JqkweAoXh8IIHgC8NlD
address1: 123 Sesame Street
phone: 0000000000
city: ThisPlace
state: WA
postal_code: 12345
country_id: 840
custom_value1: Yes
custom_value2: Tom Withey
shipping_address1: 123 Seasame Street
shipping_city: ThisPlace
shipping_state: WA
shipping_postal_code: 12345
shipping_country_id: 840
settings:
entity: App\Models\Client
language_id: 1
currency_id: 1
valid_until: 30
default_task_rate: 60
send_reminders: true
is_deleted: false
updated_at: 1656824095
archived_at: 0
created_at: 1656824095
display_name: Dummy 3
Fields with no value:
website
group_settings_id
size_id
public_notes
address2
industry_id
custom_value3
custom_value4
shipping_address2
vat_number
id_number
number
contacts
documents
gateway_tokens
querystring

Hi,

@david any ideas why the contacts aren’t being included?

@hillel

I am unable to create a scenario where the contacts are not sent back.

As a next step I suggest using a site like https://webhook.site to check what the app is sending.

I setup a webhook to webhook.site… This is what i got. Looks like it is indeed missing the required details… Very strange

{“id”:“JAPdRqbGyO”,“user_id”:“VolejRejNm”,“assigned_user_id”:“VolejRejNm”,“name”:“Tester Mc Testerson”,“website”:"",“private_notes”:“This is the private note”,“balance”:0,“group_settings_id”:"",“paid_to_date”:0,“credit_balance”:0,“last_login”:0,“size_id”:"",“public_notes”:"",“client_hash”:“wMMq47aB5YFQZWV6PhOhpgBlpgf1pSysakEBf5OW”,“address1”:“123 Sesame Street”,“address2”:"",“phone”:“5091234567”,“city”:“SomePlace”,“state”:“WA”,“postal_code”:“12345”,“country_id”:“840”,“industry_id”:"",“custom_value1”:“Yes”,“custom_value2”:“Myself”,“custom_value3”:"",“custom_value4”:"",“shipping_address1”:“123 Sesame Street”,“shipping_address2”:"",“shipping_city”:“SomePlace”,“shipping_state”:“WA”,“shipping_postal_code”:“12345”,“shipping_country_id”:“840”,“settings”:{“entity”:“App\Models\Client”,“language_id”:“1”,“currency_id”:“1”,“valid_until”:“30”,“send_reminders”:true},“is_deleted”:false,“vat_number”:"",“id_number”:"",“updated_at”:1656864844,“archived_at”:0,“created_at”:1656864844,“display_name”:“Tester Mc Testerson”,“number”:"",“contacts”:[],“documents”:[],“gateway_tokens”:[]}

Which version of the app are you using?

v5.4.4-C85

Self Hosted, used Softaculous to install.

@david any ideas to debug this?

Appreciate the help. Love your software, i can give you access or info to anything you think might be helpful.

@TomTom88

Can you please try running the curl command below replacing the URL and the token with one from your system. Let us know if the contacts do/do not return from CURL

curl -X GET 'http://ninja.test:8000/api/v1/clients/JAPdRqbGyO' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";

@david

Hey David, i replaced my URL (had to remove the port 8000), used one client ID i got from previous data, updated the token and yes, i can see all of the information correctly. I tested creating a new client again got the following from webhook.site, firstname and lastname are missing.

Thanks for the help!!

{
“id”: “yJrb2KdWLD”,
“user_id”: “VolejRejNm”,
“assigned_user_id”: “VolejRejNm”,
“name”: “Two Three”,
“website”: “”,
“private_notes”: “Private Note goes here”,
“balance”: 0,
“group_settings_id”: “”,
“paid_to_date”: 0,
“credit_balance”: 0,
“last_login”: 0,
“size_id”: “”,
“public_notes”: “”,
“client_hash”: “LzFYFUyPRtbApXE3WCLfIFSvVzWUBS2XCZAcYQRc”,
“address1”: “123 Sesame Street”,
“address2”: “”,
“phone”: “5091234567”,
“city”: “ThisPlace”,
“state”: “WA”,
“postal_code”: “11111”,
“country_id”: “840”,
“industry_id”: “”,
“custom_value1”: “Yes”,
“custom_value2”: “Tom Withey”,
“custom_value3”: “”,
“custom_value4”: “”,
“shipping_address1”: “123 Sesame Street”,
“shipping_address2”: “”,
“shipping_city”: “ThisPlace”,
“shipping_state”: “WA”,
“shipping_postal_code”: “11111”,
“shipping_country_id”: “840”,
“settings”: {
“entity”: “App\Models\Client”,
“language_id”: “1”,
“currency_id”: “1”,
“valid_until”: “30”,
“send_reminders”: true
},
“is_deleted”: false,
“vat_number”: “”,
“id_number”: “”,
“updated_at”: 1656894178,
“archived_at”: 0,
“created_at”: 1656894178,
“display_name”: “Two Three”,
“number”: “”,
“contacts”: [],
“documents”: [],
“gateway_tokens”: []
}

Just as a test, i also tried using make.com with the same results.

@TomTom88

If you are comfortable making some changes to the code, open the file

app/Observers/ClientObserver.php

You’ll want to find the lines like this

WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company)->delay(now()->addSeconds(2));

and add ,'contacts' like this (there should be 3 records)

WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company, 'contacts')->delay(now()->addSeconds(2));

Let us know if this resolves the issue.

@david

Made the change, still not working, is there anything i need to do to refresh the app after the change?

Thanks,
Tom

@TomTom88

The only think i can think of here is that the contacts for this client have been deleted?

Can you advise if in the database, the client_contacts table, is the deleted_at column set for these contacts?

@david

There are some that have timestamps for deleted_at (all my test creations i know i deleted), the latest attempt just seconds ago does not have a timestamp in the deleted_at column.

Would you advise at this point to wipe and reinstall? I have some data but could recreate it.

@TomTom88,

You could try that. But something just doesn’t add up with this.

@david

Hope you had a wonderful 4th!

I went ahead and wiped and reinstalled with Softaculous, Setup basic company name, added license and api token. Still having the same issue, first & last name not coming through.

I also tried a manual install with zip extraction, manual db creation and setup through the web interface. Tested again, still the same, no first last name.

I realized i was on version 5.4.4-C85, so i downloaded and installed 5.4.8-C86, did a zip install. Still no change.

I also thought maybe because my domain is a .tech tld, that was an issue. I tried with one of my .com tld domains, same issue. Not sure what else to try :frowning:

I was really hoping to get the integration working, very strange why its not.

help me @david your my only hope… HAHA :slight_smile:

@TomTom88

Can you DM me a login to the system, i’ll have a look.