roam/daily/2022-04-12.org
2022-04-23 00:39:06 -04:00

4.7 KiB

2022-04-12

Normalizing tags in rule sets

References for applying Tag Normalization to campaign rule sets.

Campaign proxy iterates through this data, could be useful as an example.

Looking up a campaign's ruleset

Fetch the campaign record using the UUID in the control0-panel campaign URL.

  GET http://campaign.service.staging.consul/210b4a4f-ee07-4f1e-98c8-d16541f6e686
{
  "id": "210b4a4f-ee07-4f1e-98c8-d16541f6e686",
  "name": "Normal Scott",
  "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e",
  "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131",
  "rule_set": "01955ad5-cbca-455c-934f-d69a71a5578f",
  "created_at": "2022-03-21T20:17:39.795431+00:00",
  "modified_at": "2022-03-24T18:34:37.909620+00:00",
  "state_changed_at": "2022-03-22T15:24:45.727430+00:00",
  "url": "http://campaign.service.staging.consul/210b4a4f-ee07-4f1e-98c8-d16541f6e686?owner=26b49bc2-207e-4a33-b267-5b9e64f2702e&parent=9f1db623-fbc3-4112-a2f3-ab563e37e131",
  "state": "active",
  "state_serial": 3,
  "is_valid": true,
  "is_legacy_followup": false,
  "sharing_enabled": false,
  "auto_extend_enabled": true,
  "extend_needed": false,
  "extended_at": null,
  "custom_fields": [],
  "global_fields": [],
  "campaign_type": "autoresponder",
  "properties": null
}

Fetch the rule set using the rule_set id returned with the campaign.

  GET https://rule.aweberstage.com/01955ad5-cbca-455c-934f-d69a71a5578f
{
  "id": "01955ad5-cbca-455c-934f-d69a71a5578f",
  "version": 2,
  "owner": "26b49bc2-207e-4a33-b267-5b9e64f2702e",
  "parent": "9f1db623-fbc3-4112-a2f3-ab563e37e131",
  "state": "active",
  "system": false,
  "iterator": null,
  "events": [
    {
      "id": "b3b69bd4-0c7b-4253-ab65-e6fcbb726f07",
      "type": "tag.v1",
      "title": null,
      "filter": {
        "type": "all",
        "criteria": [
          {
            "expect": true,
            "kwargs": {
              "key": "label",
              "values": [
                "normalize test",
                "foo"
              ]
            },
            "function": "rulesengine.filter.event_value_in",
            "operator": "=="
          },
          {
            "expect": true,
            "kwargs": {
              "list": "<event:list>",
              "labels": [
                "normalize test",
                "foo"
              ],
              "account": "<event:account>",
              "recipient": "<event:recipient>"
            },
            "function": "ruleset.tag.filter.any_tags_v1",
            "operator": "=="
          },
          {
            "expect": false,
            "kwargs": {
              "list": "<event:list>",
              "labels": [
                "normalized tag"
              ],
              "account": "<event:account>",
              "recipient": "<event:recipient>"
            },
            "function": "ruleset.tag.filter.any_tags_v1",
            "operator": "=="
          }
        ]
      },
      "parents": [],
      "metadata": "tag.v1",
      "recurring": false
    }
  ],
  "actions": [
    {
      "id": "396cd5d3-d410-4ae2-a991-b93a0b816600",
      "title": null,
      "parents": [
        "b3b69bd4-0c7b-4253-ab65-e6fcbb726f07"
      ],
      "metadata": "send-message",
      "recurring": false,
      "definition": {
        "kwargs": {
          "list": "<event:list>",
          "account": "<event:account>",
          "message": "394c27bf-5853-4b45-9ff1-a0637848f4b6",
          "meapi_id": "6238dd85f227ef3f2d5ec3a5",
          "recipient": "<event:recipient>"
        },
        "function": "ruleset.email.action.compose_v1"
      }
    }
  ]
}