Sending Canvas Messages via API Triggered Delivery
POST https://{{instance_url}}/canvas/trigger/send
API Triggered Delivery allows you to house message content inside of the Braze dashboard while dictating when a message is sent, and to whom via your API.
This endpoint allows you to send Canvas messages via API Triggered delivery, allowing you to decide what action should trigger the message to be sent. Please note that to send messages with this endpoint, you must have a Canvas ID, created when you build a Canvas.
Request Parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
canvas_id | Required | String | See canvas identifier |
canvas_entry_properties | Optional | Object | Personalization key value pairs that will apply to all users in this request |
broadcast | Optional | Boolean | See broadcast -- defaults to false on 8/31/17, must be set to true if recipientsis omitted |
audience | Optional | Connected audience object | See connected audience |
recipients | Optional | Array | If not provided and broadcast is not set to 'false', message will send to the entire segment targeted by the Canvas |
Request Components
- Canvas Identifier
- Broadcast
- Connected Audience
- Recipients
- Canvas Entry Properties
- User Alias Object
- User Attributes Object
- API Parameters
The recipients
array may contain up to 50 objects, with each object containing a single external_user_id
string and canvas_entry_properties
object.
Customers using the API for server-to-server calls may need to whitelist the appropriate API URL if they're behind a firewall.
If you include both specific users in your API call and a target segment in the dashboard, the message will send to specifically the user profiles that are in the API call and qualify for the segment filters.
Response Details
Message sending endpoint responses will include the message’s dispatch_id
for reference back to the dispatch of the message. The dispatch_id
is the id of the message dispatch (unique id for each ‘transmission’ sent from the Braze platform). For more information on dispatch_id
checkout out our documentation.
Create Send Endpoint
Using the Attributes Object in Canvas
Braze has a Messaging Object called Attributes
that allows you to add, create, or update attributes and values for a user before sending them an API Triggered Canvas using the canvas/trigger/send
endpoint as this API call will process the User Attributes object before it processes and sends the Canvas. This helps minimize the risk of there being issues caused by race conditions.
Request Body
{"canvas_id"=>"canvas_identifier", "canvas_entry_properties"=>{"product_name"=>"shoes", "product_price"=>79.99}, "broadcast"=>false, "audience"=>{"AND"=>[{"custom_attribute"=>{"custom_attribute_name"=>"eye_color", "comparison"=>"equals", "value"=>"blue"}}, {"custom_attribute"=>{"custom_attribute_name"=>"favorite_foods", "comparison"=>"includes_value", "value"=>"pizza"}}, {"OR"=>[{"custom_attribute"=>{"custom_attribute_name"=>"last_purchase_time", "comparison"=>"less_than_x_days_ago", "value"=>2}}, {"push_subscription_status"=>{"comparison"=>"is", "value"=>"opted_in"}}]}, {"email_subscription_status"=>{"comparison"=>"is_not", "value"=>"subscribed"}}, {"last_used_app"=>{"comparison"=>"after", "value"=>"2019-07-22T13:17:55+0000"}}]}, "recipients"=>{"user_alias"=>{"alias_name"=>"example_name", "alias_label"=>"example_label"}, "external_user_id"=>"user_identifier", "trigger_properties"=>"", "canvas_entry_properties"=>"", "send_to_existing_only"=>true, "attributes"=>{"first_name"=>"Alex"}}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Authorization | string |