### Get Custom Field by ID
Source: https://docs.zernio.com/custom-fields/update-custom-field.mdx
This example shows how to retrieve details of a specific custom field using its ID via a GET request.
```javascript
const fieldId = "your-field-id";
fetch(`/api/custom-fields/${fieldId}`)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error fetching custom field:", error));
```
--------------------------------
### Creating a New Project with Zernio CLI
Source: https://docs.zernio.com/cli.mdx
This snippet shows how to initialize a new project using the Zernio CLI. Ensure you are in the desired directory before running.
```bash
zernio new my-project
```
--------------------------------
### Fetch Reddit Feed with Python
Source: https://docs.zernio.com/reddit-search/get-reddit-feed.mdx
This Python example demonstrates how to fetch a Reddit feed using the `requests` library. Make sure to install it (`pip install requests`).
```python
import requests
url = "https://www.reddit.com/r/python/top.json?limit=10"
headers = {"User-agent": "your_app_name"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f"Error fetching Reddit feed: {response.status_code}")
```
--------------------------------
### Configuring Zernio CLI
Source: https://docs.zernio.com/cli.mdx
Example of how to configure the Zernio CLI, likely setting up authentication or environment variables.
```bash
zernio config set api_key YOUR_API_KEY
```
--------------------------------
### Get Instagram Media Insights (Stories)
Source: https://docs.zernio.com/instagram/get-instagram-story-insights.mdx
This example shows how to get insights for Instagram media, specifically focusing on stories. It requires the media ID and an access token.
```javascript
fetch(
`https://graph.facebook.com/v17.0/${mediaId}?fields=insights.metric(impressions,reach,exits,replies,taps_forward,taps_back)&access_token=${accessToken}`
).then(response => response.json()).then(data => console.log(data));
```
--------------------------------
### Basic CLI Command Example
Source: https://docs.zernio.com/cli.mdx
A simple example demonstrating a basic Zernio CLI command. This is a foundational command for interacting with the CLI.
```bash
zernio --version
```
--------------------------------
### Start a verification
Source: https://docs.zernio.com/google-business/update-google-business-services.mdx
Initiates the verification process for a Google Business listing.
```APIDOC
## POST /verification/start
### Description
Initiates the verification process for a Google Business listing.
### Method
POST
### Endpoint
/verification/start
```
--------------------------------
### Get WhatsApp Business Profile API Call
Source: https://docs.zernio.com/whatsapp/get-whatsapp-business-profile.mdx
This example demonstrates how to make a GET request to retrieve a WhatsApp Business Profile. Ensure you have the correct business account ID and access token.
```javascript
const axios = require('axios');
async function getWhatsAppBusinessProfile(businessAccountId, accessToken) {
try {
const response = await axios.get(`https://graph.facebook.com/v18.0/${businessAccountId}/whatsapp_business_profile`, {
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
return response.data;
} catch (error) {
console.error('Error fetching WhatsApp Business Profile:', error.response ? error.response.data : error.message);
throw error;
}
}
// Example usage:
// const businessAccountId = 'YOUR_BUSINESS_ACCOUNT_ID';
// const accessToken = 'YOUR_ACCESS_TOKEN';
// getWhatsAppBusinessProfile(businessAccountId, accessToken)
// .then(profile => console.log(profile))
// .catch(err => console.error(err));
```
--------------------------------
### Start a verification
Source: https://docs.zernio.com/google-business/list-google-business-place-actions.mdx
Initiates the verification process for a Google Business Place.
```APIDOC
## POST /verification/{placeId}/start
### Description
Starts the verification process for a Google Business Place.
### Method
POST
### Endpoint
/verification/{placeId}/start
### Parameters
#### Path Parameters
- **placeId** (string) - Required - The ID of the place.
```
--------------------------------
### List WhatsApp Calls
Source: https://docs.zernio.com/whatsapp-calling/list-whatsapp-calls.mdx
This example shows how to list WhatsApp calls. It uses a GET request to the /whatsapp/calls endpoint.
```javascript
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
fetch('https://api.zernio.com/whatsapp/calls', options)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
return response.json();
})
.then(data => {
console.log(data);
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
```
--------------------------------
### Start a verification
Source: https://docs.zernio.com/resources/integrations.mdx
Initiates a verification process. This is the starting point for verifying an entity using the available methods.
```APIDOC
## Start a verification
### Description
Initiates a verification process.
### Method
POST
### Endpoint
/verification/start
```
--------------------------------
### Get Tracking Tag Details
Source: https://docs.zernio.com/platforms/meta-ads/tracking-tags.mdx
Retrieves detailed information about a specific tracking tag (Meta Pixel), including its install code.
```APIDOC
## GET /tracking-tags/{id}
### Description
Returns the tracking tag (Meta Pixel) details, including its install code. This is useful for retrieving the pixel code after it has been created or if it was not available in the list view.
Meta only today (platform `metaads`); other platforms return 405.
### Method
GET
### Endpoint
/tracking-tags/{id}
### Path Parameters
- **id** (string) - Required - The unique identifier of the tracking tag (Meta Pixel).
### Response
#### Success Response (200)
- **id** (string) - The unique identifier for the tracking tag.
- **name** (string) - The name of the tracking tag.
- **accountId** (string) - The ad account ID associated with the tracking tag.
- **platform** (string) - The platform the tracking tag belongs to (e.g., `metaads`).
- **code** (string) - The JavaScript code snippet to install the pixel on a website.
- **installed** (boolean) - Indicates if the tracking tag is currently installed.
- **lastFiredTime** (string) - Timestamp of the last time the tracking tag fired.
#### Response Example
```json
{
"id": "123456789012345",
"name": "My Website Pixel",
"accountId": "act_1234567890",
"platform": "metaads",
"code": "\n\n",
"installed": true,
"lastFiredTime": "2023-10-27T10:00:00Z"
}
```
```
--------------------------------
### Send WhatsApp Message (Node.js)
Source: https://docs.zernio.com/whatsapp/send-whatsapp-conversion.mdx
Example of sending a WhatsApp message using Node.js. Ensure you have the necessary libraries installed and configured.
```javascript
const axios = require('axios');
async function sendWhatsAppMessage(to, message) {
const url = 'https://graph.facebook.com/v18.0/YOUR_PHONE_NUMBER_ID/messages';
const token = 'YOUR_ACCESS_TOKEN';
const data = {
messaging_product: 'whatsapp',
to: to,
type: 'text',
text: {
body: message
}
};
try {
const response = await axios.post(url, data, {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
console.log('Message sent successfully:', response.data);
return response.data;
} catch (error) {
console.error('Error sending message:', error.response ? error.response.data : error.message);
throw error;
}
}
// Example usage:
sendWhatsAppMessage('RECIPIENT_PHONE_NUMBER', 'Hello from WhatsApp API!');
```
--------------------------------
### Getting Help with Zernio CLI Commands
Source: https://docs.zernio.com/cli.mdx
How to access help documentation for specific Zernio CLI commands. Use this to understand command options and usage.
```bash
zernio --help
```
--------------------------------
### Send a Single SMS (Python)
Source: https://docs.zernio.com/sms/send-sms.mdx
This Python example demonstrates how to send a single SMS. Make sure the 'zernio-sms' library is installed.
```python
import zernio_sms
def send_single_sms():
try:
response = zernio_sms.send(
to='+1234567890',
from_='+1098765432',
body='Hello from Zernio!'
)
print('SMS sent successfully:', response)
except Exception as e:
print('Error sending SMS:', e)
send_single_sms()
```
--------------------------------
### Start a verification
Source: https://docs.zernio.com/account-settings/get-telegram-commands.mdx
Initiates a verification process.
```APIDOC
## POST /verification/start
### Description
Starts a verification process.
### Method
POST
### Endpoint
/verification/start
```
--------------------------------
### Start a verification
Source: https://docs.zernio.com/platforms/google-ads.mdx
Initiates the verification process for an entity or account.
```APIDOC
## POST /verification/start
### Description
Initiates the verification process for an entity or account.
### Method
POST
### Endpoint
/verification/start
```
--------------------------------
### GET /connect/list-pinterest-boards-for-selection
Source: https://docs.zernio.com/inbox-analytics/get-inbox-response-time.mdx
For headless flows, this endpoint returns a list of Pinterest boards that the user can post to. This is part of the Pinterest connection setup.
```APIDOC
## GET /connect/list-pinterest-boards-for-selection
### Description
For headless flows. Returns Pinterest boards the user can post to.
### Method
GET
### Endpoint
/connect/list-pinterest-boards-for-selection
### Parameters
#### Query Parameters
- **tempToken** (string) - Required - The temporary token obtained from the Pinterest OAuth flow.
### Response
#### Success Response (200)
- **boards** (array) - A list of Pinterest boards.
- **id** (string) - The unique identifier for the Pinterest board.
- **name** (string) - The name of the Pinterest board.
### Response Example
```json
{
"boards": [
{
"id": "board1",
"name": "My Awesome Board"
}
]
}
```
```
--------------------------------
### Get Organization Aggregate Analytics
Source: https://docs.zernio.com/analytics/get-linkedin-org-aggregate-analytics.mdx
This example demonstrates how to retrieve aggregate analytics for a LinkedIn organization. Replace `YOUR_ORGANIZATION_ID` with the actual ID of the organization you want to analyze.
```APIDOC
## GET /v1/analytics/organizations/{organizationId}/aggregate
### Description
Retrieves aggregate analytics for a specified LinkedIn organization.
### Method
GET
### Endpoint
/v1/analytics/organizations/{organizationId}/aggregate
### Parameters
#### Path Parameters
- **organizationId** (string) - Required - The unique identifier of the LinkedIn organization.
#### Query Parameters
- **startDate** (string) - Optional - The start date for the analytics data in YYYY-MM-DD format.
- **endDate** (string) - Optional - The end date for the analytics data in YYYY-MM-DD format.
- **timeGranularity** (string) - Optional - The granularity of the time data (e.g., DAILY, WEEKLY, MONTHLY).
### Response
#### Success Response (200)
- **data** (array) - An array of aggregate analytics objects.
- **date** (string) - The date for the aggregated data.
- **impressions** (integer) - The total number of impressions.
- **clicks** (integer) - The total number of clicks.
- **engagement** (integer) - The total number of engagements.
- **likes** (integer) - The total number of likes.
- **comments** (integer) - The total number of comments.
- **shares** (integer) - The total number of shares.
#### Response Example
```json
{
"data": [
{
"date": "2023-10-26",
"impressions": 15000,
"clicks": 300,
"engagement": 50,
"likes": 20,
"comments": 10,
"shares": 20
},
{
"date": "2023-10-27",
"impressions": 16500,
"clicks": 320,
"engagement": 55,
"likes": 22,
"comments": 13,
"shares": 20
}
]
}
```
```
--------------------------------
### Create Account
Source: https://docs.zernio.com/accounts/move-account-to-profile.mdx
Initiates the creation of a new account.
```APIDOC
## POST /accounts
### Description
Creates a new account.
### Method
POST
### Endpoint
/accounts
```
--------------------------------
### Get WhatsApp Call Permissions
Source: https://docs.zernio.com/whatsapp/create-whatsapp-dataset.mdx
Retrieves the permission status and available actions for a given WhatsApp user ID (wa_id), such as starting a call or requesting call permission.
```APIDOC
## GET /v1/whatsapp-calling/get-whatsapp-call-permissions
### Description
Checks and returns the permission state for a specific WhatsApp user (wa_id) regarding calling actions. This helps determine if consent is needed before initiating a call.
### Method
GET
### Endpoint
/v1/whatsapp-calling/get-whatsapp-call-permissions
### Query Parameters
- **wa_id** (string) - Required - The WhatsApp user ID.
### Response
#### Success Response (200)
- **permissions** (object) - The permission status and available actions.
- **can_start_call** (boolean) - Indicates if a call can be started.
- **can_send_permission_request** (boolean) - Indicates if a permission request can be sent.
- **available_actions** (array of strings) - A list of actions that are currently permitted.
#### Response Example
```json
{
"permissions": {
"can_start_call": true,
"can_send_permission_request": false,
"available_actions": ["start_call"]
}
}
```
```
--------------------------------
### Track Standard Event: StartTrial
Source: https://docs.zernio.com/platforms/meta-ads/tracking-tags.mdx
Use this code to track the 'StartTrial' event, indicating that a user has started a free trial of your product or service. This helps measure trial sign-ups.
```javascript
fbq('track', 'StartTrial', {
trial_name: 'Free Trial'
});
```
--------------------------------
### Telegram Bot API - Get Updates Example
Source: https://docs.zernio.com/platforms/telegram.mdx
Shows how to retrieve updates for your Telegram bot. This is crucial for receiving messages and other events from users. Long polling is used here.
```javascript
const token = "YOUR_BOT_TOKEN";
let offset = 0;
function getUpdates() {
fetch(`https://api.telegram.org/bot${token}/getUpdates?offset=${offset}`)
.then(response => response.json())
.then(data => {
if (data.result.length > 0) {
data.result.forEach(update => {
console.log('Received update:', update);
// Process the update (e.g., reply to a message)
offset = update.update_id + 1;
});
}
setTimeout(getUpdates, 1000); // Poll again after 1 second
})
.catch(error => {
console.error('Error getting updates:', error);
setTimeout(getUpdates, 5000); // Retry after 5 seconds on error
});
}
getUpdates();
```
--------------------------------
### Start Verification
Source: https://docs.zernio.com/google-business/create-google-business-place-action.mdx
Initiates the verification process for a Google Business Place using a chosen method. This is the first step in verifying a business.
```APIDOC
## POST /verification/start
### Description
Initiates the verification process for a Google Business Place using a chosen method.
### Method
POST
### Endpoint
/verification/start
#### Request Body
- **location_id** (string) - Required - The unique identifier of the location.
- **method** (string) - Required - The chosen verification method (e.g., 'POSTCARD', 'PHONE_CALL').
### Request Example
{
"location_id": "location123",
"method": "POSTCARD"
}
### Response
#### Success Response (200)
Indicates that the verification process has been started. No response body is typically returned.
#### Response Example
(No content)
```