Sending Campaign Messages via API Triggered Delivery
POST https://{{instance_url}}/campaigns/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.
The send endpoint allows you to send immediate, ad-hoc messages to designated users. If you are targeting a segment, a record of your request will be stored in the Developer Console. Please note that to send messages with this endpoint, you must have a Campaign ID, created when you build an API Triggered Campaign.
Request Parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
campaign_id | Required | String | See campaign identifier |
send_id | Optional | String | See send identifier |
trigger_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 campaign |
Request Components
- Campaign Identifier
- Broadcast
- Connected Audience
- Recipients
- 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 trigger_properties
object.
When send_to_existing_only
is true
, Braze will only send the message to existing users. When send_to_existing_only
is false
and a user with the given id
does not exist, Braze will create a user with that id and attributes before sending the message.
For more information on the broadcast
flag, check out Broadcast within our API Parameters documentation.
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).
Create Send Endpoint
Using the Attributes Object in Campaigns
Braze has a Messaging Object called Attributes
that will allow you to add, create, or update attributes and values for a user before you send them an API Triggered Campaigns using the campaign/trigger/send
endpoint as this API call will process the User Attributes object before it processes and sends the campaign. This helps minimize the risk of there being issues caused by race conditions.
Request Body
{"campaign_id"=>"campaign_identifier", "send_id"=>"send_identifier", "trigger_properties"=>"", "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"=>"external_user_identifier", "trigger_properties"=>"", "send_to_existing_only"=>true, "attributes"=>""}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Authorization | string |