1.0.35 • Published 2 years ago

segment-cdp-functions v1.0.35

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Segment CDP Functions (Beta)

Introduction

Welcome to the segment-cdp-functions NPM package. This tool is designed to bolster developers' capabilities, streamlining the creation, building, and deployment processes for Segment CDP Functions. With robust integration capabilities for Typescript, CI/CD patterns, and testing environments, our goal is to enhance the development lifecycle and ensure flawless compatibility with the Segment function environment.

Highlighted Features

  • Quick Setup: Instantly set up projects and pipelines for Segment CDP Functions.
  • Typescript Integration: Natively write and compile functions using Typescript.
  • RollupJS Bundling: Leverage rollupJS for efficient code bundling.
  • Segment Deployment Assistance: Hassle-free deployment of your bundled code to the Segment environment.
  • CI/CD & Testing: Easily integrate continuous integration and continuous delivery patterns, and test your functions seamlessly.

Precautions

  • Limited Functionality: Currently, only support for destination functions is available.
  • Library Limitations: To ensure function compatibility, please refrain from adding external libraries to your project. The Segment function environment might not recognize them, risking potential functional disruptions.
  • Accessible Methods: The code environment grants access to specific methods, including fetch(), atob(), and btoa().

Best Practices

  • Situate all your classes within the ./src directory.
  • For optimal functionality, incorporate and employ these classes within ./src/index.ts.

Workflow

Understanding the expectations of the Segment function environment is crucial. Typically, it anticipates a single NodeJS (NodeNext) compatible code. Traditional practices might not fit these parameters. That's where our package steps in:

  1. Setup: Embark on your journey by initializing a fresh project and integrating all essential dependencies.
  2. Development: Dive into a developer-centric environment with full-fledged Typescript support.
  3. Compilation: Rely on rollupJS combined with Typescript to curate a code bundle that's a perfect fit for the Segment environment.
  4. Deployment: Transfer the resulting bundle to the Segment environment, ensuring it integrates smoothly.

Quick Start Guide

Embark on your Segment CDP Functions journey with these simple steps:

  1. Launch your terminal.
  2. Install the package using npm i -g segment-cdp-functions.
  3. Create a project directory: mkdir <project-name>.
  4. Navigate to it: cd <project-name>.
  5. Initialize your project within the directory using: segment-cdp-functions init.
  6. Explore the available Segment API functions in ./src/index.ts.
  7. Check out the sample ./src/slack.ts which demonstrates sending Slack messages.
  8. Bundle your code using: npm run build. This produces a deployment-ready code bundle (./<build>/index.js) and a JSON file (./<build>/to_deploy.json).
  9. To deploy, acquire a segment token and save it in the .env file. Obtain this token from your Segment workspace by navigating: Settings > Workspace Settings > Access Management Tab > Tokens Tab > Create Token. Assign it a name and grant access as Workspace Member > Function Admin. Use this token in your .env as SEGMENT_TOKEN=<Token>.
  10. Deploy your function with: npm run deploy.

We wish you an effortless development journey with the segment-cdp-functions package. Should you have any questions or feedback, please reach out.

1.0.35

2 years ago

1.0.34

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago