You can do a lot of amazing things with Segment's API. Segment's API enables you to collect and connect customer data quickly and easily. With it, you can power your analytics, marketing, and data warehousing requirements, and improve your customer experience and performance.
The Segment API provides you with full control over your customer data, including file storage, ETL, data modeling, data enrichment and transformations, and data queries. With it, you can build powerful solutions that help you uncover useful customer insights in real-time. Here are a few examples of what you can do using the Segment API:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
segment: {
type: "app",
app: "segment",
}
},
async run({steps, $}) {
const data = {
"event": `PipedreamTestOrder`,
"anonymousId": `019mr8mf4r`,
}
return await axios($, {
method: "post",
url: `https://api.segment.io/v1/track`,
headers: {
"Content-Type": `application/json`,
},
auth: {
username: `${this.segment.$auth.write_key}`,
password: ``,
},
data,
})
},
})
identify 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 them (note requires userId or anonymousId). See the docs here
Segment uses API keys for authentication. When you connect your Segment account, Pipedream securely stores the keys so you can easily authenticate to Segment APIs in both code and no-code steps.
Segment's Config API is accessed programmatically using access tokens. Create access tokens via the Access Management page in your account: https://app.segment.com/{your-workspace-name}/settings/access-management
. See Authentication for more details.