APIs & Integrations

SSingh857
Member

Webhook 500 error

I'm currently testing a Webhook, but I'm encountering 500 errors.
I have an API endpoint that successfully creates a contact:
Endpointlocalhost:8080/core-api/hubspot-contact/create
Request Body:
{
    "firstName": "test",
    "lastName": "test",
    "email": "test2@gmail.com",
    "phoneNumber": "+911234567899"
}
Using this API, I'm able to save the contact details to HubSpot without any issues.
However, the problem arises when I attempt to create a contact via the Webhook. While the Webhook is supposed to save the details in the database, it returns a 500 error.

0 Upvotes
2 Replies 2
SSingh857
Member

Webhook 500 error

 

I am encountering a 500 Internal Server Error when trying to trigger a HubSpot webhook for the following endpoint:

https://dev-api.xponentpowerapp.com/core-api/hubspot-contact/webhook

However, when testing the same api using Swagger with the following JSON:
{
"eventId": 2296615652,
"subscriptionId": 2849063,
"portalId": 47283995,
"appId": 3828294,
"occurredAt": 1728037175074,
"subscriptionType": "object.creation",
"attemptNumber": 4,
"objectId": 64617102089,
"objectTypeId": "0-1",
"changeFlag": "CREATED",
"changeSource": "CRM_UI",
"sourceId": "userId:70535958"
}
it works as expected, without any issues.

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Webhook 500 error

Hey, @SSingh857 👋 Thanks for reaching out. It can be tough to trouble shoot issues that are happening in your local environment. I have some troubleshooting steps (organized with the help of our GPT tool) that may give our community members more info to help you track down the issue.

 

  • Check Server Logs — Review logs for more details on what’s causing the 500 error 
  • Validate Request Payload — Verify the payload matches the expected structure. Compare the manual request (which works) with the webhook’s payload to spot any differences
  • Test Locally with ngrok — Use ngrok to expose your local server to the webhook, then test using Postman to simulate the request
  • Error Handling — Add error handling in your API to catch issues and return more robust status codes
  • Database Check — Confirm database constraints, like unique values, aren’t causing issues when the webhook tries to save the data

 

Thanks for the additional information! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes