"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[5087],{947:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>h,default:()=>u,frontMatter:()=>d,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"api/lead","title":"Lead/Appointment Data API","description":"The API enables you to retrieve Lead/Appointment data by sending a POST request to the /chat/Chatbot/LeadList endpoint.","source":"@site/developer/api/109.lead.md","sourceDirName":"api","slug":"/api/lead","permalink":"/guides/developer/api/lead","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":109,"frontMatter":{"sidebar_position":109},"sidebar":"sidebar","previous":{"title":"Get Real Estate List","permalink":"/guides/developer/api/realestate/get-list"},"next":{"title":"Send Twilio Message","permalink":"/guides/developer/api/send-twilio-message"}}');var r=n(4848),a=n(8453),i=n(767),o=n(8175);const d={sidebar_position:109},h="Lead/Appointment Data API",l={},c=[{value:"Endpoint",id:"endpoint",level:2},{value:"Request Headers",id:"request-headers",level:2},{value:"Request Body",id:"request-body",level:2},{value:"Example Request",id:"example-request",level:2},{value:"Response",id:"response",level:2},{value:"Error Handling",id:"error-handling",level:2}];function p(e){const t={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"leadappointment-data-api",children:"Lead/Appointment Data API"})}),"\n",(0,r.jsxs)(t.p,{children:["The ",(0,r.jsx)(o.A,{})," API enables you to retrieve Lead/Appointment data by sending a ",(0,r.jsx)(t.code,{children:"POST"})," request to the ",(0,r.jsx)(t.code,{children:"/chat/Chatbot/LeadList"})," endpoint."]}),"\n",(0,r.jsx)(t.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,r.jsx)(i.TM,{path:"/chat/Chatbot/LeadList"}),"\n",(0,r.jsx)(t.h2,{id:"request-headers",children:"Request Headers"}),"\n",(0,r.jsx)(i.iW,{}),"\n",(0,r.jsx)(t.h2,{id:"request-body",children:"Request Body"}),"\n",(0,r.jsx)(i.VQ,{requestBody:{serialNumber:"3254a9d0424c4806b9ea3d0763ccfxxx",startTime:"2025-01-01",endTime:"2025-02-01",sessionID:1111},requestBodyParams:{serialNumber:"string, required - The unique identifier (ID) of the chatbot",startTime:"string, optional - Start date for filtering (format: YYYY-MM-DD) - The time zone is UTC.",endTime:"string, optional - End date for filtering (format: YYYY-MM-DD) - The time zone is UTC.",sessionID:"integer, optional - Session ID to filter specific conversations"}}),"\n",(0,r.jsx)(t.h2,{id:"example-request",children:"Example Request"}),"\n",(0,r.jsx)(i.r3,{path:"/chat/Chatbot/LeadList",requestBody:{serialNumber:"3254a9d0424c4806b9ea3d0763ccfxxx",startTime:"2025-01-01",endTime:"2025-02-01"}}),"\n",(0,r.jsx)(t.h2,{id:"response",children:"Response"}),"\n",(0,r.jsx)(i.zV,{responseExample:{Data:[{Type:"Lead",Name:"test",Email:"test@qq.com",PhoneNumber:"",CreateTime:"2023-11-23T18:36:21.512302-08:00",Content:"test",SessionID:31305,URI:"www.xxx.com",Count:2},{Type:"Appointment",Name:"test444",Email:"test444@qq.com",PhoneNumber:"",CreateTime:"2023-11-21T19:13:44.054019-08:00",Content:"Please share anything",SessionID:31313,URI:"www.xxx.com",Count:2}],Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:{Data:"array - List of leads and appointments","Data[].Type":"string - Type of record (Lead or Appointment)","Data[].Name":"string - User's name","Data[].Email":"string - User's email address","Data[].PhoneNumber":"string - User's phone number","Data[].CreateTime":"string - Record creation timestamp","Data[].Content":"string - Remarks or appointment content","Data[].SessionID":"integer - Chat session identifier","Data[].URI":"string - Source URL","Data[].Count":"integer - Total number of leads and appointments for the month",Version:"string - API version",Success:"boolean - Operation success status",Code:"integer - HTTP status code",Message:"string - Error message if any"}}),"\n",(0,r.jsx)(t.h2,{id:"error-handling",children:"Error Handling"}),"\n",(0,r.jsx)(i.NH,{})]})}function u(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},767:(e,t,n)=>{n.d(t,{Ay:()=>m,NH:()=>u,TM:()=>d,VQ:()=>l,iW:()=>h,r3:()=>c,zV:()=>p});n(6540);var s=n(3532),r=n(8069),a=n(9303),i=n(4848);const o=function(e,t){void 0===t&&(t={});const n=JSON.stringify(e,null,2).split("\n"),s=[];return n.forEach((e=>{const n=e.match(/"([^"]+)":/);if(n&&t[n[1]]){const r=e.match(/^\s*/)?.[0]||"";s.push(`${r}// ${t[n[1]]}`)}s.push(e)})),s.join("\n")},d=e=>{let{path:t,method:n="POST"}=e;const r=(0,s.r)()(t)||`https://usapi.hottask.com${t}`;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Request URL:"})," ",r]}),(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Method:"})," ",n]})]})},h=e=>{let{headers:t={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:n={Authorization:"string, required - The secret key for authenticating the API request","Content-Type":"string, required - The content type of the request payload (must be application/json)"}}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The API request must include the following headers:"}),(0,i.jsx)("ul",{children:Object.entries(t).map((e=>{let[t,s]=e;return(0,i.jsxs)("li",{children:[(0,i.jsxs)("code",{children:[t,": ",s]})," - ",n[t]]},t)}))})]})},l=e=>{let{requestBody:t,requestBodyParams:n,addCommentsToJson:s=o}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The request body should contain the following parameters:"}),(0,i.jsx)(r.A,{language:"json",children:s(t,n)}),(0,i.jsx)("ul",{children:Object.entries(n).map((e=>{let[t,n]=e;return(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:t})," - ",n]},t)}))})]})},c=e=>{let{method:t="POST",path:n,requestBody:o,headers:d={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"}}=e;const h=(0,s.r)()(n),l="undefined"==typeof window?"usapi.hottask.com":new URL(h||`https://usapi.hottask.com${n}`).host,c={javascript:`const res = await fetch('${h||`https://usapi.hottask.com${n}`}', {\n method: '${t}',\n headers: ${JSON.stringify(d,null,2)},\n body: JSON.stringify(${JSON.stringify(o,null,2)})\n});\n\nconst data = await res.json();\nconsole.log(data);`,python:`import requests\nimport json\n\nurl = '${h||`https://usapi.hottask.com${n}`}'\nheaders = ${JSON.stringify(d,null,4)}\ndata = ${JSON.stringify(o,null,2)}\n\nresponse = requests.${t.toLowerCase()}(url, headers=headers, json=data)\ndata = response.json()\nprint(data)`,bash:`curl '${h||`https://usapi.hottask.com${n}`}' \\\n -X ${t} \\\n${Object.entries(d).map((e=>{let[t,n]=e;return` -H '${t}: ${n}' \\`})).join("\n")}\n -d '${JSON.stringify(o)}'`,http:`${t} ${n} HTTP/1.1\nHost: ${l}\n${Object.entries(d).map((e=>{let[t,n]=e;return`${t}: ${n}`})).join("\n")}\n\n${JSON.stringify(o,null,2)}`};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.A,{as:"h3",children:"JavaScript (Fetch API)"}),(0,i.jsx)(r.A,{language:"javascript",children:c.javascript}),(0,i.jsx)(a.A,{as:"h3",children:"Python (Requests Library)"}),(0,i.jsx)(r.A,{language:"python",children:c.python}),(0,i.jsx)(a.A,{as:"h3",children:"cURL"}),(0,i.jsx)(r.A,{language:"bash",children:c.bash}),(0,i.jsx)(a.A,{as:"h3",children:"HTTP Request"}),(0,i.jsx)(r.A,{language:"http",children:c.http})]})},p=e=>{let{responseExample:t,responseComments:n,addCommentsToJson:s=o}=e;const a={...t,Version:"1.0.0",Success:!0,Code:200,Message:""},d={...n,Version:"string - API version",Success:"boolean - Operation success status",Code:"integer - HTTP status code",Message:"string - Error message if any"};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{children:"The API response will be a JSON object with the following structure:"}),(0,i.jsx)(r.A,{language:"json",children:s(a,d)})]})},u=e=>{let{errorHandling:t="If the request fails, you should:\n1. Check the HTTP status code for network-level errors\n2. Examine the `Code` and `Message` fields in the response for business-level errors\n3. The `Message` field will contain detailed error information"}=e;return(0,i.jsx)("div",{style:{whiteSpace:"pre-line"},children:t})};function m(e){let{title:t,path:n,method:r="POST",description:a="",requestBody:m={timeZone:"Asia/Shanghai",type:0},requestBodyDescription:g={timeZone:"The time zone of the chatbot. The standard time zone format: e.g., Asia/Shanghai or America/New_York.",type:"Create a generic chatbot with a fixed value of 0"},requestBodyComments:x={timeZone:"string, required",type:"integer, required"},responseExample:j={Data:"3254a9d0424c4806b9ea3d0763xxxxxx",Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:f={Data:"chatbot id"},headers:y={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:T={Authorization:"The secret key for authenticating the API request.","Content-Type":"The content type of the request payload."},errorHandling:w="If it's an HTTP network error, you should check the `HTTP status code`. If it's a business exception, you need to examine the `Code` and `Message` fields, which will provide the error details."}=e;const b=(0,s.r)()(n),q="undefined"==typeof window?"usapi.hottask.com":new URL(b||`https://usapi.hottask.com${n}`).host;JSON.stringify(y,null,2),o(m,x),JSON.stringify(y,null,4),o(m,x),r.toLowerCase(),Object.entries(y).map((e=>{let[t,n]=e;return` -H '${t}: ${n}' \\`})).join("\n"),JSON.stringify(m),Object.entries(y).map((e=>{let[t,n]=e;return`${t}: ${n}`})).join("\n"),o(m,x);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d,{path:n,method:r}),(0,i.jsx)(h,{headers:y,headersDescription:T}),(0,i.jsx)(l,{requestBody:m,requestBodyParams:g,addCommentsToJson:o}),(0,i.jsx)(c,{method:r,path:n,requestBody:m,headers:y}),(0,i.jsx)(p,{responseExample:j,responseComments:f,addCommentsToJson:o}),(0,i.jsx)(u,{errorHandling:w})]})}},8175:(e,t,n)=>{n.d(t,{A:()=>a});n(6540);var s=n(5872),r=n(4848);function a(){let e=(0,s.K)()();return["newoaks.ai","www.newoaks.ai","eu.newoaks.ai"].includes(e)&&(e="NewOaks AI"),"appointify.ai"===e&&(e="Appointify AI"),(0,r.jsx)("code",{children:e})}},3532:(e,t,n)=>{function s(){return function(e){if("undefined"==typeof window)return"";const t=window.location.hostname;let n="";return n="www.newoaks.ai"==t||"newoaks.ai"==t?"https://usapi.hottask.com":"eu.newoaks.ai"==t?"https://euapi.hottask.com":`https://${t}`,e?`${n}${e.startsWith("/")?e:`/${e}`}`:n}}n.d(t,{r:()=>s})},5872:(e,t,n)=>{function s(){return function(){return"undefined"==typeof window?"":window.location.hostname}}n.d(t,{K:()=>s})}}]);