### Installation Source: https://bentonow.com/docs/examples/golang Instructions on how to install the Bento Go SDK using Go Get. ```APIDOC ## Installation Install the Bento Go SDK in your project: ```go go get github.com/bentonow/bento-golang-sdk ``` ``` -------------------------------- ### Install Bento Go SDK Source: https://bentonow.com/docs/examples/golang Installs the Bento Go SDK using the Go Get command. This is the first step to integrating Bento into your Golang application. ```go go get github.com/bentonow/bento-golang-sdk ``` -------------------------------- ### Installation Source: https://bentonow.com/docs/examples/nodejs Instructions on how to install the Bento Node.js SDK using NPM, Yarn, or Bun. ```APIDOC ## Installation Install the Bento Node SDK in your project: ### Using NPM ``` npm install @bentonow/bento-node-sdk --save ``` ### Using Yarn ``` yarn add @bentonow/bento-node-sdk ``` ### Using Bun ``` bun add @bentonow/bento-node-sdk ``` ``` -------------------------------- ### Installation Source: https://bentonow.com/docs/examples/dotnet Instructions on how to install the Bento .Net SDK, either via NuGet Package Manager or manual file referencing. ```APIDOC ## Installation Download and extract the ZIP file containing the .Net SDK. You can install it using NuGet Package Manager or by manual installation. ### Manual Installation Add the following reference to your project file: ```xml path/to/extracted/zip/Bento.dll ``` ``` -------------------------------- ### Installation Source: https://bentonow.com/docs/examples/python Instructions on how to install the Bento Python SDK using pip. ```APIDOC ## Installation Install the Bento Python SDK in your project: ```bash pip install git+https://github.com/bentonow/bento-python-sdk.git ``` ``` -------------------------------- ### Installation Source: https://bentonow.com/docs/examples/php Install the Bento PHP SDK using Composer. ```APIDOC ## Installation Install the Bento PHP SDK in your project: ### Method Composer ### Endpoint N/A ### Request Example ```bash composer require bentonow/bento-php-sdk ``` ``` -------------------------------- ### Run Bento Install Artisan Command Source: https://bentonow.com/docs/examples/laravel Executes the `bento:install` Artisan command for a prompt-based setup of the Bento client. This command requires Laravel 10+ and PHP 8.1+ and will ask for your Bento API keys and Site UUID. ```bash php artisan bento:install ``` -------------------------------- ### Quick Auth Setup Source: https://bentonow.com/docs/quickstart This section provides instructions on how to generate the Base64 encoded credentials required for authenticating API requests. ```APIDOC ## Authentication ### Description Generate Base64 encoded credentials for API authentication. ### Method Command Line (using `echo` and `base64`) ### Command ```bash echo -n "YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY" | base64 ``` ### Output This command will output a Base64 encoded string which should be used in the `Authorization` header as `Basic `. ``` -------------------------------- ### CI/CD Integration Example (GitHub Actions) Source: https://bentonow.com/docs/integrations/cli An example configuration for a GitHub Actions workflow to import new subscribers. It sets up necessary environment variables for authentication and installs the Bento CLI before running the import command. ```yaml # GitHub Actions example - name: Import new subscribers env: BENTO_PUBLISHABLE_KEY: ${{ secrets.BENTO_PUBLISHABLE_KEY }} BENTO_SECRET_KEY: ${{ secrets.BENTO_SECRET_KEY }} BENTO_SITE_UUID: ${{ secrets.BENTO_SITE_UUID }} run: | npm install -g @bentonow/bento-cli bento subscribers import ./new-subscribers.csv --confirm ``` -------------------------------- ### Installation Source: https://bentonow.com/docs/examples/javascript Include the Bento tracking script in your HTML to initialize the SDK. Replace YOUR_SITE_UUID with your actual site identifier. ```APIDOC ## Installation Add the Bento tracking script to your website: ```html ``` **Note:** You can find your Site UUID in your Bento Account Settings. Replace `YOUR_SITE_UUID` with your actual Site UUID. ``` -------------------------------- ### Basic Bento Setup and Page View Tracking Source: https://bentonow.com/docs/examples/javascript Demonstrates the basic setup for the Bento SDK, making it available globally via `window.bento`. It includes automatically tracking page views upon script load and checking for pre-existing loaded instances. ```javascript // Wait for Bento to load window.addEventListener('bento:ready', function() { console.log('Bento is ready!') // Start tracking page views bento.view() }) // Or check if already loaded if (window.bento) { bento.view() } ``` -------------------------------- ### Install Bento Next.js SDK (npm) Source: https://bentonow.com/docs/examples/nextjs Installs the Bento Next.js SDK using npm for client-side analytics. For server-side capabilities, an additional package is required. ```bash npm install @bento-ai/next-sdk # For server-side integration capabilities, also install: npm install @bento-ai/node-sdk ``` -------------------------------- ### Install Bento Go SDK in Ruby Source: https://bentonow.com/docs/examples/ruby Installs the Bento Go SDK for your Ruby project. This is the first step to integrating Bento's email platform functionalities. ```ruby require 'bento' Bento.configure do |config| config.site_uuid = 'your_site_uuid' config.publishable_key = 'YOUR_PUBLISHABLE_KEY' config.secret_key = 'YOUR_SECRET_KEY' end ``` -------------------------------- ### Get All Tags from Bento API Source: https://bentonow.com/docs/examples/php This example illustrates how to fetch all tags managed by the Bento API. The `getTags()` method does not require any arguments. ```php $bento->V1->Tags->getTags(); ``` -------------------------------- ### Install Bento Python SDK Source: https://bentonow.com/docs/examples/python Installs the Bento Python SDK using pip. This is the first step to integrating Bento into your Python project. ```bash pip install git+https://github.com/bentonow/bento-python-sdk.git ``` -------------------------------- ### E-commerce Event Tracking Example Source: https://bentonow.com/docs/examples/nextjs Tracks e-commerce specific events such as product views, add-to-carts, and purchases. This example shows how to structure the data for these events. ```javascript // Example: Tracking a product view if (window.bento) { window.bento.track('product_viewed', { productId: 'sku123', name: 'Awesome T-Shirt', category: 'Apparel', price: 29.99, currency: 'USD' }); } // Example: Tracking add to cart // window.bento.track('add_to_cart', { // productId: 'sku123', // name: 'Awesome T-Shirt', // price: 29.99, // quantity: 1 // }); ``` -------------------------------- ### Create a New Subscriber Source: https://bentonow.com/docs/examples/python API endpoint and Python code example for creating a new subscriber. ```APIDOC ## Create a new subscriber ### Method POST ### Endpoint /v1/batch/subscribers ### Description Creates a new subscriber in the Bento platform. ### Request Body - **email** (string) - Required - The email address of the new subscriber. ### Request Example ```json { "email": "new@example.com" } ``` ### Response #### Success Response (200) Returns the created subscriber object. - **id** (string) - The unique identifier for the subscriber. - **email** (string) - The email address of the subscriber. ### Python SDK Usage ```python subscriber = bento.create_subscriber(email='new@example.com') print(f"New subscriber: {subscriber}") ``` ``` -------------------------------- ### Install Bento PHP SDK using Composer Source: https://bentonow.com/docs/examples/php This command installs the Bento PHP SDK using Composer, the dependency manager for PHP. Ensure Composer is installed in your project environment. ```bash composer require bentonow/bento-php-sdk ``` -------------------------------- ### Common Use Cases Source: https://bentonow.com/docs/examples/elixir Examples for tracking common user actions like logins. ```APIDOC ## POST /v1/batch/events ### Description Tracks a user login event, including details about the method and device used. ### Method POST ### Endpoint /v1/batch/events ### Parameters #### Request Body - **email** (string) - Required - The email address of the user. - **event_type** (string) - Required - Set to "$login". - **event_properties** (object) - Optional - Properties like "method" and "device". ### Request Example ```json { "email": "user@example.com", "event_type": "$login", "event_properties": { "method": "password", "device": "mobile" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### API Route Example (App Router) Source: https://bentonow.com/docs/examples/nextjs An example API route in Next.js 13+ (App Router) for server-side event tracking using the Bento Node.js SDK. ```typescript // app/api/track/route.ts import { NextResponse } from 'next/server'; import client from '../../../lib/bento'; // Adjust path as needed export async function POST(request: Request) { const { event, data, email } = await request.json(); try { await client.track(event, data, { email }); return NextResponse.json({ success: true }); } catch (error) { console.error('Bento tracking error:', error); return NextResponse.json({ success: false, error: 'Failed to track event' }, { status: 500 }); } } ``` -------------------------------- ### Common Event Tracking Examples with BentoNow JS Source: https://bentonow.com/docs/examples/javascript This section provides practical examples of tracking common e-commerce, content engagement, and feature usage events. It illustrates how to structure the data payload for each event type. ```javascript // E-commerce events bento.track('product_viewed', { product_id: 'abc123', category: 'electronics' }) bento.track('cart_updated', { items_count: 3, total_value: 299.99 }) bento.track('checkout_started', { cart_value: 299.99 }) // Content engagement bento.track('video_played', { video_id: 'intro_video', duration: 120 }) bento.track('article_read', { article_id: 'blog_post_1', read_time: 180 }) // Feature usage bento.track('feature_used', { feature: 'search', query: 'javascript' }) bento.track('download_started', { file_name: 'user_guide.pdf', file_size: '2MB' }) ``` -------------------------------- ### Track Event - Page View Source: https://bentonow.com/docs/examples/golang Example of how to track a simple page view event for a user. ```APIDOC ## Tracking Your First Event Events represent specific actions users take within your application. Tracking these actions provides valuable insights into user behavior patterns and engagement. ### Practical Example Track a simple page view: ```go // Track a simple page view events := []bento.EventData{ { Type: "$pageView", Email: "user@example.com", Details: map[string]interface{}{ "url": "/home", "title": "Home Page", }, }, } err := client.TrackEvent(ctx, events) if err != nil { // Handle error } ``` **Endpoint:** `/v1/batch/events` ``` -------------------------------- ### Install Bento Node SDK using NPM, Yarn, or Bun Source: https://bentonow.com/docs/examples/nodejs Install the Bento Node SDK in your project using your preferred package manager. This is the first step to integrating Bento's features into your Node.js application. ```bash npm install @bentonow/bento-node-sdk --save ``` ```bash yarn add @bentonow/bento-node-sdk ``` ```bash bun add @bentonow/bento-node-sdk ``` -------------------------------- ### Track a Simple Page View Event Source: https://bentonow.com/docs/examples/python API endpoint and Python code example for tracking a '$pageView' event. ```APIDOC ## Track a simple page view ### Method POST ### Endpoint /v1/batch/events ### Description Tracks a user's page view event, including the URL and title of the page. ### Request Body - **events** (array) - Required - A list of event objects to be batched. - **type** (string) - Required - The type of event, e.g., '$pageView'. - **email** (string) - Required - The email address of the user associated with the event. - **details** (object) - Optional - Additional details about the event. - **url** (string) - Required - The URL of the page viewed. - **title** (string) - Optional - The title of the page viewed. ### Request Example ```json [ { "type": "$pageView", "email": "user@example.com", "details": { "url": "/home", "title": "Home Page" } } ] ``` ### Response #### Success Response (200) Returns an empty object upon successful batch creation. ### Python SDK Usage ```python events = [ { 'type': '$pageView', 'email': 'user@example.com', 'details': { 'url': '/home', 'title': 'Home Page' } } ] bento.batch_create_events(events) ``` ``` -------------------------------- ### User Lifecycle Event Tracking Example Source: https://bentonow.com/docs/examples/nextjs Tracks events related to the user's journey, such as sign-up completion, feature adoption, or subscription changes. ```javascript // Example: Tracking user sign-up completion if (window.bento) { window.bento.track('signup_completed', { method: 'google', plan: 'free' }); } // Example: Tracking feature usage // window.bento.track('used_feature', { // featureName: 'dashboard_filter' // }); ``` -------------------------------- ### Get IP Geolocation with Bento API Source: https://bentonow.com/docs/examples/php This example illustrates how to retrieve geolocation information based on an IP address using the Bento API's experimental functionality. A parameters object is necessary for this operation. ```php $bento->V1->Experimental->geolocate($parameters); ``` -------------------------------- ### Basic Setup Source: https://bentonow.com/docs/examples/javascript After the script loads, the Bento SDK is accessible via the global `window.bento` object. The SDK automatically handles visitor ID generation, initial page view tracking, and session management. ```APIDOC ## Basic Setup Once the script loads, Bento is automatically available via the global `window.bento` object: ```javascript // Wait for Bento to load window.addEventListener('bento:ready', function() { console.log('Bento is ready!'); // Start tracking page views bento.view(); }); // Or check if already loaded if (window.bento) { bento.view(); } ``` The SDK automatically: * Generates unique visitor and visit IDs * Tracks the initial page view * Handles visitor session management ``` -------------------------------- ### Get Tags Source: https://bentonow.com/docs/examples/python Retrieves a list of all available tags. ```APIDOC ## GET /v1/tags ### Description Retrieves a list of all tags currently in use. ### Method GET ### Endpoint /v1/tags ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **tags** (array) - A list of tag objects. #### Response Example ```json { "tags": [ { "id": "tag_abc", "name": "customer" } ] } ``` ``` -------------------------------- ### Generate Base64 Credentials for Bento API Source: https://bentonow.com/docs/quickstart This command generates the Base64 encoded credentials required for authenticating with the Bento API. It concatenates your Publishable Key and Secret Key with a colon and then encodes the result. ```bash echo -n "YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY" | base64 ``` -------------------------------- ### Client Configuration Source: https://bentonow.com/docs/examples/nodejs How to initialize the Bento client with your Site UUID, Publishable Key, and Secret Key. ```APIDOC ## Basic Setup To initialize the Bento client, you'll need your Site UUID, Publishable Key, and Secret Key from your Bento account. ```javascript const { Analytics } = require('@bentonow/bento-node-sdk'); // or using ES modules // import { Analytics } from '@bentonow/bento-node-sdk'; const bento = new Analytics({ authentication: { publishableKey: 'YOUR_PUBLISHABLE_KEY', secretKey: 'YOUR_SECRET_KEY', }, siteUuid: 'your_site_uuid', // Optional: Set to true for verbose error logging logErrors: false, }); ``` ``` -------------------------------- ### Get Fields Source: https://bentonow.com/docs/examples/python Retrieves a list of all available custom fields. ```APIDOC ## GET /v1/fields ### Description Retrieves a list of all custom fields configured for subscribers. ### Method GET ### Endpoint /v1/fields ### Parameters #### Query Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **fields** (array) - A list of field objects, each containing field details. #### Response Example ```json { "fields": [ { "id": "field_123", "key": "custom_field_name", "type": "string" } ] } ``` ``` -------------------------------- ### Client Configuration Source: https://bentonow.com/docs/examples/golang Details on how to initialize the Bento client with your Site UUID, Publishable Key, and Secret Key. ```APIDOC ## Basic Setup To initialize the Bento client, you'll need your Site UUID, Publishable Key, and Secret Key from your Bento account. You can find your keys in your Bento Team. To see your keys click `Your Private API Keys` Button and if you do not see a Publishable key and Secret Key, click on `Generate Key` to create a set. ```go import ( "time" bento "github.com/bentonow/bento-golang-sdk" ) // Initialize the Bento client config := &bento.Config{ PublishableKey: "YOUR_PUBLISHABLE_KEY", SecretKey: "YOUR_SECRET_KEY", SiteUUID: "your_site_uuid", Timeout: 10 * time.Second, // Optional, defaults to 10s } client, err := bento.NewClient(config) if err != nil { // Handle error } ``` ``` -------------------------------- ### API Route Example (Pages Router) Source: https://bentonow.com/docs/examples/nextjs An example API route in Next.js 12 (Pages Router) for handling subscriptions, potentially interacting with the Bento API. ```typescript // pages/api/subscribe.ts import type { NextApiRequest, NextApiResponse } from 'next'; import client from '../../lib/bento'; // Adjust path as needed type Data = { success: boolean; message?: string; }; export default async function handler( req: NextApiRequest, res: NextApiResponse ) { if (req.method === 'POST') { const { email, listId } = req.body; try { await client.subscribe(email, listId); res.status(200).json({ success: true, message: 'Successfully subscribed' }); } catch (error) { console.error('Bento subscription error:', error); res.status(500).json({ success: false, message: 'Failed to subscribe' }); } } else { res.setHeader('Allow', ['POST']); res.status(405).end(`Method ${req.method} Not Allowed`); } } ``` -------------------------------- ### Track Your First Event Source: https://bentonow.com/docs/quickstart This endpoint allows you to track events by sending a POST request to the batch events API. It requires your site UUID and authorization credentials. ```APIDOC ## POST /api/v1/batch/events ### Description Sends a batch of events to Bento for tracking. ### Method POST ### Endpoint `https://app.bentonow.com/api/v1/batch/events?site_uuid=YOUR_SITE_UUID` ### Parameters #### Query Parameters - **site_uuid** (string) - Required - The UUID of your Bento site. #### Request Body - **events** (array) - Required - An array of event objects. - **type** (string) - Required - The type of the event (e.g., `$custom.quickstart_test`). - **email** (string) - Required - The email address of the subscriber associated with the event. - **fields** (object) - Optional - Additional fields to associate with the event. - **first_name** (string) - Optional - The first name of the subscriber. - **source** (string) - Optional - The source of the event. ### Request Example ```json { "events": [ { "type": "$custom.quickstart_test", "email": "test@example.com", "fields": { "first_name": "Test", "source": "api_quickstart" } } ] } ``` ### Headers - **Authorization**: Basic YOUR_BASE64_CREDENTIALS - **User-Agent**: MyApp/1.0 (Required) - **Content-Type**: application/json ### Response #### Success Response (200) - **results** (integer) - The number of events successfully processed. - **failed** (integer) - The number of events that failed to process. #### Response Example ```json { "results": 1, "failed": 0 } ``` ``` -------------------------------- ### Create Subscriber Source: https://bentonow.com/docs/examples/golang Demonstrates how to create a new subscriber using the Bento SDK. ```APIDOC ## Managing Subscribers If you need to manage subscribers directly there are a set of convenience methods available to you. Add, update, and unsubscribe subscribers with these simple methods. ### Create a new subscriber ```go input := &bento.SubscriberInput{ Email: "new@example.com", } subscriber, err := client.CreateSubscriber(ctx, input) if err != nil { // Handle error } ``` **Endpoint:** `/v1/batch/subscribers` **Note:** While these methods are convenient, the recommended way to add a subscriber is via an `event` to trigger sequences and automations. ``` -------------------------------- ### Complete cURL Request Example Source: https://bentonow.com/docs/authentication A comprehensive example using cURL to make a GET request to the Bento API. It includes the necessary headers: 'Authorization', 'User-Agent', and 'Content-Type'. ```curl curl -X GET 'https://app.bentonow.com/api/v1/fetch/tags?site_uuid=YOUR_SITE_UUID' \ -H 'Authorization: Basic YOUR_BASE64_CREDENTIALS' \ -H 'User-Agent: MyApp/1.0' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Install Bento.js Tracking Script and Track Pageviews Source: https://bentonow.com/docs/web_analytics This snippet demonstrates how to install the Bento.js tracking script asynchronously and listen for the 'bento:ready' event to then fire a 'bento.view()' event for reliable pageview tracking. The 'Site Key' is a placeholder and should be replaced with your actual key. ```html ``` -------------------------------- ### Client Configuration Source: https://bentonow.com/docs/examples/python Details on how to initialize the Bento client with your Site UUID, Publishable Key, and Secret Key. ```APIDOC ## Basic Setup To initialize the Bento client, you'll need your Site UUID, Publishable Key, and Secret Key from your Bento account. ```python from bento_api import BentoAPI bento = BentoAPI( site_uuid='your_site_uuid', username='YOUR_PUBLISHABLE_KEY', password='YOUR_SECRET_KEY' ) ``` ``` -------------------------------- ### Install Laravel and Bento SDK Source: https://bentonow.com/docs/examples/laravel_setup Installs a new Laravel project and then adds the Bento Laravel SDK as a dependency. This is the first step to integrating Bento with your Laravel application. ```bash composer create-project laravel/laravel bento-example composer require bentonow/bento-laravel-sdk php artisan bento:install ``` -------------------------------- ### GET /v1/fetch/workflows Source: https://bentonow.com/docs/workflows_api Retrieves a list of all workflows in your account, including their associated email templates and performance statistics. This endpoint is useful for getting an overview of your automation setup. ```APIDOC ## GET /v1/fetch/workflows ### Description Returns a list of all workflows in your account, including their associated email templates and performance statistics. ### Method GET ### Endpoint /v1/fetch/workflows ### Parameters #### Query Parameters - **site_uuid** (string) - Required - Your site's unique identifier - **page** (integer) - Optional - Page number for pagination ### Request Example ```curl curl -L -u publishableKey:secretKey \ -X GET "https://app.bentonow.com/api/v1/fetch/workflows?site_uuid=your_site_uuid" \ -H "Accept: application/json" ``` ### Response #### Success Response (200) Returns a list of workflows with their email templates and stats. #### Response Example ```json { "data": [ { "id": "wf_123456789", "type": "workflow", "attributes": { "id": "wf_123456789", "name": "Onboarding Flow", "created_at": "2024-08-06T05:44:04.433Z", "email_templates": [ { "id": 1234, "subject": "Welcome aboard!", "stats": { "open_rate": 0.52, "click_rate": 0.15 } }, { "id": 1235, "subject": "Complete your profile", "stats": { "open_rate": 0.41, "click_rate": 0.09 } } ] } } ] } ``` ``` -------------------------------- ### Track First Event with cURL Source: https://bentonow.com/docs/quickstart This cURL command demonstrates how to track a custom event using the Bento Events API. It requires your site UUID and Base64 encoded credentials for authorization. Ensure the User-Agent header is included to avoid request blocking. ```bash curl -X POST 'https://app.bentonow.com/api/v1/batch/events?site_uuid=YOUR_SITE_UUID' \ -H 'Authorization: Basic YOUR_BASE64_CREDENTIALS' \ -H 'User-Agent: MyApp/1.0' \ -H 'Content-Type: application/json' \ -d '{ "events": [{ "type": "$custom.quickstart_test", "email": "test@example.com", "fields": { "first_name": "Test", "source": "api_quickstart" } }] }' ``` -------------------------------- ### Install Bento Laravel SDK using Composer Source: https://bentonow.com/docs/examples/laravel Installs the Bento Laravel SDK package into your project using Composer. This is the first step to integrating Bento with your Laravel application. ```bash composer require bentonow/bento-laravel-sdk ``` -------------------------------- ### Track Event - Form Submission Source: https://bentonow.com/docs/examples/golang Example of how to track a form submission event for a user. ```APIDOC ### Practical Example Track a form submission: ```go // Track a form submission events := []bento.EventData{ { Type: "$formSubmitted", Email: "user@example.com", Details: map[string]interface{}{ "formName": "Newsletter Signup", "source": "Homepage", }, }, } err := client.TrackEvent(ctx, events) if err != nil { // Handle error } ``` **Endpoint:** `/v1/batch/events` ``` -------------------------------- ### Bento Client Tracking Script Installation Source: https://bentonow.com/docs/integrations/sendowl This section provides the JavaScript code snippet for the Bento Client Tracking Script and guides on how to install it in your SendOwl account to track user activity on your website. ```APIDOC ## Bento Client Tracking Script Installation ### Description Install the Bento Client Tracking Script on your website to enable event tracking for your subscribers. This script should be placed in the global header of your SendOwl settings. ### Method **JavaScript** ### Endpoint **Not Applicable (Client-side script)** ### Parameters #### Path Parameters None #### Query Parameters - **sendowl** (boolean) - Optional - Set to `true` to indicate SendOwl integration. #### Request Body None ### Request Example ```html ``` ### Response #### Success Response (200) **Not Applicable (Client-side script)** #### Response Example **Not Applicable (Client-side script)** ``` -------------------------------- ### Track First Event with cURL using URL Shortcut Source: https://bentonow.com/docs/quickstart This cURL command tracks a custom event using the Bento Events API with credentials embedded directly in the URL. It simplifies the request by avoiding the need for a separate Authorization header. ```bash curl -X POST 'https://YOUR_PUBLISHABLE_KEY:YOUR_SECRET_KEY@app.bentonow.com/api/v1/batch/events?site_uuid=YOUR_SITE_UUID' \ -H 'User-Agent: MyApp/1.0' \ -H 'Content-Type: application/json' \ -d '{ "events": [{ "type": "$custom.quickstart_test", "email": "YOUR_EMAIL@example.com" }] }' ``` -------------------------------- ### Configure Bento Go Client Source: https://bentonow.com/docs/examples/golang Initializes the Bento client with necessary credentials like Site UUID, Publishable Key, and Secret Key. It also allows setting a custom timeout. ```go import ( "time" bento "github.com/bentonow/bento-golang-sdk" ) // Initialize the Bento client config := &bento.Config{ PublishableKey: "YOUR_PUBLISHABLE_KEY", SecretKey: "YOUR_SECRET_KEY", SiteUUID: "your_site_uuid", Timeout: 10 * time.Second, // Optional, defaults to 10s } client, err := bento.NewClient(config) if err != nil { // Handle error } ``` -------------------------------- ### Get Broadcast Name Source: https://bentonow.com/docs/liquid_guide Retrieves the name of the current broadcast. This tag is specific to the broadcast context. ```liquid {{ name }} ``` -------------------------------- ### Install and Verify Bento CLI Source: https://bentonow.com/docs/integrations/cli Installs the Bento CLI globally using npm or Bun and verifies the installation by checking the version. Requires Node.js 18 or later. ```bash npm install -g @bentonow/bento-cli bento --version ``` -------------------------------- ### Track a User Login Event Source: https://bentonow.com/docs/examples/python API endpoint and Python code example for tracking a '$login' event. ```APIDOC ## Tracking a user login "Event" ### Method POST ### Endpoint /v1/batch/events ### Description Tracks a user's login event, including the method and device used. ### Request Body - **events** (array) - Required - A list of event objects to be batched. - **type** (string) - Required - The type of event, e.g., '$login'. - **email** (string) - Required - The email address of the user associated with the event. - **details** (object) - Optional - Additional details about the event. - **method** (string) - Required - The login method used (e.g., 'password'). - **device** (string) - Optional - The device used for login (e.g., 'mobile'). ### Request Example ```json [ { "type": "$login", "email": "user@example.com", "details": { "method": "password", "device": "mobile" } } ] ``` ### Response #### Success Response (200) Returns an empty object upon successful batch creation. ### Python SDK Usage ```python events = [ { 'type': '$login', 'email': 'user@example.com', 'details': { 'method': 'password', 'device': 'mobile' } } ] bento.batch_create_events(events) ``` ``` -------------------------------- ### Client Configuration Source: https://bentonow.com/docs/examples/php Initialize the Bento client with your Site UUID, Publishable Key, and Secret Key. ```APIDOC ## Basic Setup To initialize the Bento client, you'll need your Site UUID, Publishable Key, and Secret Key from your Bento account. ### Method PHP ### Endpoint N/A ### Parameters #### Request Body - **authentication** (object) - Required - Authentication details. - **secretKey** (string) - Required - Your Bento Secret Key. - **publishableKey** (string) - Required - Your Bento Publishable Key. - **siteUuid** (string) - Required - Your Bento Site UUID. ### Request Example ```php [ 'secretKey' => 'YOUR_SECRET_KEY', 'publishableKey' => 'YOUR_PUBLISHABLE_KEY' ], 'siteUuid' => 'your_site_uuid' ]); ``` ``` -------------------------------- ### Track a Form Submission Event Source: https://bentonow.com/docs/examples/python API endpoint and Python code example for tracking a '$formSubmitted' event. ```APIDOC ## Track a form submission ### Method POST ### Endpoint /v1/batch/events ### Description Tracks a user's form submission event, including the form name and source. ### Request Body - **events** (array) - Required - A list of event objects to be batched. - **type** (string) - Required - The type of event, e.g., '$formSubmitted'. - **email** (string) - Required - The email address of the user associated with the event. - **details** (object) - Optional - Additional details about the event. - **formName** (string) - Required - The name of the form submitted. - **source** (string) - Optional - The source where the form was submitted. ### Request Example ```json [ { "type": "$formSubmitted", "email": "user@example.com", "details": { "formName": "Newsletter Signup", "source": "Homepage" } } ] ``` ### Response #### Success Response (200) Returns an empty object upon successful batch creation. ### Python SDK Usage ```python events = [ { 'type': '$formSubmitted', 'email': 'user@example.com', 'details': { 'formName': 'Newsletter Signup', 'source': 'Homepage' } } ] bento.batch_create_events(events) ``` ``` -------------------------------- ### Get Workflows JSON Response Example Source: https://bentonow.com/docs/workflows_api An example of the JSON response structure when fetching workflows. It includes details about each workflow, such as its ID, name, creation date, and associated email templates with their subjects and performance statistics. ```json { "data": [ { "id": "wf_123456789", "type": "workflow", "attributes": { "id": "wf_123456789", "name": "Onboarding Flow", "created_at": "2024-08-06T05:44:04.433Z", "email_templates": [ { "id": 1234, "subject": "Welcome aboard!", "stats": { "open_rate": 0.52, "click_rate": 0.15 } }, { "id": 1235, "subject": "Complete your profile", "stats": { "open_rate": 0.41, "click_rate": 0.09 } } ] } } ] } ``` -------------------------------- ### Script Installation Source: https://bentonow.com/docs/web_analytics Install the Bento.js tracking script on your website to enable analytics. This script loads asynchronously and can trigger events like 'bento:ready'. ```APIDOC ## Script Installation ### Description Install the Bento.js tracking script on your website to enable analytics. This script loads asynchronously and can trigger events like 'bento:ready'. ### Method ` ``` ``` -------------------------------- ### Client Configuration Source: https://bentonow.com/docs/examples/dotnet Guidance on setting up the Bento client in your .Net application using your Site UUID, Publishable Key, and Secret Key. ```APIDOC ## Basic Setup To initialize the Bento client, you'll need your Site UUID, Publishable Key, and Secret Key. These can be found in your Bento Team settings. ### Configuration in `appsettings.json` ```json { "Bento": { "PublishableKey": "your_publishable_key", "SecretKey": "your_secret_key", "SiteUuid": "your_site_uuid" } } ``` ### Service Registration (e.g., in `Program.cs` or `Startup.cs`) ```csharp using Bento; using Bento.Extensions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var services = new ServiceCollection(); services.AddBentoClient(configuration); // ... rest of your service configuration ``` ```