Sending Push/In-App Messages

Jaroslav Bouška Jaroslav Bouška
5. September 2025

Sending PUSH/In-App messages from the Boldem app is done by creating a text message generated from a template and sending it to a predefined HTTP endpoint.
The message is sent via HTTP POST and its JSON payload can be defined using the templating system.

The final format of a generated PUSH message is text enriched with substituted variables, discount coupons, greetings, etc., just like an email. You can use all the features of working with variables and the templating system.

For an In-App message, basic HTML is generated that can be displayed to the user in the mobile app using the device’s default web browser. With this message type you can also use images hosted on the Boldem CDN, track link clicks, and track openings of individual messages via a tracking link. If you don’t want to transfer the full HTML, you can provide only a link to the web version of the message and have the app load that URL for the user.

In the JSON sent to the target API we can also replace user variables, e.g., the user ID from your system, for more efficient matching in your application.

You can also send custom message parameters to the API that will apply to all messages from the campaign — for example, a discount coupon and its expiration. These custom parameters are set at the campaign/automation level.

Sample API connector for a single message that uses user data to populate userId and, depending on the message type, either body (for a PUSH notification) or webViewUrl (for an In-App message).

{
   "messageId": {{message.messageId}},
   "appType": "PAS",
   "userId": "{{contact.user_ids}}",
    "type": "{{(message.messageSubType == 1 ? "IN_APP" : "PUSH")}}",
    "title": "{{message.title | string.strip_newlines}}",
    {{if(message.messageSubType == 2)}}
    "body": "{{message.content | string.strip_newlines}}",
    {{end}}
    {{if(message.messageSubType == 1)}}
    "webViewUrl": "{{webMailUrl}}",
    {{end}}
    "validity": "{{messageCustomHeaders?.validity}}",
    "showAlways": "{{messageCustomHeaders?.showAlways}}",
    "coupon": "{{messageCustomHeaders?.coupon}}",
    "campaignId": {{if message.automationId != null}}"AUTOMATION_{{message.automationId}}"{{else}}"AUTOMATION_{{ math.uuid }}"{{end}},
    "distributionId": {{if message.generatorExecutionId != null}}{{message.generatorExecutionId}}{{else if message.automationId != null}}"{{date.now | date.to_string '%y%m%d'}}"{{else}}"{{ math.uuid }}"{{end}}
    }

Messages can be sent to the API either individually or in batches, e.g., 20 at a time.

Example of generating the final batch of messages where we verify that each message has the userId filled in from the user data.

{{ func filterForItemsWithUserId(item)
    ret (item.userId != null && !(string.empty item.userId))
end }}
{
"items": {{items | array.filter @filterForItemsWithUserId  | printJson}}
}

Sample message model

{
  "messageId": 1,  
  "campaignId": 10,
  "generatorExecutionId": 15,
  "dataSourceId": 1,
  "guid": "4e19a13d-cab0-467b-8776-423eaee61f2b",
  "messageType": 5, // 5 - mass message type, 7 - transactional message type
  "messageSubType": 1,
  "to": "example@example.com",
  "isHtml": true,
  "contact": {
    "contactId": 123,
    "guid": "4e19a13d-cab0-467b-8776-423eaee61f2b",
    "email": "example@example.com",
    "mobilePhone": "555-555-5555",
    "name": "John",
    "surname": "Doe",
    "title": "Mr.",
    "street": "123 Main St",
    "city": "Anytown",
    "zip": "12345",
    "sex": 1,
    "company": "Acme Inc.",
    "myUserColumn": "your value",
    "favoriteBand": "Red Hot Chili Peppers",
  },
  "created": "2025-08-01T10:00:00Z",
  "title": "Welcome to our service",
  "content": "Hello John, use your code ABC to save today!",
  "templateId": 5,
  "customHeaders": [
    {
      "name": "X-Custom-Header",
      "value": "HeaderValue"
    }
  ],
  "automationId": null,
  "automationBlockId": null,
  "automationStateId": null,
  "tags": ["welcome", "promo"],
  "groupId": null,
  "trackOpens": true,
  "trackClicks": true
}

We can add custom HTTP headers to requests, e.g., for API key authorization.

You can use the connector to send both bulk and transactional messages, e.g., those generated by automation logic.

You can retroactively notify Boldem of message delivery using api.boldem.cz via the POST /v1/mass-message-delivery endpoint, where the JSON you send includes the message ID and the delivery date.