/rules

Creates a rule. A new rule has no actions: add them with POST /v1/rules/{id}/actions, for example a webhook. Create it with isPaused: true if you want to add its actions before it starts running.

Triggers

  • event runs the rule each time eventName happens for you. Common events: message:sent, message:received, opened, clicked, downloaded, replied, unsubscribe:created, meetinginvites:confirmed, meetinginvites:canceled, sequencerecipients:added, sequencerecipients:exited, call:started, call:completed, poll:voted, qa:submit, reminder:triggered, mixmaxtasks:created, mixmaxtasks:completed. call:recording-available is managed under Settings > API and is refused here.
  • recurring runs the rule on a schedule given as an RFC 5545 rrule, such as FREQ=WEEKLY;BYDAY=MO;BYHOUR=9.
  • webhook runs the rule each time something posts JSON to https://gateway.mixmax.com/ir/USERID/{webhookId}, where USERID is your _id and webhookId is an id you choose. transforms maps the posted body into the fields the filter and actions see.
  • salesforceDateInterval runs the rule some days before or after a date field on Salesforce records. It is easiest to set up in the Mixmax app.

The easiest way to see the exact event names and fields is to build a rule in the Mixmax app under Rules and read it back with GET /v1/rules.

Filter

filter decides which events run the rule. It is a JSON-encoded string, not an object. Mixmax checks it against each event's fields when the event happens; it never queries a database. It uses MongoDB's query syntax: field equality, $eq, $ne, $in, $nin, $gt, $gte, $lt, $lte, $exists, $regex with $options, $and, $or and $not. Leave it out to run the rule on every event. Passing an object instead of a string fails with 400.

Mixmax adds these operators:

  • $timeOfDay matches a date between two whole hours in a timezone, for example {"sent": {"$timeOfDay": {"timezone": "America/Los_Angeles", "start": 9, "end": 17}}}. end can be earlier than start to wrap past midnight.
  • $dayOfWeek matches a date on certain days of the week, for example {"sent": {"$dayOfWeek": {"timezone": "America/Los_Angeles", "days": [1, 2, 3, 4, 5]}}}, where 0 is Sunday.
  • $withinTimeRange matches a date within days, hours or minutes of now. Negative values look into the past. Add "inverse": true to match dates outside the range.
  • $anyRecipient matches against the to, cc and bcc addresses at once, for example {"$anyRecipient": {"$regex": "@example\\.com$", "$options": "i"}}.
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
trigger
required

What runs the rule.

string

A JSON-encoded string. An object fails with 400.

boolean
Responses

403

trigger.eventName is call:recording-available, which is managed under Settings > API.

Language
Credentials
Header
LoadingLoading…
Response
Choose an example:
application/json
Psst... like working with APIs? Come join us!