Fetch Messages

​

Fetches the list of rich messages available for a user

Apart from the API response mentioned here, the mobile client will have to fetch the style JSON directly from S3 (Amazon Cloud Storage), which defines how to render the rich message.

For details, see Style JSON for Rich Messages.

Headers

  • Set this header to application/json.

  • Advertises which content types the client is able to understand

  • Preferred language

  • The signature for the API call

  • Used to authorize the request with access_token. It should be supplied as Bearer ACCESS_TOKEN_GOES_HERE.

  • Used to identify the software, device, and application initiating the request, providing information about the client to the server. For details, see User Agent.

Body

application/json
  • OAuth client ID provided by the business

Responses

  • application/json
Request Example for get/api2/mobile/messages
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/mobile/messages \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'x-pch-digest: {{$$.env.signature}}' \
  --header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
  --header 'User-Agent: AppName/AppVersion/BuildNumber (OS; Model; MANUFACTURER; MODEL; OS Version)' \
  --data '{
  "client": "CLIENT_GOES_HERE"
}'
{
  "messages": [
    {
      "background_content": {
        "type": "image",
        "url": "IMAGE_URL",
        "alt_text": "Black Background Image",
        "initial_frame": ""
      },
      "body": "A new gastronomical experience awaits you as we launch the Double Hamburger. Juicy handmade patties treated with a gravy bath and accompanied by shredded lettuce, tomato, pickle, bulky chopped onion, mustard, and mayo.",
      "cta": [
        {
          "type": "external_web_link",
          "link": "https://punchh.com",
          "label": "More Details",
          "cta_type": "primary"
        },
        {
          "type": "external_web_link",
          "link": "https://punchh.com",
          "label": "Terms & Conditions",
          "cta_type": "secondary"
        }
      ],
      "dismissable": true,
      "hero_content": {
        "type": "image",
        "url": "IMAGE_URL",
        "alt_text": "Double Hamburger",
        "initial_frame": ""
      },
      "launch_time": "2017-08-14T06:00:00+00:00",
      "message_type": "business_wide",
      "rank": 500,
      "style_url": "URL_OF_THE_STYLE_SHEET",
      "subtitle": "Double the fun!",
      "tags": [
        "business_announcement",
        "menu_extension",
        "recurring"
      ],
      "take_down_time": "2017-08-15T06:00:00+00:00",
      "title": "Introducing Double Hamburger",
      "read_at": "2024-08-19T15:31:28-07:00",
      "created_at": "2024-08-19T15:30:27-07:00",
      "message_id": 7491710585,
      "deleted_at": "2024-08-20T15:30:27-07:00"
    }
  ]
}