Segmenter provides a simple way that allows customers to updates segments with people from their own databases, CRM, ERP, etc.
How to update a segment ?
Send a request to this endpoint if you want to update 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 update the persons in the database.
Note:
If you send the array of the persons empty, it will delete the persons associated to the segment.
See the following example:
{
"id": "Replace with the id of the segment",
"name": "replace with the name of the segment",
"description": "replace with description",
"broadcastMediumId": "replace with broadcast medium Id",
"segmentType": "replace with segment type",
"persons": [
{
"substitutionTags": [
{
"tag": "replace with name of the tag",
"value": "replace with value of the tag"
}
],
"externalId": "replace with uuid",
"firstName": "replace with first name",
"lastName": "replace with last name",
"phone": "replace with phone number",
"email": "replace with email"
}
]
}
Remove people from the segment
Be careful removing people from a segment
If you want to remove people from a segment or remove all people, in the PUT method you can send the empty array of people or with the people you want to leave in the segment, this will remove the people you had before in the segment and replace them with the ones you send, so you must be very careful in this part.
{
"id": "Replace with the id of the segment",
"name": "replace with the name of the segment",
"description": "replace with description",
"broadcastMediumId": "replace with broadcast medium Id",
"segmentType":"replace with segment type",
"persons": []
}
You can edit the substitution tags of a persons
If you send the substitution tags in the person, this will update the tags associated to the person, you can add more tags o edit the values of the tags.
{
"id": "Replace with the id of the segment",
"name": "replace with the name of the segment",
"description": "replace with description",
"broadcastMediumId": "replace with broadcast medium Id",
"segmentType": "replace with segment type",
"persons": [
{
"substitutionTags": [
{
"tag": "replace with name of the tag",
"value": "replace with value of the tag"
}
],
"externalId": "replace with uuid",
"firstName": "replace with first name",
"lastName": "replace with last name",
"phone": "replace with phone number",
"email": "replace with email"
}
]
}
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": {
"isUpdated": true
},
"errorMessage": ""
}
When the response is unsuccessful, it will show that it has not been updated, i.e. false, and will display an error message in the payload.
{
"success": false,
"message": "Internal Server Error",
"error": "Internal Server Error"
}