APIs & Integrations

MHINDS
Membro

Adding a new contact to hubspot

I'm building an assistant chatbot to collect user information and by using openAPI I can retrieve the fields and push the data to hubspot to create a new contact, the API works where I can see the recordID of the new user that was created but the other collect fields such as name, email, phone number etc aren't being displayed on hubspot. Can I get some assistance?

0 Avaliação positiva
2 Respostas 2
Jaycee_Lewis
Gerente da Comunidade
Gerente da Comunidade

Adding a new contact to hubspot

Hi, @MHINDS 👋 Welcome to the community. This is a tough one to troubleshoot via the community. It's likely access to the chatbot + access to your portal would be required. 

  • What HubSpot endpoints are you using?
  • Can you share an example payload?
  • Are there any additional details you can share with our community members?

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Avaliação positiva
MHINDS
Membro

Adding a new contact to hubspot

Hi,

  • Well i'm integrating it with watsonx assistant chatbot, I have defined the scope (crm.contacts.read, crm.contacts.write).
  • See attached API code
{
  "openapi": "3.0.3",
  "info": {
    "title": "HubSpot Contact Submission",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.hubapi.com",
      "description": "HubSpot CRM API Server"
    }
  ],
  "paths": {
    "/crm/v3/objects/contacts": {
      "post": {
        "summary": "Create a new contact in HubSpot",
        "description": "This API accepts contact information from a form and submits it to HubSpot CRM",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "firstname": {
                    "type": "string",
                    "description": "User's first name",
                    "example": "John"
                  },
                  "lastname": {
                    "type": "string",
                    "description": "User's last name",
                    "example": "Doe"
                  },
                  "email": {
                    "type": "string",
                    "description": "User's email address",
                    "example": "johndoe@example.com"
                  },
                  "phone_number_2": {
                    "type": "string",
                    "description": "User's phone number",
                    "example": "+1234567890"
                  }
                },
                   
                "required": ["firstname", "lastname", "email", "phone_number_2"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, object invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique ID of the created contact",
            "example": "123456"
          },
          "status": {
            "type": "string",
            "description": "Response status",
            "example": "success"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Error code",
            "example": "400"
          },
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Invalid input"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "x-apiKey": "*****************************************"  
}
 
On the assistant chatbot, the user would enter their name etc, the API collects this information and uses the post method to push it to hubspot, the query was successful because a new contact was created with a recordID but the other fields are not displaying.
0 Avaliação positiva