{"__v":0,"_id":"5840b34bc6c9322300273ff9","category":{"__v":0,"_id":"57f53fb368a53b2000e03f0f","project":"5588b8a2f6c18d0d005bba03","version":"5588b8a2f6c18d0d005bba06","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-10-05T18:00:19.547Z","from_sync":false,"order":0,"slug":"api","title":"REST API"},"parentDoc":null,"project":"5588b8a2f6c18d0d005bba03","user":"5588b847f6c18d0d005bba01","version":{"__v":14,"_id":"5588b8a2f6c18d0d005bba06","project":"5588b8a2f6c18d0d005bba03","createdAt":"2015-06-23T01:38:42.696Z","releaseDate":"2015-06-23T01:38:42.696Z","categories":["5588b8a3f6c18d0d005bba07","5588e9689cfea70d00371df3","5588f5921163180d00b64704","561598b121e9110d0078025a","5616f1c9d170d00d00189306","5616f5c3a410c90d00c6121e","561803dcf8c9632100ac7592","563667280441020d0000e9eb","5642570d9417b40d00c0fcd3","57bf5f02efe0050e00d50bd5","57f53fb368a53b2000e03f0f","57f55187440418170086325a","582e3afa72fd270f0006926d","5841faa973967b0f004b4a2b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-01T23:33:31.475Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl --header \"X-API-Token: <your token>\" https://api.mixmax.com/v1/rules","language":"curl"}]},"method":"get","results":{"codes":[]},"settings":"","auth":"required","params":[],"url":"/v1/rules"},"isReference":true,"order":52,"body":"Rules intercept a Mixmax event in realtime, evaluate a filter conditions on the event, and performs an action. For example, if you wanted to intercept incoming emails to *sales:::at:::yourcompany.com* and route them to Slack, you could create the rule:\n\n```\n{\n  eventName: \"message:sent\",\n  filter:  {\"to.email\": \"sales@yourcompany.com\" },\n  action: { type: \"sendToSlack\", webhookUrl: \"https://api.slack.com/...\"}\n}\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response format\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"_id\",\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-1\": \"*String*\",\n    \"0-2\": \"Unique ID\",\n    \"1-0\": \"userId\",\n    \"1-1\": \"*String*\",\n    \"1-2\": \"Your user id\",\n    \"2-0\": \"createdAt\",\n    \"2-1\": \"*Date*\",\n    \"2-2\": \"Date it was created\",\n    \"3-0\": \"modifiedAt\",\n    \"3-1\": \"*Date*\",\n    \"3-2\": \"Date it was last modified\",\n    \"4-0\": \"name\",\n    \"4-1\": \"*String*\",\n    \"4-2\": \"Arbitrary name that shows up in the UI. Not used outside of the Mixmax UI.\",\n    \"5-0\": \"eventName\",\n    \"5-1\": \"*String*\",\n    \"5-2\": \"An event that activates the rule. Must be an event from the table below.\",\n    \"6-0\": \"filter\",\n    \"6-1\": \"*String*\",\n    \"6-2\": \"JSON serialized string representation of a Sift filter. Details below. Omit for no filter.\",\n    \"7-0\": \"action\",\n    \"7-1\": \"*Object*\",\n    \"7-2\": \"An object with required key `type` that is one of the types in the table listed below. This object may contain other key/value pairs specific to that event.\",\n    \"8-0\": \"isPaused\",\n    \"8-1\": \"*Boolean*\",\n    \"8-2\": \"True if the rule is paused (not running on incoming events)\"\n  },\n  \"cols\": 3,\n  \"rows\": 9\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\nHere's a list of support values for `eventName`, along with attributes of each that the `filter` can be applied to:\n\n### unopened\nRepresents a message that has been sent from Mixmax. The name is due to legacy reasons.\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"userId\",\n    \"4-0\": \"cc\",\n    \"7-0\": \"bcc\",\n    \"10-0\": \"subject\",\n    \"11-0\": \"from\",\n    \"12-0\": \"sent\",\n    \"13-0\": \"teamIds\",\n    \"1-0\": \"to\",\n    \"0-2\": \"ID of the user that this event is for.\",\n    \"0-1\": \"*String*\",\n    \"1-1\": \"*Array*\",\n    \"1-2\": \"Array of **to** recipients of the message.\",\n    \"4-1\": \"*Array*\",\n    \"7-1\": \"*Array*\",\n    \"10-1\": \"*String*\",\n    \"11-1\": \"*Object*\",\n    \"12-1\": \"*Timestamp*\",\n    \"13-1\": \"*Array*\",\n    \"4-2\": \"Array of **cc** recipients of the message.\",\n    \"7-2\": \"Array of **bcc** recipients of the message.\",\n    \"10-2\": \"The subject of the message.\",\n    \"11-2\": \"The name and email of the user that sent the message (this is especially useful if you have many **Send-As** addresses).\",\n    \"12-2\": \"When the message was sent.\",\n    \"13-2\": \"The IDs (*String*s) of the teams that this message is shared with.\",\n    \"2-0\": \"to.email\",\n    \"3-0\": \"to.name\",\n    \"3-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"2-2\": \"The email of the recipient.\",\n    \"3-1\": \"*String*\",\n    \"2-1\": \"*String*\",\n    \"5-0\": \"cc.email\",\n    \"6-0\": \"cc.name\",\n    \"6-1\": \"*String*\",\n    \"5-1\": \"*String*\",\n    \"8-0\": \"bcc.email\",\n    \"8-1\": \"*String*\",\n    \"9-0\": \"bcc.name\",\n    \"9-1\": \"*String*\",\n    \"6-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"9-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"8-2\": \"The email of the recipient.\",\n    \"5-2\": \"The email of the recipient.\"\n  },\n  \"cols\": 3,\n  \"rows\": 14\n}\n[/block]\n### opened\nAn event representing a message that has been sent and opened by a recipient of that message. There will be one opened event per time the message was opened. It will contain details about where it was opened and on what device.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"userId\",\n    \"0-1\": \"*String*\",\n    \"0-2\": \"The ID of the user who sent the associated message that was opened.\",\n    \"1-0\": \"teamIds\",\n    \"1-1\": \"*Array*\",\n    \"1-2\": \"The IDs (*String*s) of the teams that this message is shared with.\",\n    \"2-0\": \"messageId\",\n    \"2-1\": \"*String*\",\n    \"2-2\": \"The ID of the message that was opened.\",\n    \"3-0\": \"recipientEmail\",\n    \"3-1\": \"*String*\",\n    \"4-0\": \"recipientName\",\n    \"4-1\": \"*String*\",\n    \"3-2\": \"The email of the recipient that opened the message.\",\n    \"4-2\": \"The name of the recipient that opened the message if known, null otherwise.\",\n    \"5-0\": \"timestamp\",\n    \"5-1\": \"*Timestamp*\",\n    \"5-2\": \"When the associated message was opened.\",\n    \"6-0\": \"ipAddress\",\n    \"6-1\": \"*String*\",\n    \"6-2\": \"The IP address associated with opening the message.\",\n    \"7-0\": \"userAgent\",\n    \"7-1\": \"*String*\",\n    \"7-2\": \"The User-Agent associated with opening the message.\",\n    \"8-0\": \"message\",\n    \"9-0\": \"message.to\",\n    \"10-0\": \"message.to.email\",\n    \"11-0\": \"message.to.name\",\n    \"12-0\": \"message.cc\",\n    \"13-0\": \"message.cc.email\",\n    \"14-0\": \"message.cc.name\",\n    \"15-0\": \"message.bcc\",\n    \"16-0\": \"message.bcc.email\",\n    \"17-0\": \"message.bcc.name\",\n    \"18-0\": \"message.subject\",\n    \"8-1\": \"*Object*\",\n    \"8-2\": \"The message that this opened event refers to.\",\n    \"9-2\": \"Array of **to** recipients of the message.\",\n    \"9-1\": \"*Array*\",\n    \"11-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"10-2\": \"The email of the recipient.\",\n    \"10-1\": \"*String*\",\n    \"11-1\": \"*String*\",\n    \"12-2\": \"Array of **cc** recipients of the message.\",\n    \"15-2\": \"Array of **bcc** recipients of the message.\",\n    \"14-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"17-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"16-2\": \"The email of the recipient.\",\n    \"13-2\": \"The email of the recipient.\",\n    \"12-1\": \"*Array*\",\n    \"15-1\": \"*Array*\",\n    \"13-1\": \"*String*\",\n    \"14-1\": \"*String*\",\n    \"16-1\": \"*String*\",\n    \"17-1\": \"*String*\",\n    \"18-1\": \"*String*\",\n    \"18-2\": \"The subject of the message.\"\n  },\n  \"cols\": 3,\n  \"rows\": 19\n}\n[/block]\n### clicked\nAn event representing a link being clicked in an email you sent.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"userId\",\n    \"0-1\": \"*String*\",\n    \"1-0\": \"teamIds\",\n    \"1-1\": \"*Array*\",\n    \"2-0\": \"messageId\",\n    \"2-1\": \"*String*\",\n    \"3-0\": \"recipientEmail\",\n    \"3-1\": \"*String*\",\n    \"4-0\": \"recipientName\",\n    \"4-1\": \"*String*\",\n    \"5-0\": \"userAgent\",\n    \"5-1\": \"*String*\",\n    \"6-0\": \"timestamp\",\n    \"7-0\": \"linkUrl\",\n    \"8-0\": \"linkText\",\n    \"6-1\": \"*Timestamp*\",\n    \"7-1\": \"*String*\",\n    \"8-1\": \"*String*\",\n    \"0-2\": \"The ID of the user who sent the associated message contained this link.\",\n    \"1-2\": \"The IDs (*String*s) of the teams that the message that contained this link was shared with.\",\n    \"2-2\": \"The ID of the message that the opened link was contained within.\",\n    \"3-2\": \"The email of the recipient that clicked the link.\",\n    \"4-2\": \"The name of the recipient that clicked the link if known, null otherwise.\",\n    \"5-2\": \"The User-Agent associated with clicking the link.\",\n    \"6-2\": \"When the link was clicked.\",\n    \"7-2\": \"The link that was clicked.\",\n    \"8-2\": \"The text that the user clicked on to navigate to the link.\",\n    \"9-0\": \"message\",\n    \"10-0\": \"message.to\",\n    \"11-0\": \"message.to.email\",\n    \"12-0\": \"message.to.name\",\n    \"13-0\": \"message.cc\",\n    \"14-0\": \"message.cc.email\",\n    \"15-0\": \"message.cc.name\",\n    \"16-0\": \"message.bcc\",\n    \"17-0\": \"message.bcc.email\",\n    \"18-0\": \"message.bcc.name\",\n    \"19-0\": \"message.subject\",\n    \"9-1\": \"*Object*\",\n    \"10-1\": \"*Array*\",\n    \"13-1\": \"*Array*\",\n    \"16-1\": \"*Array*\",\n    \"11-1\": \"*String*\",\n    \"12-1\": \"*String*\",\n    \"14-1\": \"*String*\",\n    \"15-1\": \"*String*\",\n    \"17-1\": \"*String*\",\n    \"18-1\": \"*String*\",\n    \"19-1\": \"*String*\",\n    \"10-2\": \"Array of **to** recipients of the message.\",\n    \"13-2\": \"Array of **cc** recipients of the message.\",\n    \"16-2\": \"Array of **bcc** recipients of the message.\",\n    \"11-2\": \"The email of the recipient.\",\n    \"14-2\": \"The email of the recipient.\",\n    \"17-2\": \"The email of the recipient.\",\n    \"12-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"15-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"18-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"19-2\": \"The subject of the message.\",\n    \"9-2\": \"The message that this clicked event refers to.\"\n  },\n  \"cols\": 3,\n  \"rows\": 20\n}\n[/block]\n### downloaded\nAn event representing a [Mixmax Cloud Attachment](An event representing a Mixmax Cloud Attachment in the message being downloaded) in your message being downloaded.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"userId\",\n    \"0-1\": \"*String*\",\n    \"1-0\": \"teamIds\",\n    \"1-1\": \"*Array*\",\n    \"2-0\": \"messageId\",\n    \"2-1\": \"*String*\",\n    \"3-0\": \"recipientEmail\",\n    \"3-1\": \"*String*\",\n    \"4-0\": \"recipientName\",\n    \"4-1\": \"*String*\",\n    \"5-0\": \"userAgent\",\n    \"5-1\": \"*String*\",\n    \"6-0\": \"timestamp\",\n    \"6-1\": \"*Timestamp*\",\n    \"7-0\": \"fileName\",\n    \"7-1\": \"*String*\",\n    \"7-2\": \"The name of the file that was downloaded.\",\n    \"0-2\": \"The ID of the user who sent the message that contained this file.\",\n    \"1-2\": \"The IDs (*String*s) of the teams that the message that contained this file was shared with.\",\n    \"2-2\": \"The ID of the message that the downloaded file was contained within.\",\n    \"3-2\": \"The email of the recipient that downloaded the file.\",\n    \"4-2\": \"The name of the recipient that downloaded the file if known, null otherwise.\",\n    \"5-2\": \"The User-Agent used to download the file.\",\n    \"6-2\": \"When the file was downloaded.\",\n    \"8-0\": \"message\",\n    \"9-0\": \"message.to\",\n    \"10-0\": \"message.to.email\",\n    \"11-0\": \"message.to.name\",\n    \"12-0\": \"message.cc\",\n    \"13-0\": \"message.cc.email\",\n    \"14-0\": \"message.cc.name\",\n    \"15-0\": \"message.bcc\",\n    \"16-0\": \"message.bcc.email\",\n    \"17-0\": \"message.bcc.name\",\n    \"18-0\": \"message.subject\",\n    \"8-1\": \"*Object*\",\n    \"9-1\": \"*Array*\",\n    \"12-1\": \"*Array*\",\n    \"15-1\": \"*Array*\",\n    \"10-1\": \"*String*\",\n    \"11-1\": \"*String*\",\n    \"13-1\": \"*String*\",\n    \"14-1\": \"*String*\",\n    \"16-1\": \"*String*\",\n    \"17-1\": \"*String*\",\n    \"18-1\": \"*String*\",\n    \"18-2\": \"The subject of the message.\",\n    \"8-2\": \"The message that this downloaded event refers to.\",\n    \"9-2\": \"Array of **to** recipients of the message.\",\n    \"12-2\": \"Array of **cc** recipients of the message.\",\n    \"15-2\": \"Array of **bcc** recipients of the message.\",\n    \"17-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"14-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"11-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"10-2\": \"The email of the recipient.\",\n    \"13-2\": \"The email of the recipient.\",\n    \"16-2\": \"The email of the recipient.\"\n  },\n  \"cols\": 3,\n  \"rows\": 19\n}\n[/block]\n### message:received\nAn incoming email\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"userId\",\n    \"0-1\": \"*String*\",\n    \"1-0\": \"rfc822Id\",\n    \"1-1\": \"*String*\",\n    \"2-0\": \"subject\",\n    \"2-1\": \"*String*\",\n    \"3-0\": \"from\",\n    \"3-1\": \"*Object*\",\n    \"6-0\": \"to\",\n    \"9-0\": \"cc\",\n    \"12-0\": \"bcc\",\n    \"15-0\": \"sent\",\n    \"6-1\": \"*Array*\",\n    \"9-1\": \"*Array*\",\n    \"12-1\": \"*Array*\",\n    \"15-1\": \"*Timestamp*\",\n    \"15-2\": \"When the email was received by Gmail.\",\n    \"0-2\": \"The ID of the user who sent the message that was replied to.\",\n    \"1-2\": \"The RFC 822 message id from the `message-id` header.\",\n    \"2-2\": \"The subject of the message.\",\n    \"3-2\": \"Who sent the message\",\n    \"4-0\": \"from.email\",\n    \"4-1\": \"*String*\",\n    \"4-2\": \"The sender's email.\",\n    \"5-0\": \"from.name\",\n    \"5-1\": \"*String*\",\n    \"5-2\": \"The sender's name, if available.\",\n    \"13-0\": \"bcc.email\",\n    \"13-1\": \"*String*\",\n    \"14-0\": \"bcc.name\",\n    \"14-1\": \"*String*\",\n    \"10-0\": \"cc.email\",\n    \"10-1\": \"*String*\",\n    \"11-0\": \"cc.name\",\n    \"11-1\": \"*String*\",\n    \"7-0\": \"to.email\",\n    \"7-1\": \"*String*\",\n    \"8-0\": \"to.name\",\n    \"8-1\": \"*String*\",\n    \"6-2\": \"Array of **to** recipients.\",\n    \"9-2\": \"Array of **cc** recipients in the message.\",\n    \"12-2\": \"Array of **bcc** recipients in the message.\",\n    \"8-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"11-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"14-2\": \"Name of the recipient if it was known when sending the email. Otherwise, null.\",\n    \"13-2\": \"The email of the recipient.\",\n    \"10-2\": \"The email of the recipient.\",\n    \"7-2\": \"The email of the recipient.\",\n    \"16-0\": \"inReplyTo\",\n    \"16-1\": \"*Object*\",\n    \"16-2\": \"If the received email was a reply to a sent message (using Mixmax), then inReplyTo is set to the [message](/docs/messages) document that was replied to. Otherwise, null.\",\n    \"17-0\": \"isBounce\",\n    \"18-0\": \"isAutoReply\",\n    \"19-0\": \"isMixmaxNotification\",\n    \"17-1\": \"*Boolean*\",\n    \"18-1\": \"*Boolean*\",\n    \"19-1\": \"*Boolean*\",\n    \"17-2\": \"Whether the message is a bounceback notification.\",\n    \"18-2\": \"Whether the message is an autoreply.\",\n    \"19-2\": \"Whether the message is a Mixmax notification (such as a meeting confirmation).\"\n  },\n  \"cols\": 3,\n  \"rows\": 20\n}\n[/block]\n### poll:vote\n\nA poll vote is when someone votes in on of your Mixmax [/polls](doc:polls). See [docs](doc:polls) for format.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"0-1\": \"*Object*\",\n    \"0-2\": \"See [/polls](doc:polls) for format\",\n    \"0-0\": \"poll\",\n    \"1-0\": \"respondent\",\n    \"1-1\": \"*Object*\",\n    \"1-2\": \"Object representing the vote\",\n    \"2-0\": \"respondent.email\",\n    \"2-1\": \"*String*\",\n    \"2-2\": \"The email of the person who responded\",\n    \"3-0\": \"respondent.name\",\n    \"3-1\": \"*String* or *null*\",\n    \"3-2\": \"The name of the person who responded (if it was known from the address book when sending the email)\",\n    \"4-0\": \"vote\",\n    \"4-1\": \"*String*\",\n    \"4-2\": \"The name of the poll option the respondent voted for.\",\n    \"5-0\": \"timestamp\",\n    \"5-1\": \"*Timestamp*\",\n    \"5-2\": \"When the respondent submitted this vote.\",\n    \"h-2\": \"Description\",\n    \"6-0\": \"messageId\",\n    \"6-1\": \"*String*\",\n    \"6-2\": \"The ID of the message that the poll was embedded in.\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]\n### meetinginvites:confirmed\n\nA meeting invite (sent via the availability app) that is confirmed.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"invite\",\n    \"0-1\": \"*Object*\",\n    \"0-2\": \"The meeting invitation\",\n    \"1-0\": \"invite.title\",\n    \"1-1\": \"*String*\",\n    \"1-2\": \"The meeting invitation's title\",\n    \"2-0\": \"invite.timeslots\",\n    \"2-1\": \"*Array*\",\n    \"2-2\": \"The potential meeting times\",\n    \"3-0\": \"invite.timeslots.start\",\n    \"3-1\": \"*Date*\",\n    \"3-2\": \"The timeslot's starting time\",\n    \"4-2\": \"The timeslot's ending time\",\n    \"4-1\": \"*Date*\",\n    \"4-0\": \"invite.timeslots.end\",\n    \"5-0\": \"invite.timezone\",\n    \"5-1\": \"*String*\",\n    \"5-2\": \"The timezone to display the times in\",\n    \"6-0\": \"organizer\",\n    \"6-1\": \"*Object*\",\n    \"7-0\": \"organizer.name\",\n    \"7-1\": \"*String*\",\n    \"7-2\": \"The organizer's name\",\n    \"8-0\": \"organizer.email\",\n    \"8-1\": \"*String*\",\n    \"8-2\": \"The organizer's name\",\n    \"6-2\": \"The organizer of the meeting\",\n    \"9-0\": \"guest\",\n    \"9-2\": \"The guest we're inviting to the meeting\",\n    \"9-1\": \"*Object*\",\n    \"10-0\": \"guest.name\",\n    \"11-0\": \"guest.email\",\n    \"10-1\": \"*String* or *null*\",\n    \"11-1\": \"*String*\",\n    \"12-0\": \"selectedTimeslot\",\n    \"12-1\": \"*String*\",\n    \"10-2\": \"Name of the guest that's accepting\",\n    \"11-2\": \"Email of the guest that's accepting\",\n    \"12-2\": \"Index of the timeslot in `timeslots` that the user selected\",\n    \"13-0\": \"timestamp\",\n    \"13-1\": \"*Timestamp*\",\n    \"13-2\": \"When the meeting was confirmed\"\n  },\n  \"cols\": 3,\n  \"rows\": 14\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Filter\"\n}\n[/block]\nA filter is a JSON-serialized [Sift object](https://www.npmjs.com/package/sift). A Sift filter is a domain-specific language (inspired by MongoDB) for a complex expression. The Mixmax rules engine will evaluate your filter against the incoming event. If you omit a filter, then all events will match.\n\n## Example\n\nSo let's say you have an incoming poll:vote event that looks like this:\n\n```\n{\n   name: \"Favorite ice cream flavor\",\n   voteLabel: \"vanilla\",\n   recipientEmail: \"bob@mixmax.com\",\n}\n```\n\nand you want to match the first vote. You can create a simple Sift filter:\n\n```\n{\n   name: \"vanilla\"\n}\n```\n\nNow let's look at a more complex example. Let's say you want this rule to trigger if either *bob@mixmax.com* votes on *vanilla* OR *charlie@mixmax.com* votes on *chocolate*. You can use Sifts *$or* operator like so:\n\n```\n{\n   $or: [\n      {name: \"vanilla\", recipientEmail: {$regex: \"bob@mixmax.com\", $options: \"i\"}},\n      {name: \"chocolate\", recipientEmail: {$regex: \"charlie@mixmax.com\", $options: \"i\"}}\n   ]\n}\n```\n\nNote that we're matching the email address case-insensitively, since most email servers are case-insensitive.\n\n## Restrictions\n\nSince your Sift filter needs to be JSON serializable, you may not use Sift's `$where` operator. Also, when passing regular expressions you must use the object format (i.e. `{$regex: \"^prefix\", options: \"i\"}` instead of `/^prefix/i`).\n\n## Custom expressions\n\nIn addition to the basic expressions implemented by [Sift](https://www.npmjs.com/package/sift), the Mixmax rules engine also supports the following custom expressions:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Operator\",\n    \"0-0\": \"`$timeOfDay`\",\n    \"h-1\": \"Support data types\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"Matches a range of times within a day. It's an object with parameters:\\n1) timezone: the IANA timezone specifier for the timezone\\n2) start: the start hour of the day (00-23)\\n3) end: the end hour of the day (00-23), must be after start\",\n    \"1-0\": \"`$dayOfWeek`\",\n    \"h-3\": \"Example value\",\n    \"0-1\": \"*Date* or *Timestamp*\",\n    \"1-1\": \"*Date* or *Timestamp*\",\n    \"1-2\": \"Matches one or more days in a week. It's an object with parameters:\\n1) timezone: the IANA timezone specifier for the timezone\\n2) days: an array of number days to match (0=Sunday, 6=Saturday)\",\n    \"0-3\": \"```\\n{\\n   timezone: \\\"America/Los_Angeles\\\",   start: 6,\\n   end: 20\\n}\\n```\",\n    \"1-3\": \"```\\n{\\n   timezone: \\\"America/Los_Angeles\\\",   days: [1,2,3,4,5]\\n}\\n```\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\nAs a convenience, some event types support custom \"fields\" that match multiple fields behind the scenes. For example, you can use $anyRecipient as an alias for `to`, `cc`, `bcc.\n\nFor example, if you wanted to match messages that are sent between 9am and 5pm, you could use:\n\n```\n{\n   sent: { \n      $timeOfDay: { timezone: \"America/Los_Angeles\", start: 4, end: 16 } \n   }\n}\n```\n\n## Custom fields\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Example value\",\n    \"h-3\": \"\",\n    \"0-0\": \"`$anyRecipient`\",\n    \"0-1\": \"Alias for matching `to.email` or `cc.email` or `bcc.email` properties. Only valid for `unopened`, `replied`, and `message:received` event types.\",\n    \"0-2\": \"```\\n{\\n$anyRecipient: {$regex: \\\"hello@mixmax.com\\\", $options: \\\"i\\\"}\\n```\",\n    \"0-3\": \"\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Actions\"\n}\n[/block]\nThe action is the action taken on the event if it passes your filter. The following actions are supported. The action is an object with required property `type`. Other properties are dependent on the type of action.\n\n### sendToSlack\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"type\",\n    \"0-1\": \"Always `sendToSlack`\",\n    \"h-0\": \"Property\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"1-0\": \"webhookUrl\",\n    \"1-1\": \"*String*\",\n    \"1-2\": \"Required. The Slack URL to post the event to.\",\n    \"0-2\": \"Required and hardcoded\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nExample:\n\n```\n{\n   type: \"sendToSlack\",\n   webhookUrl: \"http://api.slack.com/...\"\n}\n```\n\n### sendToWebhook\n\nWhile you can already send events to webhooks with Mixmax, adding specific webhooks to rules allows you to do filtering for only the events that you're interested in.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"Always `sendToWebhook`\",\n    \"0-2\": \"Required and hardcoded.\",\n    \"1-0\": \"webhookUrl\",\n    \"1-1\": \"*String*\",\n    \"1-2\": \"The webhook URL to send the event to.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n### sendToTwilio\n\nThis will send you an SMS via your [Twilio](https://twilio.com) account. Copy your Twilio SID and token from [your dashboard](https://www.twilio.com/console/account/settings).\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"type\",\n    \"0-1\": \"Always `sendToTwilio`\",\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"Required and hardcoded.\",\n    \"1-0\": \"accountSid\",\n    \"2-0\": \"authToken\",\n    \"1-1\": \"*String*\",\n    \"2-1\": \"*String*\",\n    \"1-2\": \"Your Twilio account SID\",\n    \"2-2\": \"Your Twilio auth token\",\n    \"4-0\": \"phoneNumber\",\n    \"4-1\": \"*String*\",\n    \"4-2\": \"Your phone number to send to\",\n    \"3-0\": \"fromPhoneNumber\",\n    \"3-1\": \"*String*\",\n    \"3-2\": \"The phone number to send from (configured in your Twilio account)\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]","excerpt":"Mixmax rules are a way to intercept events and route them to a webhook or some other place https://app.mixmax.com/dashboard/settings/rules","slug":"rules","type":"endpoint","title":"/rules"}

get/rules

Mixmax rules are a way to intercept events and route them to a webhook or some other place https://app.mixmax.com/dashboard/settings/rules

Definition

{{ api_url }}{{ page_api_url }}

Examples


Documentation

Rules intercept a Mixmax event in realtime, evaluate a filter conditions on the event, and performs an action. For example, if you wanted to intercept incoming emails to *sales@yourcompany.com* and route them to Slack, you could create the rule: ``` { eventName: "message:sent", filter: {"to.email": "sales@yourcompany.com" }, action: { type: "sendToSlack", webhookUrl: "https://api.slack.com/..."} } ``` [block:api-header] { "type": "basic", "title": "Response format" } [/block] [block:parameters] { "data": { "0-0": "_id", "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-1": "*String*", "0-2": "Unique ID", "1-0": "userId", "1-1": "*String*", "1-2": "Your user id", "2-0": "createdAt", "2-1": "*Date*", "2-2": "Date it was created", "3-0": "modifiedAt", "3-1": "*Date*", "3-2": "Date it was last modified", "4-0": "name", "4-1": "*String*", "4-2": "Arbitrary name that shows up in the UI. Not used outside of the Mixmax UI.", "5-0": "eventName", "5-1": "*String*", "5-2": "An event that activates the rule. Must be an event from the table below.", "6-0": "filter", "6-1": "*String*", "6-2": "JSON serialized string representation of a Sift filter. Details below. Omit for no filter.", "7-0": "action", "7-1": "*Object*", "7-2": "An object with required key `type` that is one of the types in the table listed below. This object may contain other key/value pairs specific to that event.", "8-0": "isPaused", "8-1": "*Boolean*", "8-2": "True if the rule is paused (not running on incoming events)" }, "cols": 3, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] Here's a list of support values for `eventName`, along with attributes of each that the `filter` can be applied to: ### unopened Represents a message that has been sent from Mixmax. The name is due to legacy reasons. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "userId", "4-0": "cc", "7-0": "bcc", "10-0": "subject", "11-0": "from", "12-0": "sent", "13-0": "teamIds", "1-0": "to", "0-2": "ID of the user that this event is for.", "0-1": "*String*", "1-1": "*Array*", "1-2": "Array of **to** recipients of the message.", "4-1": "*Array*", "7-1": "*Array*", "10-1": "*String*", "11-1": "*Object*", "12-1": "*Timestamp*", "13-1": "*Array*", "4-2": "Array of **cc** recipients of the message.", "7-2": "Array of **bcc** recipients of the message.", "10-2": "The subject of the message.", "11-2": "The name and email of the user that sent the message (this is especially useful if you have many **Send-As** addresses).", "12-2": "When the message was sent.", "13-2": "The IDs (*String*s) of the teams that this message is shared with.", "2-0": "to.email", "3-0": "to.name", "3-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "2-2": "The email of the recipient.", "3-1": "*String*", "2-1": "*String*", "5-0": "cc.email", "6-0": "cc.name", "6-1": "*String*", "5-1": "*String*", "8-0": "bcc.email", "8-1": "*String*", "9-0": "bcc.name", "9-1": "*String*", "6-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "9-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "8-2": "The email of the recipient.", "5-2": "The email of the recipient." }, "cols": 3, "rows": 14 } [/block] ### opened An event representing a message that has been sent and opened by a recipient of that message. There will be one opened event per time the message was opened. It will contain details about where it was opened and on what device. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "userId", "0-1": "*String*", "0-2": "The ID of the user who sent the associated message that was opened.", "1-0": "teamIds", "1-1": "*Array*", "1-2": "The IDs (*String*s) of the teams that this message is shared with.", "2-0": "messageId", "2-1": "*String*", "2-2": "The ID of the message that was opened.", "3-0": "recipientEmail", "3-1": "*String*", "4-0": "recipientName", "4-1": "*String*", "3-2": "The email of the recipient that opened the message.", "4-2": "The name of the recipient that opened the message if known, null otherwise.", "5-0": "timestamp", "5-1": "*Timestamp*", "5-2": "When the associated message was opened.", "6-0": "ipAddress", "6-1": "*String*", "6-2": "The IP address associated with opening the message.", "7-0": "userAgent", "7-1": "*String*", "7-2": "The User-Agent associated with opening the message.", "8-0": "message", "9-0": "message.to", "10-0": "message.to.email", "11-0": "message.to.name", "12-0": "message.cc", "13-0": "message.cc.email", "14-0": "message.cc.name", "15-0": "message.bcc", "16-0": "message.bcc.email", "17-0": "message.bcc.name", "18-0": "message.subject", "8-1": "*Object*", "8-2": "The message that this opened event refers to.", "9-2": "Array of **to** recipients of the message.", "9-1": "*Array*", "11-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "10-2": "The email of the recipient.", "10-1": "*String*", "11-1": "*String*", "12-2": "Array of **cc** recipients of the message.", "15-2": "Array of **bcc** recipients of the message.", "14-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "17-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "16-2": "The email of the recipient.", "13-2": "The email of the recipient.", "12-1": "*Array*", "15-1": "*Array*", "13-1": "*String*", "14-1": "*String*", "16-1": "*String*", "17-1": "*String*", "18-1": "*String*", "18-2": "The subject of the message." }, "cols": 3, "rows": 19 } [/block] ### clicked An event representing a link being clicked in an email you sent. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "userId", "0-1": "*String*", "1-0": "teamIds", "1-1": "*Array*", "2-0": "messageId", "2-1": "*String*", "3-0": "recipientEmail", "3-1": "*String*", "4-0": "recipientName", "4-1": "*String*", "5-0": "userAgent", "5-1": "*String*", "6-0": "timestamp", "7-0": "linkUrl", "8-0": "linkText", "6-1": "*Timestamp*", "7-1": "*String*", "8-1": "*String*", "0-2": "The ID of the user who sent the associated message contained this link.", "1-2": "The IDs (*String*s) of the teams that the message that contained this link was shared with.", "2-2": "The ID of the message that the opened link was contained within.", "3-2": "The email of the recipient that clicked the link.", "4-2": "The name of the recipient that clicked the link if known, null otherwise.", "5-2": "The User-Agent associated with clicking the link.", "6-2": "When the link was clicked.", "7-2": "The link that was clicked.", "8-2": "The text that the user clicked on to navigate to the link.", "9-0": "message", "10-0": "message.to", "11-0": "message.to.email", "12-0": "message.to.name", "13-0": "message.cc", "14-0": "message.cc.email", "15-0": "message.cc.name", "16-0": "message.bcc", "17-0": "message.bcc.email", "18-0": "message.bcc.name", "19-0": "message.subject", "9-1": "*Object*", "10-1": "*Array*", "13-1": "*Array*", "16-1": "*Array*", "11-1": "*String*", "12-1": "*String*", "14-1": "*String*", "15-1": "*String*", "17-1": "*String*", "18-1": "*String*", "19-1": "*String*", "10-2": "Array of **to** recipients of the message.", "13-2": "Array of **cc** recipients of the message.", "16-2": "Array of **bcc** recipients of the message.", "11-2": "The email of the recipient.", "14-2": "The email of the recipient.", "17-2": "The email of the recipient.", "12-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "15-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "18-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "19-2": "The subject of the message.", "9-2": "The message that this clicked event refers to." }, "cols": 3, "rows": 20 } [/block] ### downloaded An event representing a [Mixmax Cloud Attachment](An event representing a Mixmax Cloud Attachment in the message being downloaded) in your message being downloaded. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "userId", "0-1": "*String*", "1-0": "teamIds", "1-1": "*Array*", "2-0": "messageId", "2-1": "*String*", "3-0": "recipientEmail", "3-1": "*String*", "4-0": "recipientName", "4-1": "*String*", "5-0": "userAgent", "5-1": "*String*", "6-0": "timestamp", "6-1": "*Timestamp*", "7-0": "fileName", "7-1": "*String*", "7-2": "The name of the file that was downloaded.", "0-2": "The ID of the user who sent the message that contained this file.", "1-2": "The IDs (*String*s) of the teams that the message that contained this file was shared with.", "2-2": "The ID of the message that the downloaded file was contained within.", "3-2": "The email of the recipient that downloaded the file.", "4-2": "The name of the recipient that downloaded the file if known, null otherwise.", "5-2": "The User-Agent used to download the file.", "6-2": "When the file was downloaded.", "8-0": "message", "9-0": "message.to", "10-0": "message.to.email", "11-0": "message.to.name", "12-0": "message.cc", "13-0": "message.cc.email", "14-0": "message.cc.name", "15-0": "message.bcc", "16-0": "message.bcc.email", "17-0": "message.bcc.name", "18-0": "message.subject", "8-1": "*Object*", "9-1": "*Array*", "12-1": "*Array*", "15-1": "*Array*", "10-1": "*String*", "11-1": "*String*", "13-1": "*String*", "14-1": "*String*", "16-1": "*String*", "17-1": "*String*", "18-1": "*String*", "18-2": "The subject of the message.", "8-2": "The message that this downloaded event refers to.", "9-2": "Array of **to** recipients of the message.", "12-2": "Array of **cc** recipients of the message.", "15-2": "Array of **bcc** recipients of the message.", "17-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "14-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "11-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "10-2": "The email of the recipient.", "13-2": "The email of the recipient.", "16-2": "The email of the recipient." }, "cols": 3, "rows": 19 } [/block] ### message:received An incoming email [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "userId", "0-1": "*String*", "1-0": "rfc822Id", "1-1": "*String*", "2-0": "subject", "2-1": "*String*", "3-0": "from", "3-1": "*Object*", "6-0": "to", "9-0": "cc", "12-0": "bcc", "15-0": "sent", "6-1": "*Array*", "9-1": "*Array*", "12-1": "*Array*", "15-1": "*Timestamp*", "15-2": "When the email was received by Gmail.", "0-2": "The ID of the user who sent the message that was replied to.", "1-2": "The RFC 822 message id from the `message-id` header.", "2-2": "The subject of the message.", "3-2": "Who sent the message", "4-0": "from.email", "4-1": "*String*", "4-2": "The sender's email.", "5-0": "from.name", "5-1": "*String*", "5-2": "The sender's name, if available.", "13-0": "bcc.email", "13-1": "*String*", "14-0": "bcc.name", "14-1": "*String*", "10-0": "cc.email", "10-1": "*String*", "11-0": "cc.name", "11-1": "*String*", "7-0": "to.email", "7-1": "*String*", "8-0": "to.name", "8-1": "*String*", "6-2": "Array of **to** recipients.", "9-2": "Array of **cc** recipients in the message.", "12-2": "Array of **bcc** recipients in the message.", "8-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "11-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "14-2": "Name of the recipient if it was known when sending the email. Otherwise, null.", "13-2": "The email of the recipient.", "10-2": "The email of the recipient.", "7-2": "The email of the recipient.", "16-0": "inReplyTo", "16-1": "*Object*", "16-2": "If the received email was a reply to a sent message (using Mixmax), then inReplyTo is set to the [message](/docs/messages) document that was replied to. Otherwise, null.", "17-0": "isBounce", "18-0": "isAutoReply", "19-0": "isMixmaxNotification", "17-1": "*Boolean*", "18-1": "*Boolean*", "19-1": "*Boolean*", "17-2": "Whether the message is a bounceback notification.", "18-2": "Whether the message is an autoreply.", "19-2": "Whether the message is a Mixmax notification (such as a meeting confirmation)." }, "cols": 3, "rows": 20 } [/block] ### poll:vote A poll vote is when someone votes in on of your Mixmax [/polls](doc:polls). See [docs](doc:polls) for format. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "0-1": "*Object*", "0-2": "See [/polls](doc:polls) for format", "0-0": "poll", "1-0": "respondent", "1-1": "*Object*", "1-2": "Object representing the vote", "2-0": "respondent.email", "2-1": "*String*", "2-2": "The email of the person who responded", "3-0": "respondent.name", "3-1": "*String* or *null*", "3-2": "The name of the person who responded (if it was known from the address book when sending the email)", "4-0": "vote", "4-1": "*String*", "4-2": "The name of the poll option the respondent voted for.", "5-0": "timestamp", "5-1": "*Timestamp*", "5-2": "When the respondent submitted this vote.", "h-2": "Description", "6-0": "messageId", "6-1": "*String*", "6-2": "The ID of the message that the poll was embedded in." }, "cols": 3, "rows": 7 } [/block] ### meetinginvites:confirmed A meeting invite (sent via the availability app) that is confirmed. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "invite", "0-1": "*Object*", "0-2": "The meeting invitation", "1-0": "invite.title", "1-1": "*String*", "1-2": "The meeting invitation's title", "2-0": "invite.timeslots", "2-1": "*Array*", "2-2": "The potential meeting times", "3-0": "invite.timeslots.start", "3-1": "*Date*", "3-2": "The timeslot's starting time", "4-2": "The timeslot's ending time", "4-1": "*Date*", "4-0": "invite.timeslots.end", "5-0": "invite.timezone", "5-1": "*String*", "5-2": "The timezone to display the times in", "6-0": "organizer", "6-1": "*Object*", "7-0": "organizer.name", "7-1": "*String*", "7-2": "The organizer's name", "8-0": "organizer.email", "8-1": "*String*", "8-2": "The organizer's name", "6-2": "The organizer of the meeting", "9-0": "guest", "9-2": "The guest we're inviting to the meeting", "9-1": "*Object*", "10-0": "guest.name", "11-0": "guest.email", "10-1": "*String* or *null*", "11-1": "*String*", "12-0": "selectedTimeslot", "12-1": "*String*", "10-2": "Name of the guest that's accepting", "11-2": "Email of the guest that's accepting", "12-2": "Index of the timeslot in `timeslots` that the user selected", "13-0": "timestamp", "13-1": "*Timestamp*", "13-2": "When the meeting was confirmed" }, "cols": 3, "rows": 14 } [/block] [block:api-header] { "type": "basic", "title": "Filter" } [/block] A filter is a JSON-serialized [Sift object](https://www.npmjs.com/package/sift). A Sift filter is a domain-specific language (inspired by MongoDB) for a complex expression. The Mixmax rules engine will evaluate your filter against the incoming event. If you omit a filter, then all events will match. ## Example So let's say you have an incoming poll:vote event that looks like this: ``` { name: "Favorite ice cream flavor", voteLabel: "vanilla", recipientEmail: "bob@mixmax.com", } ``` and you want to match the first vote. You can create a simple Sift filter: ``` { name: "vanilla" } ``` Now let's look at a more complex example. Let's say you want this rule to trigger if either *bob@mixmax.com* votes on *vanilla* OR *charlie@mixmax.com* votes on *chocolate*. You can use Sifts *$or* operator like so: ``` { $or: [ {name: "vanilla", recipientEmail: {$regex: "bob@mixmax.com", $options: "i"}}, {name: "chocolate", recipientEmail: {$regex: "charlie@mixmax.com", $options: "i"}} ] } ``` Note that we're matching the email address case-insensitively, since most email servers are case-insensitive. ## Restrictions Since your Sift filter needs to be JSON serializable, you may not use Sift's `$where` operator. Also, when passing regular expressions you must use the object format (i.e. `{$regex: "^prefix", options: "i"}` instead of `/^prefix/i`). ## Custom expressions In addition to the basic expressions implemented by [Sift](https://www.npmjs.com/package/sift), the Mixmax rules engine also supports the following custom expressions: [block:parameters] { "data": { "h-0": "Operator", "0-0": "`$timeOfDay`", "h-1": "Support data types", "h-2": "Description", "0-2": "Matches a range of times within a day. It's an object with parameters:\n1) timezone: the IANA timezone specifier for the timezone\n2) start: the start hour of the day (00-23)\n3) end: the end hour of the day (00-23), must be after start", "1-0": "`$dayOfWeek`", "h-3": "Example value", "0-1": "*Date* or *Timestamp*", "1-1": "*Date* or *Timestamp*", "1-2": "Matches one or more days in a week. It's an object with parameters:\n1) timezone: the IANA timezone specifier for the timezone\n2) days: an array of number days to match (0=Sunday, 6=Saturday)", "0-3": "```\n{\n timezone: \"America/Los_Angeles\", start: 6,\n end: 20\n}\n```", "1-3": "```\n{\n timezone: \"America/Los_Angeles\", days: [1,2,3,4,5]\n}\n```" }, "cols": 4, "rows": 2 } [/block] As a convenience, some event types support custom "fields" that match multiple fields behind the scenes. For example, you can use $anyRecipient as an alias for `to`, `cc`, `bcc. For example, if you wanted to match messages that are sent between 9am and 5pm, you could use: ``` { sent: { $timeOfDay: { timezone: "America/Los_Angeles", start: 4, end: 16 } } } ``` ## Custom fields [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Example value", "h-3": "", "0-0": "`$anyRecipient`", "0-1": "Alias for matching `to.email` or `cc.email` or `bcc.email` properties. Only valid for `unopened`, `replied`, and `message:received` event types.", "0-2": "```\n{\n$anyRecipient: {$regex: \"hello@mixmax.com\", $options: \"i\"}\n```", "0-3": "" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Actions" } [/block] The action is the action taken on the event if it passes your filter. The following actions are supported. The action is an object with required property `type`. Other properties are dependent on the type of action. ### sendToSlack [block:parameters] { "data": { "0-0": "type", "0-1": "Always `sendToSlack`", "h-0": "Property", "h-1": "Type", "h-2": "Description", "1-0": "webhookUrl", "1-1": "*String*", "1-2": "Required. The Slack URL to post the event to.", "0-2": "Required and hardcoded" }, "cols": 3, "rows": 2 } [/block] Example: ``` { type: "sendToSlack", webhookUrl: "http://api.slack.com/..." } ``` ### sendToWebhook While you can already send events to webhooks with Mixmax, adding specific webhooks to rules allows you to do filtering for only the events that you're interested in. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "Always `sendToWebhook`", "0-2": "Required and hardcoded.", "1-0": "webhookUrl", "1-1": "*String*", "1-2": "The webhook URL to send the event to." }, "cols": 3, "rows": 2 } [/block] ### sendToTwilio This will send you an SMS via your [Twilio](https://twilio.com) account. Copy your Twilio SID and token from [your dashboard](https://www.twilio.com/console/account/settings). [block:parameters] { "data": { "0-0": "type", "0-1": "Always `sendToTwilio`", "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-2": "Required and hardcoded.", "1-0": "accountSid", "2-0": "authToken", "1-1": "*String*", "2-1": "*String*", "1-2": "Your Twilio account SID", "2-2": "Your Twilio auth token", "4-0": "phoneNumber", "4-1": "*String*", "4-2": "Your phone number to send to", "3-0": "fromPhoneNumber", "3-1": "*String*", "3-2": "The phone number to send from (configured in your Twilio account)" }, "cols": 3, "rows": 5 } [/block]

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}