v1.0.0
OpenAPI 3.1.0

Send a transactional web push

US region

Client Libraries

Send a transactional web push

​

Send a transactional web push notification to a person's browsers. You send a message using a transactional_message_id for a transactional web push message that you created in the user interface, or with auto_create, a trigger name for a message that Customer.io creates on the first request. You can override some of the message's content at send time. The transactional_message_id can be either the numerical ID for the message or the Trigger Name that you assigned it. Learn more about transactional web push.

Until you generate web push keys in Workspace settings > Web push, requests return 400 with Web push is not set up for this workspace.

The message goes to the person's eligible browsers, and to chooses which of them receive it. If the message has a Website, only browsers that subscribed on that website are eligible. Browsers don't use the platform, sound, and custom_payload fields from the transactional push request, so this endpoint ignores them.

When auto_create creates a new message, the message has no text of its own, so include message in every request until you add text to the message in Customer.io. A request for a message with saved text can leave out message to use that text.

Limits: A request can be up to 500KB.

Body
application/json
  • identifiers
    required

    Identifies the person represented by your transactional message by one of, and only one of, id, email, or cio_id.

    Identifies the person represented by your transactional message by one of, and only one of, id, email, or cio_id.

    • id
      Type: string
      required

      The identifier for the person represented by the transactional message. NOTE: If your workspace identifies people by email, use the email identifier instead.

  • transactional_message_id
    required

    The transactional web push message that you want to send. You can call the message by its numerical ID or by the Trigger Name that you assigned to the message in the UI (case insensitive). The message must be a web push message.

    • Type: integer · ID (integer)

      The ID of the transactional message you want to send.

  • auto_create
    Type: boolean

    If true and your transactional_message_id doesn't match a message, Customer.io creates a web push message using that value as the Trigger Name. The ID must be a string. A new message sends to all of the person's eligible browsers until you change its Browsers (or To) setting.

  • custom_data
    Type: object | null

    Key-value pairs to deliver with the notification, which your website can read. This overrides the custom data of the transactional message. If you send null, Customer.io uses the message's own custom data.

  • custom_device
    Type: object

    A browser to add or update on the person's profile before the send. to still chooses which browsers receive the message, so set to to the same endpoint to send only to this browser.

  • disable_message_retention
    Type: boolean

    If true, the message body is not retained in delivery history. Setting this value overrides the value set in the settings of your transactional_message_id.

  • image_url
    Type: string

    The URL of an image to show in the notification. This overrides the image of the transactional message for this send.

  • language
    Type: string

    Overrides language preferences for the person you want to send your transactional message to. Use one of our supported two- or four-letter language codes.

  • Type: string

    The URL to open when the person clicks the notification. This overrides the link of the transactional message for this send.

  • message
    Type: string
    min length:  
    1

    The notification text. This replaces the text of the transactional message for this send, so it can't be blank or only spaces.

  • message_data
    Type: object

    An object containing the key-value pairs referenced using liquid in your message.

  • queue_draft
    Type: boolean

    If true, your transactional message is held as a draft in Customer.io and not sent directly to your audience. You must go to the Deliveries and Drafts page to send your message.

  • send_at
    Type: integer

    A unix timestamp (seconds since epoch) determining when the message will be sent. The timestamp can be up to 90 days in the future. If this value is in the past, your message is sent immediately.

  • send_to_unsubscribed
    Type: boolean

    If false, your message is not sent to unsubscribed recipients. Setting this value overrides the value set in the settings of your transactional_message_id.

  • title
    Type: string

    The notification title. This overrides the title of the transactional message for this send.

  • to
    Type: string

    Which of the person's eligible browsers receive the message, overriding the message's Browsers (or To) setting for this send. Use all for every eligible browser, last_used for the most recently used one, or a browser's subscription endpoint to send to that browser. If you leave it out, the send uses the message's setting. If the endpoint isn't one of the person's eligible browsers, the request still returns 200, and the delivery is undeliverable.

Responses
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/v1/send/web_push
{
  "identifiers": {
    "id": "user_123"
  },
  "transactional_message_id": "booking_confirmed",
  "link": "https://www.example.com/bookings/8812",
  "message": "Your room at the Harbor Hotel is ready for check-in on May 12.",
  "message_data": {
    "booking_id": "8812",
    "hotel_name": "Harbor Hotel"
  },
  "title": "Your booking is confirmed",
  "to": "last_used"
}
{
  "delivery_id": "string",
  "queued_at": 1,
  "send_at": 1
}