Integrations
Enjo API
8 min
this api allows external clients to connect with enjo's ai agents users can send messages to the agents and automate workflows like generating support tickets the api provides endpoints for seamless communication with ai agents through enjo's platform the api supports secure communication through bearer token based authentication authentication to access the api, developers must authenticate using bearer tokens these tokens are generated through the personal access token settings within your workspace once created, the bearer token can be included in the authorization header of your api requests to authenticate and interact with the api securely accessing api settings navigate to personal access tokens click on your settings icon in the bottom right corner of the enjo dashboard select security > personal api key from the left sidebar click the create token button assign a name to your token a new token will be generated— make sure to copy it immediately, as it will not be displayed again make sure to copy it immediately, as it will not be displayed again making your first api request { "name" "api endpoint ", "method" "post", "url" "v1/bots/\ id/message", "description" "this endpoint allows you to send text to a bot and receive automated responses additionally, it can trigger the creation of tickets in an integrated ticketing system, such as jira, servicenow, or other supported platforms, streamlining issue tracking and management \n\nbase url https //api enjo ai/\n\n", "tab" "examples", "examples" { "languages" \[ { "id" " tg92ddxmzejrfu53voqm", "language" "apex", "code" "curl location 'https //api enjo ai/v1/bots/\<botid>/message' \\\\\n header 'content type application/json' \\\\\n header 'authorization bearer \<access token>' \\\\\n data '{\n \\"message\\" {\n \\"text\\" \\"request for ticket generation\\",\n \\"conversationid\\" \\"\<conversationid>\\"\n\n }\n\n}'\n", "customlabel" "curl" }, { "id" "v9h0cskkaxz9r6gmq56 9", "language" "javascript", "code" "const myheaders = new headers();\nmyheaders append(\\"content type\\", \\"application/json\\");\nmyheaders append(\\"authorization\\", \\"bearer \<access token>\\");\n\nconst raw = json stringify({\n \\"message\\" {\n \\"text\\" \\"request for ticket generation\\",\n \\"conversationid\\" \\"\<conversationid>\\"\n }\n});\n\nconst requestoptions = {\n method \\"post\\",\n headers myheaders,\n body raw,\n redirect \\"follow\\"\n};\n\nfetch(\\"https //api enjo ai/v1/bots/\<botid>/message\\", requestoptions)\n then((response) => response text())\n then((result) => console log(result))\n catch((error) => console error(error));\n", "customlabel" "" }, { "id" "rrurdmjk 4r3h4dgwk9rh", "language" "python", "code" "import requests\nimport json\n\nurl = \\"https //api enjo ai/v1/bots/\<botid>/message\\"\n\npayload = json dumps({\n \\"message\\" {\n \\"text\\" \\"request for ticket generation\\",\n \\"conversationid\\" \\"\<conversationid>\\"\n }\n})\nheaders = {\n 'content type' 'application/json',\n 'authorization' 'bearer \<access token>'\n}\n\nresponse = requests request(\\"post\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "customlabel" "" }, { "id" "tbx3lm7xshrfbod0uhph0", "language" "ruby", "code" "library(httr)\n\nheaders = c(\n 'content type' = 'application/json',\n 'authorization' = 'bearer \<access token>'\n)\n\nbody = '{\n \\"message\\" {\n \\"text\\" \\"request for ticket generation\\",\n \\"conversationid\\" \\"\<conversationid>\\"\n }\n}';\n\nres < verb(\\"post\\", url = \\"https //api enjo ai/v1/bots/\<botid>/message\\", body = body, add headers(headers))\n\ncat(content(res, 'text'))\n", "customlabel" "" }, { "id" "gozvtezkkslbz5g3 em7d", "language" "java", "code" "library(httr)\n\nheaders = c(\n 'content type' = 'application/json',\n 'authorization' = 'bearer \<access token>'\n)\n\nbody = '{\n \\"message\\" {\n \\"text\\" \\"request for ticket generation\\",\n \\"conversationid\\" \\"\<conversationid>\\"\n }\n}';\n\nres < verb(\\"post\\", url = \\"https //api enjo ai/v1/bots/\<botid>/message\\", body = body, add headers(headers))\n\ncat(content(res, 'text'))", "customlabel" "java" } ], "selectedlanguageid" "gozvtezkkslbz5g3 em7d" }, "results" { "languages" \[ { "id" "zgwwb6xz9ke16 bfumntt", "language" "200", "customlabel" "", "code" "{\n \\"success\\" true,\n \\"data\\" {\n \\"answers\\" \\"the response to the user's question or query this can include detailed information, facts, or any other response generated by the bot based on the user's input \\",\n \\"sources\\" \[\n {\n \\"type\\" \\"jira\\",\n \\"name\\" \\"source name (e g , jira ticket, knowledge base article)\\",\n \\"score\\" 0 95,\n \\"url\\" \\"https //source link com\\"\n }\n ],\n \\"conversationid\\" \\"unique conversation id\\",\n \\"ticketdetails\\" {\n \\"url\\" \\"https //ticket system com/ticket/123456\\",\n \\"attributes\\" {\n \\"type\\" \\"case\\",\n \\"url\\" \\"/services/data/v1 0/sobjects/case/123456\\"\n },\n \\"id\\" \\"123456\\",\n \\"casenumber\\" \\"00012345\\",\n \\"suppliedname\\" \\"user's name\\",\n \\"suppliedemail\\" \\"user\@example com\\",\n \\"suppliedphone\\" \\"123 456 7890\\",\n \\"suppliedcompany\\" \\"company name\\",\n \\"type\\" \\"type of issue (e g , support, inquiry)\\",\n \\"status\\" \\"open\\",\n \\"priority\\" \\"high\\",\n \\"description\\" \\"detailed description of the issue or ticket\\",\n \\"createddate\\" \\"2024 10 10t12 00 00 000z\\",\n \\"lastmodifieddate\\" \\"2024 10 10t12 00 00 000z\\"\n }\n }\n}" }, { "id" "oxcx6kppl1bbcldjvypu2", "language" "400", "code" " { \n \\"code\\" \\"invalid request error\\",\n \\"error\\" \\"botid not found\\"\n }", "customlabel" "" }, { "id" "szmowc2cpflkvz87lsouj", "language" "401", "code" "{\n \\"code\\" \\"authentication error\\",\n \\"error\\" \\"authentication error\\"\n }", "customlabel" "" }, { "id" "g34imhzxl5ylfdj64ibxe", "language" "404", "customlabel" "", "code" "{\n \\"code\\" \\"not found\\",\n \\"error\\" 'not found',\n}" }, { "id" "6pjrfcf6bq fulx8s3w89", "language" "429", "code" "{\n \\"code\\" \\"rate limit error\\",\n \\"error\\" \\"rate limit exceeded\\"\n}\n\n", "customlabel" "" }, { "id" "t9ts0cjo6rikopkcaj96n", "language" "500", "code" "{\n \\"code\\" \\"server error\\",\n \\"error\\" \\"server error\\",\n }", "customlabel" "" } ], "selectedlanguageid" "g34imhzxl5ylfdj64ibxe" }, "request" { "pathparameters" \[ { "name" "id", "kind" "required", "type" "string", "description" "unique identifier for the ai agent", "children" \[] } ], "queryparameters" \[], "headerparameters" \[ { "name" "auth token", "kind" "required", "type" "string", "description" " bearer access token", "children" \[] } ], "bodydataparameters" \[ { "name" "text", "kind" "required", "type" "string", "description" "this input serves as the basis for the bot's processing, enabling it to generate an appropriate reply or take further actions based on the message content ", "children" \[] }, { "name" "conversationid", "kind" "optional", "type" "string", "description" "a unique identifier is used to track the current conversation this allows tracking across multiple requests", "children" \[] } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "header parameter", "value" "headerparameters" }, "response" \[ { "name" "answers provided", "kind" "optional", "type" "string", "description" "the bot's response to the user's input the cake retrieved" }, { "name" "conversation id", "kind" "optional", "type" "string", "description" "a unique identifier for tracking the conversation ", "children" \[] }, { "name" "ticket details ", "kind" "optional", "type" "string", "description" "information about the created ticket, including the ticket id, status, and any relevant metadata ", "children" \[] }, { "name" "sources used", "kind" "optional", "type" "string", "description" "any references or data sources utilized in generating the response \n", "children" \[] } ] } ticketing configuration the bot can automatically generate a ticket if it is configured with a ticketing platform if ticketing is not configured, refer to the ai agent ticketing configuration guide https //docs enjo ai/ai agent ticketing api response structure upon a successful interaction with the bot or the creation of a ticket, the api response will include comprehensive details this ensures full transparency and traceability of the conversation and any actions the bot takes, such as creating a ticket table format describes the structure and details of the response field type description success boolean indicates whether the api call was successful (true) or encountered an error (false) data object contains the primary data in the response when the api call is successful ├── answers string the bot's response or answer to the user query, may include detailed text, facts, or solutions ├── sources array of objects lists the sources from where the answers are derived │ ├── type the type of source (e g jira , knowledge base) │ ├── name string name or title of the source │ ├── score float confidence score of the source's relevance to the query │ ├── url string url link to the source where more information can be found ├── conversationid string a unique identifier to track the conversation and ensure continuity across multiple interactions ├── ticketdetails object details about the ticket created in the external system (if applicable) │ ├── url string url to access the ticket in the external system │ ├── attributes string metadata and additional information about the ticket │ ├── id string unique identifier for the ticket │ ├── type string the category or type of issue raised in the ticket │ ├── status string current status of the ticket (e g , open, closed) │ ├── priority string priority level of the ticket (e g , low, medium, high) │ ├── description string description of the issue or request in the ticket │ ├── createddate string timestamp indicating when the ticket was created │ ├── lastmodifieddate string timestamp indicating the last time the ticket was modified rate limiting limit 20 requests per minute per ip response (when limit exceeded) { "code" "rate limit error", "message" "rate limit exceeded", "status" 429 } throttling limit 10 requests per 5 seconds per ip response (when throttling triggered) { "code" "rate limit error", "message" "rate limit exceeded", "status" 429 } troubleshooting guid e issue "invalid botid" error solution double check that the bot id in your request matches the one listed in your enjo dashboard issue no ticket response was received solution confirm that the bot is properly set up for ticketing for setup details, refer to the ai agent ticketing configuration guide
