newMatchedMessage\
Required token scopes:
Create scenariosManage scenarios on behalf of user
Subscribe
Send the body below to Import Subscription. You only need to change:url(required) - Located underdata.actions[0].params.url. Replace{{yourWebhookURL}}with the destination URL that should receive the events.expression(required) - Located underdata.conditions[0][1].params.expression. Replace the placeholder logic with your matching criteria using the syntaxtext == "your keyword":- Single keyword:
text == "help" - Multiple keywords (OR):
text == "buy" or text == "purchase" - Complex logic with
and,or,notand parentheses:(text == "urgent" and text == "error") or text == "critical" - Whole sentences match the exact string:
text == "I want to speak to a human"
- Single keyword:
asStatus- Keep"active"to enable the subscription immediately, or"inactive"to save it as an inactive revision.
Import body
A
201 response returns your new subscription - save its _id to manage it later. You can also add an optional authorUid root field (a Texter user UID) to attribute the subscription to a specific user.Payload
When the event fires, your URL receives an HTTPPOST with eventName: "newMatchedMessage" and the following eventData:
The incoming message that matched your expression. See the Message object for all fields.
The chat the message belongs to. See the Chat object for all fields.
Example payload
Manage this subscription
| Action | Endpoint |
|---|---|
| List subscriptions | List All Subscriptions |
| Pause | Inactivate Subscription |
| Resume | Activate Subscription |
| Delete | Delete Subscription |
| Debug executions | List Scenario Runs |