Edge functions enables you to write event enrichment and transformation logic in Javascript outside your client codebase and deployed to applications over-the-air dynamically.
Edge Functions are in Private Alpha testing and available to select customers. To opt in, contact your Customer Success Manager and ensure that you have one of Segment's new Mobile SDKs (Swift or Kotlin) configured.
Config API | Public API |
---|---|
name |
Use the Source id (See note on names vs IDs in the migration guide) |
To migrate, replace any use of the Config API endpoints with the Segment Public API counterparts, using the field mappings in the table above.
Create EdgeFunctions for your Source given a valid upload URL for an Edge Functions bundle.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
{- "uploadURL": "<upload_url>"
}
{- "data": {
- "edgeFunctions": {
- "id": "4a502354-637c-4b5f-bd46-281f7c973fbd",
- "sourceId": "qQEHquLrjRDN9j1ByrChyn",
- "createdBy": "sgJDWk3K21k6LE3tLU9nRK",
- "createdAt": "2006-01-02T15:04:05.000Z",
- "version": 1
}
}
}
Disable Edge Functions for your Source.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.edgeFunctions.disableEdgeFunctions('qQEHquLrjRDN9j1ByrChyn')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "edgeFunctions": {
- "id": "cbc696ed-58ec-452b-9727-f396a95ed55a",
- "sourceId": "qQEHquLrjRDN9j1ByrChyn",
- "downloadURL": "",
- "createdBy": "sgJDWk3K21k6LE3tLU9nRK",
- "createdAt": "2006-01-02T15:04:05.000Z",
- "version": 2
}
}
}
Generate a temporary upload URL that can be used to upload an Edge Functions bundle.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.edgeFunctions.generateUploadURLForEdgeFunctions('qQEHquLrjRDN9j1ByrChyn')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "uploadURL": "<upload_url>"
}
}
Get the latest Edge Functions for your Source.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.edgeFunctions.getLatestFromEdgeFunctions('qQEHquLrjRDN9j1ByrChyn')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "edgeFunctions": {
- "id": "4a502354-637c-4b5f-bd46-281f7c973fbd",
- "sourceId": "qQEHquLrjRDN9j1ByrChyn",
- "createdBy": "sgJDWk3K21k6LE3tLU9nRK",
- "createdAt": "2006-01-02T15:04:05.000Z",
- "version": 1
}
}
}