Introducing Xano Actions
Build and share reusable visual building blocks
Xano Actions are reusable visual functions that serve as the building blocks for any workflow. Easily connect to various third-party services and modify the business logic to fit your unique use case.
Discover
Browse and discover actions created by the community. Test them directly without logging in.
Create
Build your own custom Actions and share them with anyone.
Install
Easily install Actions into your Xano workspace and integrate them seamlessly into your workflows.
Browse by category
Featured Actions
Function Documentation: Brevo → Send Single Email
Brevo API documentation
Overview
This function sends a single email using the Brevo (Sendinblue) API with HTML content. It requires inputs such as the API key, sender and receiver details, email content, and subject. The function validates and processes the input before making a request to the Brevo API.
Inputs
brevoapikey (registry/text) Required
Description: API key for authenticating with Brevo API.
Example: xkeysib-...
from (object) Required
Description: The sender's email address.
Example: sender@example.com
to (object) Required
Description: The recipient's email address.
Example: receiver@example.com
message_html (text) Required
Description: The HTML content to be sent.
Example: <html><body><h1>Hello</h1></body></html>
subject (text) Required
Description: The subject of the email.
Example: Welcome to our service!
Function Stack
Try / Catch Block
Precondition: Check Valid HTML Content
Description: Ensures the HTML content for the email is valid before proceeding.
API Request to Sendinblue
API Request to https://api.brevo.com/v3/smtp/email
Purpose: Sends the email using the Brevo (Sendinblue) API.
Return Value: The API response is stored as api_response.
Create Variable: response
Variable: var: response = var: api_response.response.result
Purpose: Stores the API response for the SMS send operation.
2 Error Handling (Catch)
Create Variable: response
Purpose: If the API call fails or returns an error, this block catches the error and provides an error message.
Response
The function returns the result of the email send operation, including status and any relevant messages.
Success Response
`json
{
"messageId": "<202410100.1236169*@smtp-relay.mailin.fr>",
}
`
Error response
`json
{
"message": "Key not found",
"code": "unauthorized"
}
`
Example
Input
`json
{
"from":{
"from_name":"John",
"from_email":"sohansakhare**@gmail.com"
},
"to":{
"to_name":"David",
"to_email":"sajankumar.*@unicoco*.com"
},
"email_html":"<html><head></head><body><p>Hello world</p></body></html>",
"subject":"abc"
}
`
Output
`json
{
"messageId": "<202410100.1236169*@smtp-relay.mailin.fr>"
}
`
Postmark → Send Batch Emails
Overview
This function allows you to send a batch of emails using the Postmark API. It requires parameters such as the sender email address, recipient email addresses, subject, body, and optionally a template ID.
Inputs
postmarkbaseurl (registry|text) Required
Description: The base url for calling the Postmark API (e.g., "https://api.postmarkapp.com/").
postmarkservertoken (registry|text) Required Sensitive data
Description: This is the Postmark Server API Token (e.g., "14g8dce4-7054-47c9-a18a-2107e5cf4e41"). This is needed for authentication on endpoints.
message (Object[]) Required
Description: An Object of message, each containing the following properties:
from_email (text) Required
Description: The email address of the sender.
to_email (text) Required
Description: The email address of the recipient.
subject (text) Required
Description: The subject line of the email.
html_body (text) Optional
Description: The HTML content of the email message. If provided, it takes precedence over text_body.
text_body (text) Optional
Description: The plain text content of the email message. If provided and html_body is not, it will be used.
Function Stack
Create Variable: api_url
Purpose: Constructs the API URL for sending batch emails.
Create Variable: api_token
Purpose: Stores the Postmark API token.
Create Variable: messages_payload
Purpose: Initializes an empty array to store the Postmark formatted messages.
Precondition
Precondition: from_email should not exceed 255 characters.
Purpose: Ensures the sender email address is not too long.
Precondition: from_email is a valid email format.
Purpose: Ensures the sender email address is formatted correctly.
Precondition: to_email is a valid email format and allows comma-separated values.
Purpose: Ensures recipient email addresses are formatted correctly and the list is not too long.
Precondition: to_email should not exceed 50 email addresses.
Purpose: Limits the number of recipients per batch.
Precondition: textbody or htmlbody != null
Purpose: Either textbody or htmlbody (or both) are provided.
Precondition: html_body is a valid HTML format
Purpose: html_body is a valid HTML format
Convert Message: Postmark Format
Purpose: Create a Postmark message object with the required fields, ensuring that to_email is converted to an array if it's a comma-separated list.
Update Variable: Increment message_counter.
Purpose: Update message_counter.
API Request
Sends a POST request to the apiurl with the messagespayload as the request body.
Create Variable: postmark_response
Purpose: Stores the response from the Postmark API.
7 Create Variable: response
Purpose: Creates a response object with the result from the Postmark API.
Response
The function returns a success message or an error message depending on the outcome.
Success Response
`json
{
"To": "user1@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
},
{
"To": "user2@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-2",
"ErrorCode": 0,
"Message": "OK"
}
`
Error Response
`json
{
"ErrorCode": 401,
"Message": "Unauthorized: Missing or incorrect API key."
}
`
Example
Input
`json
{
"message": [
{
"from_email": "sender@example.com",
"to_email": "recipient1@example.com,recipient2@example.com",
"subject": "Welcome to Our Service",
"html_body": "<h1>Welcome!</h1><p>Thank you for joining our service.</p>",
"text_body": "Welcome! Thank you for joining our service."
},
{
"from_email": "admin@example.com",
"to_email": "recipient3@example.com",
"subject": "Important Update",
"html_body": "<h1>Update</h1><p>Here’s an important update for you.</p>"
}
]
}
`
Output
`json
[
{
"To": "recipient1@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
},
{
"To": "recipient2@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-2",
"ErrorCode": 0,
"Message": "OK"
},
{
"To": "recipient3@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-3",
"ErrorCode": 0,
"Message": "OK"
}
]
`
John Carmack’s fast inverse square root function is a famous algorithm used in computer graphics, particularly in 3D rendering, to compute the inverse square root of a number quickly.
It was notably used in the Quake III Arena game engine to speed up computations related to lighting, shading, and physics. The function approximates the value of 1/sqrt(x) very efficiently, significantly faster than the traditional method of calculating a square root followed by division.
A helper function that creates a 1-click MCP install link for Cursor using URL-based authentication with Xano MCP Servers. This function generates deeplinks and various markup formats (Markdown, HTML, JSX) that allow users to install MCP servers directly into Cursor with a single click.
Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| mcpserverurl | string | Yes | The full URL endpoint of the Xano MCP server |
| server_name | string | Yes | Display name for the MCP server |
| server_type | enum | Yes | Type of MCP server connection |
Example Input
`json
{
"mcpserverurl": "https://x123-wu0q-dtak.n7.xano.io/x2/mcp/6vi_VA6-/mcp/sse",
"server_name": "Xano MCP Server Name",
"server_type": "sse"
}
`
Example Output
`json
{
"deeplink": "cursor://anysphere.cursor-deeplink/mcp/install?name=Xano MCP Server Name&config=eyJ0eXBlIjoic3NlIiwidXJsIjoiaHR0cHM6Ly94MTIzLXd1MHEtZHRhay5uNy54YW5vLmlvL3gyL21jcC82dmlfVkE2LS9tY3Avc3NlIn0=",
"markdown": {
"dark": "",
"light": ""
},
"html": {
"dark": "<a href=\"cursor://anysphere.cursor-deeplink/mcp/install?name=Xano MCP Server Name&config=eyJ0eXBlIjoic3NlIiwidXJsIjoiaHR0cHM6Ly94MTIzLXd1MHEtZHRhay5uNy54YW5vLmlvL3gyL21jcC82dmlfVkE2LS9tY3Avc3NlIn0=\"><img src=\"https://cursor.com/deeplink/mcp-install-dark.svg\" alt=\"Add Xano MCP Server Name MCP server to Cursor\" height=\"32\" /></a>",
"light": "<a href=\"cursor://anysphere.cursor-deeplink/mcp/install?name=Xano MCP Server Name&config=eyJ0eXBlIjoic3NlIiwidXJsIjoiaHR0cHM6Ly94MTIzLXd1MHEtZHRhay5uNy54YW5vLmlvL3gyL21jcC82dmlfVkE2LS9tY3Avc3NlIn0=\"><img src=\"https://cursor.com/deeplink/mcp-install-light.svg\" alt=\"Add Xano MCP Server Name MCP server to Cursor\" height=\"32\" /></a>"
},
"jsx": {
"dark": "<a href=\"cursor://anysphere.cursor-deeplink/mcp/install?name=Xano MCP Server Name&config=eyJ0eXBlIjoic3NlIiwidXJsIjoiaHR0cHM6Ly94MTIzLXd1MHEtZHRhay5uNy54YW5vLmlvL3gyL21jcC82dmlfVkE2LS9tY3Avc3NlIn0=\"><img src=\"https://cursor.com/deeplink/mcp-install-dark.svg\" alt=\"Add Xano MCP Server Name MCP server to Cursor\" height=\"32\" /></a>",
"light": "<a href=\"cursor://anysphere.cursor-deeplink/mcp/install?name=Xano MCP Server Name&config=eyJ0eXBlIjoic3NlIiwidXJsIjoiaHR0cHM6Ly94MTIzLXd1MHEtZHRhay5uNy54YW5vLmlvL3gyL21jcC82dmlfVkE2LS9tY3Avc3NlIn0=\"><img src=\"https://cursor.com/deeplink/mcp-install-light.svg\" alt=\"Add Xano MCP Server Name MCP server to Cursor\" height=\"32\" /></a>"
}
}
`
Output Fields
deeplink
The raw Cursor deeplink URL that can be used programmatically or shared directly.
markdown
Ready-to-use Markdown install buttons with Cursor's official badge images:
dark: Dark theme install button
light: Light theme install button
html
HTML anchor tags with embedded install buttons:
dark: Dark theme HTML button
light: Light theme HTML button
jsx
JSX-compatible HTML for React components:
dark: Dark theme JSX button
light: Light theme JSX button
Usage Notes
The config parameter in the deeplink contains a base64-encoded JSON configuration
All markup formats include proper URL encoding for compatibility
The function supports both dark and light theme variants for different UI contexts
Install buttons use Cursor's official badge images hosted at cursor.com/deeplink/
Implementation Details
The function creates a Cursor deeplink following the format:
`
cursor://anysphere.cursor-deeplink/mcp/install?name={SERVERNAME}&config={BASE64CONFIG}
`
Where {BASE64_CONFIG} is a base64-encoded JSON object containing:
`json
{
"type": "{server_type}",
"url": "{mcpserverurl}"
}
`
Function Documentation: HubSpot → List Contacts
Overview
This function retrieves a list of contacts from HubSpot. It involves setting environment variables, preparing the request with optional parameters, and handling the response from the HubSpot API.
Inputs
hubspotapikey (registry|text) Required Sensitive data
Description: The API key for your HubSpot account.
after (integer)
Description: The paging cursor to get the next set of contacts.
properties (text[])
Description: A list of contact properties to retrieve.
Function Stack
HubSpot API Request
API Request to https://api.hubapi.com/crm/v3/objects/contacts
Purpose: Sends a GET request to retrieve contacts from HubSpot.
Parameters: Includes archived=false, optional after cursor, and specified properties.
Preconditions
Precondition: hubspot_api.response.status == 200
Purpose: Ensures successful retrieval of contacts with HTTP status code 200.
Response
The function returns the result from the HubSpot API response.
Success response
`json
{
"results": [
{
"id": "123456789",
"properties": {
"createdate": "2024-09-12T11:36:05.267Z",
"hsmarketablestatus": "false",
"hsobjectid": "123456789",
"lastmodifieddate": "2024-09-12T11:36:22.982Z"
},
"createdAt": "2024-09-12T11:36:05.267Z",
"updatedAt": "2024-09-12T11:36:22.982Z",
"archived": false
},
.
.
.
],
"paging": {
"next": {
"after": "123456789",
"link": "https://api.hubapi.com/crm/v3/objects/contacts/?archived=false&after=123456789&properties=hsmarketablestatus"
}
}
}
`
Error response
`json
{
"message": "Uh oh! Hubspot returned with an error: Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview"
}
`
Example
Input
`json
{
"after": 0,
"properties": [
"hsmarketablestatus"
]
}
`
Output
`json
{
"results": [
{
"id": "12345",
"properties": {
"createdate": "2024-09-12T11:36:05.267Z",
"hsmarketablestatus": "false",
"hsobjectid": "57309372733",
"lastmodifieddate": "2024-09-12T11:36:22.982Z"
},
"createdAt": "2024-09-12T11:36:05.267Z",
"updatedAt": "2024-09-12T11:36:22.982Z",
"archived": false
},
.
.
.
],
"paging": {
"next": {
"after": "1234",
"link": "https://api.hubapi.com/crm/v3/objects/contacts/?archived=false&after=12345&properties=hsmarketablestatus"
}
}
}
`
Function Documentation: OpenAI -> Summarize (Simple)
OpenAI Vision API;
Overview
This function summarizes a piece of text using the OpenAI API. It requires an input text and returns a summary of that text.
Inputs
openaiapikey (registry | text) Required
Description: The API key required to access the OpenAI API for processing the input text.
input_text (text) Required
Description: The text that needs to be summarized.
model (enum) Optional
Description: Specifies the model to be used for generating the summary.
Options:
gpt-4o-mini (default)
gpt-4o
gpt-4o-turbo
Function Stack
OpenAI API Request
API Request to https://api.openai.com/v1/chat/completions
Purpose: Sends a request to the OpenAI API to summarize the input text.
Precondition: API Request Success
Precondition: openai_api.response.status == 200
Purpose: Ensures that the API request was successful (HTTP status code 200).
OpenAI API Response Content
Create Variable: response
Purpose: Stores the summary response content from the OpenAI API, retrieved from the result.
Response
The function returns a summary of the provided input text.
Success response
`json
{
"summary": "A brief and concise explanation of the input text."
}
`
Error response
`json
{
"error": {
"message": "API key is missing or invalid."
}
}
`
Example
Input
`json
{
"openaiapikey": "sk-xxxxxx",
"input_text": "Artificial Intelligence has transformed many industries...",
"model": "gpt-4"
}
`
Output
`json
{
"summary": "AI has greatly impacted various industries through automation and efficiency."
}
`
Measures the asymmetry of a data set’s distribution around its mean.
Postmark → Send Single Email
Overview
This function allows you to send a single email using the Postmark API. It requires parameters such as the sender email address, recipient email address, subject, body (in either HTML or plain text format), and optionally a template ID.
Inputs
postmarkbaseurl (registry|text) Required
Description: The base url for calling the Postmark API (e.g., "https://api.postmarkapp.com/").
postmarkservertoken (registry|text) Required Sensitive data
Description: This is the Postmark Server API Token (e.g., "14g8dce4-7054-47c9-a18a-2107e5cf4e41"). This is needed for authentication on endpoints.
from_email (text) Required
Description: The email address of the sender.
Example: noreply@yourdomain.com
to_email (text) Required
Description: The email address of the recipient.
Example: user@example.com
subject (text) Required
Description: The subject line of the email.
Example: Welcome to Our Service
html_body (text) Optional
Description: The HTML content of the email message. If provided, it takes precedence over text_body.
Example: <h1>Hello, John!</h1><p>Thank you for signing up.</p>
text_body (text) Optional
Description: The plain text content of the email message. If provided and html_body is not, it will be used.
Example: Hello, John! Thank you for signing up.
Function Stack
Create Variable
Create Variable: api_url
Purpose: Constructs the API URL for sending single emails.
Create Variable
Create Variable: api_token
Purpose: Stores the Postmark API token.
Precondition Logic
Precondition: from_email should not exceed 255 characters.
Purpose: Ensures the sender email address is not too long.
Precondition: from_email is a valid email format.
Purpose: Ensures the sender email address is formatted correctly.
Precondition: to_email is a valid email format.
Purpose: Ensures recipient email address is formatted correctly.
Precondition: to_email should not exceed 50 email addresses.
Purpose: Limits the number of recipients to avoid batch size issues.
Precondition: Either textbody or htmlbody (or both) are provided.
Purpose: Ensures that at least one form of email content is available.
Precondition: html_body is a valid HTML format.
Purpose: Ensures that if HTML is provided, it is well-formed.
API Request
API Request to: https://api.postmarkapp.com/email
Purpose: Sends a POST request to the api_url with the following payload:
`json
{
"from_email": "noreply@yourdomain.com",
"to_email": "user@example.com",
"subject": "Welcome to Our Service",
"html_body": "<h1>Hello, John!</h1><p>Thank you for signing up.</p>", // Optional
"text_body": "Hello, John! Thank you for signing up." // Optional
}
`
Create Variable
Create Variable: postmark_response
Purpose: Stores the response from the Postmark API.
Create Variable
Create Variable: response
Purpose: Creates a response object containing the result from the Postmark API.
Conditional Check
Conditional: Checks if the response status is 200 and the error code is 0.
If True: Updates the response object to indicate success.
If False: Updates the response object to indicate an error.
Response
The function returns either a success message or an error message depending on the outcome.
Success Response
`json
{
"To": "user@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
}
`
Error Response
`json
{
"ErrorCode": 401,
"Message": "Unauthorized: Missing or incorrect API key."
}
`
Example
Input
`json
{
"from_email": "noreply@yourdomain.com",
"to_email": "user@example.com",
"subject": "Welcome to Our Service",
"html_body": "<h1>Hello, John!</h1><p>Thank you for signing up.</p>",
"text_body": "Hello, John! Thank you for signing up."
}
`
Output
`json
{
"To": "user@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
}
`
Function Documentation: Convert Api -> File Convert
Convert API documentation
Overview
This function stack handles file conversion using ConvertAPI. The function allows users to input a file URL, specify the fromformat, toformat, and file_url and returns the converted file's URL.
Inputs
convertapikey (registry/text) Required
Description: The API key used for authenticating the Convert API.
Example: xkeysib-...
from_format (enum) Required
Check Valid Format:
Description: The format to convert from (e.g., png, jpg, pdf, doc, xls, csv).
Example: pdf
to_format (enum) Required
Description: The format to convert to (e.g., png, jpg, pdf, doc, xls, csv).
Example: jpg
file_url (text) Required
Description: The URL of the file to be converted.
Example: https://example.com/sample.jpg
Function Stack
Try / Catch Block
Precondition: Checks File Format
Description: It checks from format should be same as to format.
API Request to https://v2.convertapi.com/convert/{fromformat}/to/{toformat}
Purpose: Converts the file from the fromformat to the toformat using the file URL.
Return Value: The API response is stored as api_response.
Create Variable: response
Variable: var: response = var: api_response.response.result
Purpose: Stores the API response for the convert api .
2 Error Handling (Catch)
Create Variable: response
Purpose: If the API call fails or returns an error, this block catches the error and provides an error message.
Response
The function returns the URL of the converted file from ConvertAPI, including success or error messages.
Success Response
`json
{
"ConversionCost": 1,
"Files": [
{
"FileName": "0266554465.pdf",
"FileExt": "pdf",
"FileSize": 63923,
"FileId": "wtj3krv14y87qzcoptgr9ytoj4a8evqx",
"Url": "https://v2.convertapi.com/d/wtj3krv14y87qzcoptgr9ytoj4a8evqx/0266554465.pdf"
}
]
}
`
Error Response
`json
{
"code": "invalid_parameter",
"message": "Unable to convert file. The provided file format is not supported."
}
`
Example
Input
`json
{
"from_format": "pdf",
"to_format": "jpg",
"file_url": "https://example.com/sample.pdf"
}
`
Output
`json
{
"ConversionCost": 1,
"Files": [
{
"FileName": "0266554465.pdf",
"FileExt": "pdf",
"FileSize": 63923,
"FileId": "wtj3krv14y87qzcoptgr9ytoj4a8evqx",
"Url": "https://v2.convertapi.com/d/wtj3krv14y87qzcoptgr9ytoj4a8evqx/0266554465.pdf"
}
]
}
`
Function Documentation: Postmark → Send Email with Template
Overview
This function allows you to send emails using the Postmark API with a pre-defined template. You can specify the recipient email address, the template ID, and the data to populate the template placeholders.
Inputs
postmarkbaseurl (registry|text) Required
Description: The base url for calling the Postmark API (e.g., "https://api.postmarkapp.com/").
postmarkservertoken (registry|text) Required Sensitive data
Description: This is the Postmark Server API Token (e.g., "14g8dce4-7054-47c9-a18a-2107e5cf4e41"). This is needed for authentication on endpoints.
from_email (text) Required
Description: The email address that will appear as the sender.
Example: noreply@yourdomain.com
to_emails (text) Required
Description: A list of email addresses to send the batch emails to.
Example: user1@example.com
template_id (integer) Required
Description: The ID of the Postmark template to use.
Example: 12345
template_model (json) Required
Description: The data to populate the template placeholders. The structure of this data depends on your specific Postmark template.
Example: Refer to Postmark documentation for template data structure.
Function Stack
Create Variable:
Create Variable: api_url
Purpose: Constructs the API URL for sending emails with templates.
Create Variable:
Create Variable: api_token
Purpose: Stores the Postmark API token.
Precondition:
Precondition: from_email should not exceed 255 characters.
Purpose: Ensures the sender email address is not too long.
Precondition: from_email is a valid email format.
Purpose: Ensures the sender email address is formatted correctly.
Precondition: to_email is a valid email format and allows comma-separated values.
Purpose: Ensures recipient email addresses are formatted correctly and the list is not too long.
Precondition: to_email should not exceed 50 email addresses.
Purpose: Limits the number of recipients per batch.
Postmask API Request:
API Request to: https://api.postmarkapp.com/email
Purpose: Sends a POST request to the api_url with the following payload:
`JSON
{
"from_email": "noreply@yourdomain.com",
"to_email": "user@example.com",
"template_id": 12345,
"template_model": {
"name": "John Doe",
"email": "john.doe@example.com"
}
}
`
Create Variable:
Create Variable: postmark_response
Purpose: Stores the response from the Postmark API.
Create Variable:
Create Variable: response
Purpose: Creates a response object with the result from the Postmark API.
Response
The function returns the result from the Postmark API response.
Success response
`json
{
"To": "user1@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
},
{
"To": "user2@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-2",
"ErrorCode": 0,
"Message": "OK"
}
`
Error response
`json
{
"ErrorCode": 401,
"Message": "Unauthorized: Missing or incorrect API key."
}
`
Example
Input
`json
{
"from_email": "noreply@yourdomain.com",
"to_email": "user@example.com",
"template_id": 12345,
"template_model": {
"name": "John Doe",
"email": "john.doe@example.com"
}
}
`
Output
`json
{
"To": "user@example.com",
"SubmittedAt": "2024-10-07T14:33:15.817Z",
"MessageID": "message-id-1",
"ErrorCode": 0,
"Message": "OK"
}
`
Function Documentation: Claude AI -> Ask a Question
Claude AI API documentation
Overview
This function sends a message request to the Claude AI API using the provided API key, prompt, and token limit. The function captures the response from the Claude API and returns it.
Inputs
claudeapikey (registry/text) Required
Description: The API key used to authenticate requests to the Claude AI API.
Example: claudeapiabc123
prompt (text) Required
Description: The prompt or message that you want to send to Claude AI as role user.
Example: What is the capital of France?
max_token (integer) Required
Description: The maximum number of tokens to be used for generating the response, Default - 1024.
Example: 1024
assistant_prompt (text) Optional
Description: The prompt or message that you want to send to Claude AI as role assistant. Default - As an enthusiastic assistant, provide clear and understandable responses.
Example: `As an enthusiastic assistant, provide clear and understandable responses
Function Stack
Try / Catch Block
Group: Claude API Request
API Request to https://api.anthropic.com/v1/messages
Purpose: Sends the prompt to the Claude AI API with the API key, prompt, assistant prompt, and token limit.
Return Value: The API response is stored as api_response.
Example:
` json
{
"model": "claude",
"message": [
{
"role": "user",
"content": "prompt"
},
{
"role": "assistant",
"content": "assistant_prompt"
}
]
}
`
Create Variable: response
Variable: var: response = var: api_response.response
Purpose: Stores the API response, including the message generated by Claude AI.
2 Error Handling (Catch)
Create Variable: response
Purpose: If the API call fails or returns an error, this block catches the error and provides an error message.
Response
The function returns the result of the Claude AI message generation, including the generated text.
Success Response
`json
{
"id": "msg_01H4x**",
"type": "message",
"role": "{role}",
"content": [
{
"type": "text",
"text": "Neural networks are a type of machine learning algorithm ..."
}
],
"model": "claude-3-opus-20240229",
"stopreason": "endturn",
"stop_sequence": null,
"usage": {
"input_tokens": 23,
"output_tokens": 219
}
}
`
Error Response
`json
{
"type": "error",
"error": {
"error": "authentication_error",
"message": "invalid x api key."
}
}
`
Example
Input
`json
{
"prompt": "{prompt}",
"maxtokens": "{maxtoken}",
"assistantprompt": "{assistantprompt}"
}
`
Output
`json
{
"id": "msg_01H4x**",
"type": "message",
"role": "{role}",
"content": [
{
"type": "text",
"text": "Neural networks are a type of machine learning algorithm ..."
}
],
"model": "claude-3-opus-20240229",
"stopreason": "endturn",
"stop_sequence": null,
"usage": {
"input_tokens": 23,
"output_tokens": 219
}
}
`
Function Documentation: HubSpot → Get Contact
Overview
This function retrieves a specific contact from HubSpot using the contact's ID. It involves setting environment variables, preparing the request, and handling the response from the HubSpot API.
Inputs
id (integer)
Description: The unique identifier of the contact to be retrieved.
properties (text[])
Description: A list of contact properties to retrieve.
Function Stack
HubSpot API Request
API Request to https://api.hubapi.com/crm/v3/objects/contacts/{id}
Purpose: Sends a GET request to retrieve the specified contact from HubSpot.
Preconditions
Precondition: hubspot_api.response.status == 200
Purpose: Ensures successful retrieval of the contact with HTTP status code 200.
Response
The function returns the result from the HubSpot API response.
Success response
`json
{
"id": "12345",
"properties": {
"company": "HubSpot",
"createdate": "2024-09-12T10:58:14.335Z",
"hsobjectid": "12345",
"lastmodifieddate": "2024-09-12T10:58:18.831Z"
},
"createdAt": "2024-09-12T10:58:14.335Z",
"updatedAt": "2024-09-12T10:58:18.831Z",
"archived": false
}
`
Error response
`json
{
"message": "Uh oh! Hubspot returned with an error: Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview"
}
`
Example
Input
`json
{
"id": 123456,
"properties": [
"company"
]
}
`
Output
`json
{
"id": "123456",
"properties": {
"company": "UC",
"createdate": "2024-09-23T13:30:40.386Z",
"hsobjectid": "60968500829",
"lastmodifieddate": "2024-09-23T13:31:43.044Z"
},
"createdAt": "2024-09-23T13:30:40.386Z",
"updatedAt": "2024-09-23T13:31:43.044Z",
"archived": false
}
`
The array paginator is a function that divides a large array into smaller chunks, allowing you to display only a specific portion (or “page”) of the array at a time. It takes in parameters like the number of items you want per page (per_page) and the current page (page), and returns a portion of the array corresponding to that page.
This is useful if you are working with Redis lists, need to break apart a large dataset into smaller chunks for loops and more.
In addition to the paginated items, it also calculates useful metadata, such as:
• The total number of items in the array.
• The total number of pages.
• The current page.
• The next page (if there is one).
• The previous page (if there is one).
This allows for easier navigation through large datasets by breaking them up into smaller, manageable “pages.”
This method is Find in array except that it returns the index of the first element predicate returns truthy for instead of the element itself.
Function Documentation: HubSpot → Create Contact
Overview
This function creates a new contact in HubSpot using specified input parameters. It involves setting environment variables, preparing the request, and handling the response.
Inputs
hubspotapikey (registry|text) Required Sensitive data
Description: The API key for your HubSpot account.
first_name (text)
Description: The first name of the contact.
last_name (text)
Description: The last name of the contact.
email (text)
Description: The email address of the contact.
company (text)
Description: The company associated with the contact.
lead_status (enum)
Description: The lead status of the contact.
Options:
NEW
OPEN
IN_PROGRESS
OPEN_DEAL
UNQUALIFIED
ATTEMPTEDTOCONTACT
CONNECTED
BAD_TIMING
contact_owner (integer)
Description: The owner of the contact.
phone_number (text)
Description: The phone number of the contact.
additional_properties (json)
Description: Additional properties in JSON format.
Schema:
`json
{
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
`
Function Stack
Set Properties Object
Create Variable: properties_object
Purpose: Sets properties object from input: additional_properties.
HubSpot API Request
API Request to https://api.hubapi.com/crm/v3/objects/contacts
Purpose: Sends a POST request to create a new contact in HubSpot.
Preconditions
Precondition: hubspot_api.response.status == 201
Purpose: Ensures successful creation of the contact with HTTP status code 201.
Response
The function returns the result from the HubSpot API response.
Success response
`json
{
"id": "12345678",
"properties": {
"company": "Xano",
.
.
.
},
"createdAt": "2024-09-23T13:26:23.352Z",
"updatedAt": "2024-09-23T13:26:23.352Z",
"archived": false
}
`
Error message
`json
{
"message":"Uh oh! Hubspot returned with an error: Property values were not valid: [{\"isValid\":false,\"message\":\"Property \\\"prop2\\\" does not exist\",\"error\":\"PROPERTYDOESNTEXIST\",\"name\":\"prop2\",\"localizedErrorMessage\":\"Property \\\"prop2\\\" does not exist\",\"portalId\":47373842},{\"isValid\":false,\"message\":\"Property \\\"prop1\\\" does not exist\",\"error\":\"PROPERTYDOESNTEXIST\",\"name\":\"prop1\",\"localizedErrorMessage\":\"Property \\\"prop1\\\" does not exist\",\"portalId\":47373842}]"
}
`
Example
Input
`json
{
"first_name": "Unico",
"last_name": "Connect",
"email": "imagine@xano.com",
"company": "UC",
"lead_status": "OPEN",
"contact_owner": 0,
"phone_number": "123456",
"customer_Id": 0,
"additional_properties":
{
"mobilephone":"123456"
}
}
`
Output
`json
{
"id": "123456789",
"properties": {
"company": "UC",
"createdate": "2024-09-23T13:30:40.386Z",
"email": "imagine@xano.com",
"firstname": "Unico",
"hsallcontact_vids": "60968500829",
"hscurrentlyenrolledinprospecting_agent": "false",
"hsemaildomain": "xano.com",
"hsiscontact": "true",
"hsisunworked": "true",
"hsleadstatus": "OPEN",
"hslifecyclestagelead_date": "2024-09-23T13:30:40.386Z",
"hsmarketablestatus": "false",
"hsmarketableuntil_renewal": "false",
"hsmembershiphasaccessedprivate_content": "0",
"hsobjectid": "60968500829",
"hsobjectsource": "INTEGRATION",
"hsobjectsource_id": "3898752",
"hsobjectsource_label": "INTEGRATION",
"hs_pipeline": "contacts-lifecycle-pipeline",
"hsregisteredmember": "0",
"hssearchablecalculatedmobilenumber": "123456",
"hssearchablecalculatedphonenumber": "123456",
"lastmodifieddate": "2024-09-23T13:30:40.386Z",
"lastname": "Connect",
"lifecyclestage": "lead",
"mobilephone": "123456",
"phone": "123456"
},
"createdAt": "2024-09-23T13:30:40.386Z",
"updatedAt": "2024-09-23T13:30:40.386Z",
"archived": false
}
`
Featured Packages
LeDash
LeDash is a powerful Xano package inspired by Lodash, bringing its robust utility functions to the Xano ecosystem.
LeDash ensures predictable data handling by safely managing unpredictable or missing objects. Instead of errors, it returns sensible defaults (e.g., empty arrays, objects, or strings) tailored to your expected type, streamlining development and boosting reliability. Statistics
Provides core statistical functions including moments, variance, regression, distribution shape (skewness, kurtosis), and common aggregates like mean, median, percentiles, and sums. Supports both biased and unbiased calculations where relevant, making it useful for exploratory data analysis and lightweight modeling. Notion
The Xano Notion Actions Package is a powerful collection of zero-dependency functions that bridge the gap between your Xano backend and Notion workspaces. Keep your documentation, databases, and workflows perfectly in sync with minimal effort.