Skip to main content

Add Subscriber to Segment

This endpoint allows adding a subscriber to a segment using the subscriber_hash. This call accepts form-encoded request bodies and returns responses in JSON format.

info

In some APIs, the term subscriber_hash is used. However, the same reference is called subscriber_id in the web SDK. As a result:

  • Web SDK: consistently uses subscriber_id.
  • API: opts for subscriber_hash.
POST
 https://api.pushengage.com/apiv1/segments/addSegmentWithHash

Request Parameters

Parameter NameTypeRequiredDescription
segment_idNumberYesThe unique identifier generated when a segment is created.
subscriber_hashString[]YesAn array of unique hashes to identify subscribers. The maximum array size is 500.

Response Object

Property NameTypeRequiredDescription
successBooleanYesIndicates whether the push response was successful. Acceptable values are true or false.
messageStringYesConveys the reason for the result, be it success or failure.

Example

Request

curl -X POST -H "api_key: <your_pushengage_api_key>" -H "Content-Type: application/x-www-form-urlencoded" -d 'segment_id=<Segment Id>&subscriber_hash[0]=<subscriber_hash>&subscriber_hash[1]=<subscriber_hash>' "https://api.pushengage.com/apiv1/segments/addSegmentWithHash"

Response

{
"message": "Segment Addition to Subscriber Hashes is Successful",
"success": true
}