Upload Custom Segments to Mobile Suite
  • 23 Dec 2023
  • 1 Minute to read

    Upload Custom Segments to Mobile Suite


      Article Summary

      Overview

      This service enables you to upload custom segments via a CSV file to your Insider Mobile Suite. Once the uploading process is completed, the segment is automatically created on your mobile dashboard and you can see the results of the segment creation on the callback.

      Endpoint and Headers

      POST https://mobile.useinsider.com/api/custom_segment/v1/upload

      Headers

      HeaderSample ValueDescription
      Content-Typeapplication/jsonThis header specifies the media type of the source.

      Body Parameters

      HeaderDescriptionData Type
      api_keyYour API Key. Refer to API Authentication Tokens to get your API key.String
      segment_nameName of the custom segment. It must be a unique name.String
      csv_urlURL where CSV is hosted. This URL should be downloadable.String
      callback_urlCallback URL to receive the result of segment creationString
      attributeName of the user attribute on which the segment is being createdString

      Sample Example

      Sample Body

      {
          "api_key": "1a2b3c4d5e6f",
          "segment_name": "My unique segment",
          "csv_url": "https://s3.amazonaws.com/sample_csv_file.csv",
          "callback_url": "https://localhost/12345",
          "attribute": "email"
      }

      Sample API Responses

      202 Accepted

      The API request is a success. The results will be shown on the callback soon.

      400 Bad Request

      {
          "error": "Segment Name Exists."
      }

      401 Unauthorized

      {
          "error": "Bad Api Key."
      }

      405 Invalid Payload

      {
          "error": "Invalid Payload."
      }

      500 Internal Server Error

      There is an issue with your request format. The response message will indicate what the specific error is such as if our system couldn’t find the user, or a parameter is missing.

      Sample Callback Responses

      200 OK

      {
          "status": 200,
          "segment_name": "My unique segment",
          "matched_user_count": 5,
          "sent_user_count": 12
      }

      500 Internal Server Error

      There is an issue with your request format. The response message will indicate what the specific error is such as if our system couldn’t find the user, or a parameter is missing.

      Error Messages

      ErrorDescription
      Invalid CSV URLThe CSV URL is invalid. The URL should include .csv extension.
      Segment Name ExistsThe segment name in the request already exists on your panel. You should name your segment with a different name.
      Couldn't Read CSV FileInsider cannot access and download the CSV file. Be sure that the file is publicly accessible and downloadable.

      Was this article helpful?

      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses