Segmenter provides a simple way that allows customers to create segments with people from their own databases, CRM, ERP, etc.
How to create a segment ?
Send a request to this endpoint if you want to create a segment, you have the possibility to send it with people to associate them to the segment. In the body you can send it as "persons".
When you send the request with persons, it will save the persons in the database.
See the following example.
{
"name": "string",
"description": "string",
"broadcastMediumId": "string",
"segmentType":"string",
"TagId"; "string",
"filters": [],
"persons": [
{
"substitutionTags": [{"tag": "string","value": "string"}],
"externalId": "uuid",
"firstName": "string",
"lastName": "string",
"phone": "string",
"email": "string"
},
{
"externalId": "uuid",
"firstName": "string",
"lastName": "string",
"phoneNumber": "string",
"email": "string"
}
]
}
Substitution tags
Let's take a deeper look at the array of persons, as we can see inside persons you can also send substitutionTags which is an array of objects that accepts tag and value as properties. When sending the array of substitutionTags, it will save in the database the tags associated to the person. this is optional
"persons": [
{
"substitutionTags": [{"tag": "string","value": "string"}],
"externalId": "uuid",
"firstName": "string",
"lastName": "string",
"phone": "string",
"email": "string"
},
{
"externalId": "uuid",
"firstName": "string",
"lastName": "string",
"phoneNumber": "string",
"email": "string"
}
]
Authorization
In order to send the request you must send the authorization api key in the header.
x-api-key: "API_TOKEN"
Responses
When a request is successful you will receive the endpoint will return code 200 and the response will look something like this
{
"data": {
"id": "Id of the segment created",
"persons": [
{
"id": "Id of the person created",
"externalId": "External id of the person created",
"email": "email of the person created"
}
]
},
"errorMessage": ""
}
If your body has some error, the endpoint may return 400, in that case you must validate that the json you are sending does not contain any error.
{
"statusCode": 400,
"message": "Here the system will try to show you the line where the error occurs",
"error": "Bad Request"
}
If the system throws 401, you are facing an authorization error, in that case you must validate that the x-api-key that is passed through the header is the correct one.
{
"statusCode": 401,
"message": "Unauthorized"
}