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

144 lines
4.7 KiB
Org Mode

:PROPERTIES:
:ID: b1d8fa03-4bd6-4bae-a642-23ae77769c41
:END:
#+title: 2022-04-12
* Normalizing tags in rule sets
References for applying [[id:d06d3ab4-c2d0-47c3-aae1-4395567fc3d2][Tag Normalization]] to campaign rule sets.
Campaign proxy iterates through this data, could be useful as an example.
** References for navigating rule set data structures
- Ruleset structure :: https://confluence.aweber.io/display/AR/Ruleset+v2+Structure#Rulesetv2Structure-event
- Ruleset json schemas :: https://gitlab.aweber.io/CC/Libraries/ruleset-json-schema/-/tree/master
- Campaigns iterating through events :: https://gitlab.aweber.io/CC/Applications/campaign-proxy/-/blob/4eafb44c557aff34a0c9b519ff99d6c81eb9b0d8/campaignproxy/ruleset_validation_handlers.py#L442-447
- Campaigns iterating through actions :: https://gitlab.aweber.io/CC/Applications/campaign-proxy/-/blob/4eafb44c557aff34a0c9b519ff99d6c81eb9b0d8/campaignproxy/ruleset_validation_handlers.py#L402-403
#+begin_notes
The rule service also stores data for searches in redis, be sure to alter the
data before any storage occurs.
#+end_notes
** Looking up a campaign's ruleset
Fetch the campaign record using the UUID in the control0-panel campaign URL.
#+begin_src http :pretty :cache yes :exports both
GET http://campaign.service.staging.consul/210b4a4f-ee07-4f1e-98c8-d16541f6e686
#+end_src
#+RESULTS[c237f01dc854e750aa1c8f568dbd54f77ab6f56c]:
#+begin_example
{
"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
}
#+end_example
Fetch the rule set using the =rule_set= id returned with the campaign.
#+begin_src http :pretty :cache yes :exports both
GET https://rule.aweberstage.com/01955ad5-cbca-455c-934f-d69a71a5578f
#+end_src
#+RESULTS[685774a46bbaf38b945afcc0952a390d1bc53ed3]:
#+begin_example
{
"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"
}
}
]
}
#+end_example