### Run dittofeed-ee with Docker Compose
Source: https://docs.dittofeed.com/deployment/self-hosted/dittofeed-ee
Command to start dittofeed-ee services using a specific Docker Compose file. Assumes the .env file with necessary configurations is present in the root directory.
```bash
docker-compose -f docker-compose.ee.yaml up -d
```
--------------------------------
### Start Docker Compose and Run Dev Setup Script
Source: https://docs.dittofeed.com/contributing/running-locally
Initiates the Docker Compose services in detached mode and then executes the development setup script to build dashboard dependencies and run the bootstrap process.
```bash
docker compose up -d
# Builds all of the dashboard dependencies including those required by the
# bootstrap script, then runs bootstrap.
./dev-setup.sh
```
--------------------------------
### Helm Command to Install Admin CLI Chart
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-21-0
This Helm command installs or upgrades the `dittofeed-admin-cli` chart. It's a prerequisite for running database migrations within a Kubernetes environment.
```bash
helm upgrade --install dittofeed-admin-cli ./dittofeed/helm-charts/dittofeed-admin-cli
```
--------------------------------
### Install dittofeed Helm Chart
Source: https://docs.dittofeed.com/deployment/self-hosted/dittofeed-ee
Command to install the dittofeed Helm chart with a specified values file. This deploys dittofeed-ee along with its dependencies.
```bash
helm install dittofeed dittofeed/dittofeed --values values.yaml
```
--------------------------------
### Mintlify Configuration Example
Source: https://docs.dittofeed.com/contributing/updating-api-docs
An example of the `mint.json` configuration file used by Mintlify to organize documentation pages. It shows how to group API reference documentation and includes a placeholder for auto-generated pages.
```json
{
"group": "API Reference",
"pages": [
"api-reference/auto/content/get-apiadmincontenttemplates",
...
]
}
```
--------------------------------
### Embed DittoFeed Analysis Chart
Source: https://docs.dittofeed.com/embedded/getting-started
Embeds an analysis chart for time-series insights into messaging performance. Supports grouping, date range selection, and quick downloads. Requires a session token and child workspace ID.
```html
```
--------------------------------
### Install Web SDK using Yarn or NPM
Source: https://docs.dittofeed.com/integrations/sdks/web
Instructions for installing the Dittofeed Web SDK using either Yarn or NPM package managers. This is the first step to integrating the SDK into your web application.
```bash
# Using Yarn
yarn add @dittofeed/sdk-web
# Using NPM
npm install --save @dittofeed/sdk-web
```
--------------------------------
### Install Dittofeed Node.js SDK
Source: https://docs.dittofeed.com/integrations/sdks/node
Instructions for installing the Dittofeed Node.js SDK using either Yarn or NPM package managers.
```bash
# Using Yarn
yarn add @dittofeed/sdk-node
# Using NPM
npm install --save @dittofeed/sdk-node
```
--------------------------------
### Create Child Workspace with cURL
Source: https://docs.dittofeed.com/embedded/getting-started
This command creates a child workspace in Dittofeed using the Parent Admin API Key. It requires the API key and optionally accepts an external ID for associating with your system's entities. The response includes the child workspace's ID and write key.
```bash
curl -X PUT \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"name": "My Customer Business", "externalId": "1234567890", "workspaceId": ""}' \
https://app.dittofeed.com/api-l/admin/workspaces/child
```
--------------------------------
### Default Response Example
Source: https://docs.dittofeed.com/api-reference/auto/deliveries/get-apiadmindeliveries
Provides an example of the default response structure, including workspace ID, items, and cursors.
```APIDOC
## Default Response Example
### Description
An example illustrating the typical structure of a default API response, encompassing workspace details, a list of items, and pagination cursors.
### Example Structure
```json
{
"workspaceId": "",
"items": [
{
"status": "",
"variant": {
"type": "Sms",
"provider": {
"type": "Twilio",
"sid": ""
},
"to": "",
"body": ""
},
"sentAt": "",
"updatedAt": "",
"journeyId": "",
"broadcastId": "",
"userId": "1043",
"isAnonymous": true,
"originMessageId": "",
"triggeringMessageId": "",
"templateId": ""
}
],
"cursor": "",
"previousCursor": ""
}
```
### Required Properties
- `workspaceId`
- `items`
```
--------------------------------
### Embed Dittofeed Templates Table (HTML)
Source: https://docs.dittofeed.com/embedded/getting-started
This snippet demonstrates embedding the Dittofeed templates table into a webpage via an iframe. It requires a session token and child workspace ID, similar to the email editor. The table displays message templates for the specified workspace.
```html
```
--------------------------------
### Install React Native SDK using Yarn or NPM
Source: https://docs.dittofeed.com/integrations/sdks/react-native
Instructions for installing the @dittofeed/sdk-react-native package using either Yarn or NPM package managers. This is the first step before using the SDK in your React Native application.
```bash
# Using Yarn
yarn add @dittofeed/sdk-react-native
# Using NPM
npm install --save @dittofeed/sdk-react-native
```
--------------------------------
### Docker Compose Commands for Dittofeed Upgrade
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-23-0
These bash commands are used to manage the Dittofeed upgrade process using Docker Compose. They cover starting the admin-cli service, applying pre-upgrade scripts, upgrading the lite service, applying post-upgrade scripts, and stopping the admin-cli service.
```bash
docker compose --profile admin-cli -f docker-compose.lite.yaml up admin-cli -d
```
```bash
./scripts/admin-lite.sh upgrade-0-23-0-pre
```
```bash
docker compose -f docker-compose.lite.yaml up lite -d --force-recreate
```
```bash
./scripts/admin-lite.sh upgrade-0-23-0-post
```
```bash
docker compose --profile admin-cli -f docker-compose.lite.yaml stop admin-cli
```
--------------------------------
### Embed DittoFeed Segment Editor iframe
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML snippet embeds the DittoFeed Segment Editor into an application. It requires a SESSION_TOKEN, CHILD_WORKSPACE_ID, and SEGMENT_ID to be passed as URL parameters for proper functionality and authentication.
```html
```
--------------------------------
### Run Docs Locally with Mintlify
Source: https://docs.dittofeed.com/contributing/updating-api-docs
Navigates to the `packages/docs` directory and starts the Mintlify development server to preview the API documentation locally. This command is used after updating the OpenAPI spec and adding new endpoints.
```bash
cd packages/docs
mintlify dev
```
--------------------------------
### Embed DittoFeed Deliveries Table
Source: https://docs.dittofeed.com/embedded/getting-started
Embeds a table displaying message delivery statistics for a child workspace. Requires a session token and child workspace ID. This can be used to monitor sent emails and SMS.
```html
```
--------------------------------
### Embed DittoFeed Segments Table iframe
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML snippet embeds the DittoFeed Segments Table, allowing users to view, create, and archive segments. It requires a SESSION_TOKEN and CHILD_WORKSPACE_ID for authentication and to specify the target workspace.
```html
```
--------------------------------
### Initialize Dittofeed SDK in JavaScript
Source: https://docs.dittofeed.com/deployment/self-hosted/render
Initializes the Dittofeed SDK with a write key and the host URL for your Dittofeed instance. Ensure you replace the placeholder with your actual Render deployment URL.
```javascript
DittofeedSdk.init({
writeKey: '...',
host: 'https://PLACEHOLDER.onrender.com',
});
```
--------------------------------
### Kubernetes Helm Configuration for Dittofeed Upgrade
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-23-0
This section details Kubernetes upgrade steps using Helm. It includes setting the BOOTSTRAP environment variable in values.yaml, installing the admin-cli chart, and updating the appVersion or image tag.
```yaml
env:
- name: BOOTSTRAP
value: "false"
```
```yaml
appVersion: "v0.23.0"
```
```yaml
image:
tag: v0.21.0
```
```yaml
image:
tag: v0.23.0
```
--------------------------------
### Embed DittoFeed Broadcasts Table
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML snippet embeds the DittoFeed broadcasts table into an application. It requires a session token and a child workspace ID for authentication and identification. The embedded table allows users to manage broadcasts within their workspace.
```html
```
--------------------------------
### Bash Command to Run Upgrade Script
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-21-0
This command executes the `upgrade-0-21-0-pre` script, which handles the necessary PostgreSQL migrations and the creation of new ClickHouse tables and materialized views required for version v0.21.0.
```bash
./admin.sh upgrade-0-21-0-pre
```
--------------------------------
### Embed Journey Editor using iframe
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML snippet demonstrates how to embed the Dittofeed Journey Editor into your application using an iframe. It requires the session token, child workspace ID, and the specific journey ID to be passed as URL parameters.
```html
```
--------------------------------
### Embed Dittofeed Email Editor (HTML)
Source: https://docs.dittofeed.com/embedded/getting-started
This snippet shows how to embed the Dittofeed email editor into a webpage using an iframe. It requires a session token and child workspace ID for authentication and context. The iframe dynamically loads the email editor interface.
```html
```
--------------------------------
### Run Prisma Database Migrations
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-11-0
Shell script command to execute Prisma database migrations. This command should be run after starting the `admin-cli` service and before deploying the new Dittofeed version.
```bash
./scripts/admin-lite.sh prisma migrate deploy
```
--------------------------------
### Embed DittoFeed Broadcast Editor (HTML)
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML snippet embeds the DittoFeed broadcast editor into a webpage using an iframe. It requires a session token, workspace ID, and broadcast ID for authentication and functionality. The iframe is set to occupy the full width and height of its container.
```html
```
--------------------------------
### Create Session Token with cURL
Source: https://docs.dittofeed.com/embedded/getting-started
This cURL command generates a session token for embedding Dittofeed components. It requires the child workspace's write key and ID. The generated token is valid for 1 hour by default and is used to authenticate requests to Dittofeed components on the frontend.
```bash
curl -X POST \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"workspaceId": ""}' \
https://app.dittofeed.com/api-l/sessions
```
--------------------------------
### Test Customer Journey with Dittofeed SDK
Source: https://docs.dittofeed.com/introduction
Example demonstrating how to test customer journeys using the Dittofeed testing SDK. This snippet shows setting up a test environment, simulating user actions, and asserting message delivery. It utilizes time-traveling capabilities for testing event-driven logic.
```javascript
describe("When the bookmark button is clicked", () => {
let df: DittofeedTestEnv;
beforeEach(async () => {
df = await Dittofeed.setupTestEnv();
...
})
it("Emails the clicking user", async () => {
render()
fireEvent.click(screen.getByText(/bookmark/i))
// Using simulated time.
await df.sleep("1 week");
const messages = await df.fetchMessages();
expect(messages).toEqual([
expect.objectContaining({
to: "test@email.com",
type: "Email",
body: expect.stringContaining("https://app.com/user-1/bookmarks")
...
});
]);
});
});
```
--------------------------------
### Update Docker Compose Image Tag for DittoFeed Lite
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-19-0
Modifies the Docker Compose configuration to use the new DittoFeed Lite image tag. This ensures that the latest version of the DittoFeed Lite service is deployed. It assumes a standard Docker Compose setup for DittoFeed.
```yaml
services:
lite:
image: dittofeed/dittofeed-lite:${IMAGE_TAG:-v0.19.0}
```
--------------------------------
### Initialize and Use Web SDK Methods in TypeScript
Source: https://docs.dittofeed.com/integrations/sdks/web
Demonstrates how to initialize the Dittofeed SDK with a write key and use its core methods like identify, track, screen, subscribe, unsubscribe, and flush. This TypeScript code shows the primary API interactions.
```typescript
import { DittofeedSdk } from '@dittofeed/sdk-web';
// Initialize the sdk with a writeKey, which is used to identify your
// workspace. This key can be found at
// https://dittofeed.com/dashboard/settings
await DittofeedSdk.init({
writeKey: "Basic abcdefg...",
});
// Lets you tie a user to their actions and record traits about them. It
// includes a unique User ID and any optional traits you know about the
// user, like their email, name, and more.
DittofeedSdk.identify({
userId: "123",
traits: {
email: "john@email.com",
firstName: "John"
},
});
// The track call is how you record any actions your users perform,
along
// with any properties that describe the action.
DittofeedSdk.track({
userId: "123",
event: "Made Purchase",
properties: {
itemId: "abc",
},
});
// Lets you record whenever a user sees a screen, the mobile equivalent of
// page, in your mobile app, along with any properties about the screen.
DittofeedSdk.screen({
userId: "123",
name: "Recipe Screen",
properties: {
recipeType: "Soup",
},
});
// Lets you subscribe a user to a subscription group.
DittofeedSdk.subscribe({
userId: "123",
subscriptionGroupId: "23b5757f-15a5-4477-858f-a96913b2a3f1",
});
// Lets you unsubscribe a user from a subscription group.
DittofeedSdk.unsubscribe({
userId: "123",
subscriptionGroupId: "23b5757f-15a5-4477-858f-a96913b2a3f1",
});
// Ensures that asynchronously submitted events are flushed synchronously
// to Dittofeed's API.
await DittofeedSdk.flush();
```
--------------------------------
### Embed DittoFeed SMS Template Editor
Source: https://docs.dittofeed.com/embedded/getting-started
This HTML code embeds the DittoFeed SMS template editor. It requires a session token, a child workspace ID, and a specific template ID to load and edit an existing SMS template. This allows for seamless integration of template editing within other applications.
```html
```
--------------------------------
### Start Dittofeed Services with Docker Compose
Source: https://docs.dittofeed.com/deployment/self-hosted/docker-compose
This bash command initiates Dittofeed's services, including Postgres and Clickhouse, using a lite Docker Compose configuration. The `-d` flag ensures the services run in detached mode (in the background).
```bash
docker compose -f docker-compose.lite.yaml up -d
```
--------------------------------
### Start Admin CLI Service with Docker Compose
Source: https://docs.dittofeed.com/deployment/self-hosted/upgrade-guide/v0-12-0
This command starts the `admin-cli` service defined in your `docker-compose.lite.yaml` file. It uses the `--profile admin-cli` flag to enable the specific profile and `-d` for detached mode. This service is used to run upgrade scripts.
```bash
docker compose --profile admin-cli -f docker-compose.lite.yaml up admin-cli -d
```