Skip to content

Commit

Permalink
Merge pull request #178 from nyaruka/action_names
Browse files Browse the repository at this point in the history
Rename actions
  • Loading branch information
rowanseymour authored Mar 12, 2018
2 parents 645d870 + 865e113 commit 8e2c466
Show file tree
Hide file tree
Showing 34 changed files with 314 additions and 313 deletions.
6 changes: 3 additions & 3 deletions cmd/docgen/templates/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ At its simplest, a node can be just a single action with no exits, wait or route
"uuid":"5a06445e-d790-4bd3-a10b-b47bdcc9abed",
"actions":[{
"uuid": "abc0a2bf-6b4a-4ee0-83e1-1eebae6948ac",
"type": "reply",
"type": "send_msg",
"text": "What is your name?"
}]
}
Expand All @@ -53,7 +53,7 @@ An exit consists of:
"uuid":"5a06445e-d790-4bd3-a10b-b47bdcc9abed",
"actions":[{
"uuid": "abc0a2bf-6b4a-4ee0-83e1-1eebae6948ac",
"type": "reply",
"type": "send_msg",
"text": "What is your name?"
}],
"exits": [{
Expand Down Expand Up @@ -140,7 +140,7 @@ have been started by a `start_flow` action previously in the flow:
Flows do not describe data flow but rather actions and logic branching. As such, variables collected in a flow and the state of the flow is accessed through
what is called the Context. The context contains variables representing the current contact in a flow, the last input from that contact
as well as the results collected in a flow and any webhook requests made during the flow. Variables in the context may be referred to
within actions by using the `@` symbol. For example, to greet a contact by their name in a reply action, the text of the reply can be `Hi @contact.name!`.
within actions by using the `@` symbol. For example, to greet a contact by their name in a send_msg action, the text of the send_msg can be `Hi @contact.name!`.

The `@` symbol can be escaped in templates by repeating it, ie, `Hi @@twitter` would output `Hi @twitter`.

Expand Down
26 changes: 13 additions & 13 deletions cmd/flowrunner/testdata/flows/all_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "ad154980-7bf7-4ab8-8728-545fd6378912",
"type": "add_label",
"type": "add_input_labels",
"labels": [
{
"uuid": "3f65d88a-95dc-4140-9451-943e94e06fea",
Expand All @@ -25,7 +25,7 @@
},
{
"uuid": "ad154980-7bf7-4ab8-8728-545fd6378912",
"type": "add_to_group",
"type": "add_contact_groups",
"groups": [
{
"uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817",
Expand All @@ -38,13 +38,13 @@
},
{
"uuid": "ca5138c1-2a26-44c6-a29c-6ef695bc67ee",
"type": "add_urn",
"type": "add_contact_urn",
"scheme": "twitter",
"path": "@(replace(lower(contact.name), \" \", \"_\"))"
},
{
"uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "activation_token",
"label": "Activation Token"
Expand Down Expand Up @@ -85,15 +85,15 @@
},
{
"uuid": "ac110f56-a66c-4462-921c-b2c6d1c6dadb",
"type": "send_msg",
"type": "send_broadcast",
"urns": [
"tel:+12065551212"
],
"text": "Hi @contact.name, are you ready?"
},
{
"uuid": "c0057fd9-be0a-43ea-91df-5c18e14f2c59",
"type": "send_msg",
"type": "send_broadcast",
"groups": [
{
"uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817",
Expand All @@ -107,7 +107,7 @@
},
{
"uuid": "6d1346c0-48d8-4108-9c58-e45a1eb0ff7a",
"type": "remove_from_group",
"type": "remove_contact_groups",
"groups": [
{
"uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817",
Expand All @@ -117,18 +117,18 @@
},
{
"uuid": "f01d693b-2af2-49fb-9e38-146eb00937e9",
"type": "reply",
"type": "send_msg",
"text": "Hi @contact.name, are you ready to complete today's survey?"
},
{
"uuid": "d98c1e02-69df-4f95-8b89-8587a57ae0c3",
"type": "reply",
"type": "send_msg",
"text": "This is a message to each of @contact.name's urns.",
"all_urns": true
},
{
"uuid": "62a30ab4-d73c-447d-a989-39c49115153e",
"type": "reply",
"type": "send_msg",
"text": "This is a reply with attachments and quick replies",
"attachments": [
"image/jpeg:http://s3.amazon.com/bucket/[email protected]"
Expand All @@ -140,20 +140,20 @@
},
{
"uuid": "5508e6a7-26ce-4b3b-b32e-bb4e2e614f5d",
"type": "save_flow_result",
"type": "set_run_result",
"name": "Gender",
"value": "m",
"category": "Male"
},
{
"uuid": "f3581032-e122-45ee-8be7-4f3c955d97f8",
"type": "update_contact",
"type": "set_contact_property",
"field_name": "language",
"value": "eng"
},
{
"uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "gender",
"label": "Gender"
Expand Down
8 changes: 4 additions & 4 deletions cmd/flowrunner/testdata/flows/brochure.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"uuid": "32bc60ad-5c86-465e-a6b8-049c44ecce49",
"actions": [
{
"type": "reply",
"type": "send_msg",
"uuid": "9d9290a7-3713-4c22-8821-4af0a64c0821",
"text": "Hi! What is your name?"
}
Expand Down Expand Up @@ -66,13 +66,13 @@
"actions": [
{
"uuid": "455ba297-f6d2-45e6-bf3e-c1ef028b55ae",
"type": "update_contact",
"type": "set_contact_property",
"field_name": "name",
"value": "@run.input.text"
},
{
"uuid": "b3fa763e-474b-49df-b4d6-15e86507668f",
"type": "add_to_group",
"type": "add_contact_groups",
"groups": [
{
"uuid": "7be2f40b-38a0-4b06-9e6d-522dca592cc8",
Expand All @@ -82,7 +82,7 @@
},
{
"uuid": "605e3486-503d-481c-94f7-cd553f196a8a",
"type": "reply",
"type": "send_msg",
"text": "Great, you are @contact.name, thanks for joining!"
}
]
Expand Down
6 changes: 3 additions & 3 deletions cmd/flowrunner/testdata/flows/date_parse.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "e97cd6d5-3354-4dbd-85bc-6c1f87849eec",
"type": "reply",
"type": "send_msg",
"text": "Hi @contact.name! When were you born, enter in format yyyy.MM.dd"
}
],
Expand Down Expand Up @@ -51,7 +51,7 @@
"actions": [
{
"uuid": "afd5ac22-2a86-4576-a2c7-715f0bb10194",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "birth_date",
"label": "Birth Date"
Expand All @@ -60,7 +60,7 @@
},
{
"uuid": "d2a4052a-3fa9-4608-ab3e-5b9631440447",
"type": "reply",
"type": "send_msg",
"text": "Awesome, you were born on @(FORMAT_DATE(run.results.birth_date, \"MM-dd-yyyy\")) at @(FORMAT_DATE(run.results.birth_date, \"HH:mm\"))"
}
]
Expand Down
8 changes: 4 additions & 4 deletions cmd/flowrunner/testdata/flows/default_result.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"actions": [
{
"text": "What is your name?",
"type": "reply",
"type": "send_msg",
"uuid": "d3cd8da7-55f2-4bd3-9a0c-efc93c99e498"
}
]
Expand Down Expand Up @@ -46,13 +46,13 @@
"uuid": "2929d2fc-2778-4d98-a4bc-73a7345710b0",
"actions": [
{
"type": "update_contact",
"type": "set_contact_property",
"uuid": "aafb505c-603d-4025-864d-471345ed236d",
"field_name": "name",
"value": "@run.results.contact_name"
},
{
"type": "save_contact_field",
"type": "set_contact_field",
"uuid": "aafb505c-603d-4025-864d-471345ed237d",
"field": {
"key": "first_name",
Expand All @@ -61,7 +61,7 @@
"value": "@(WORD(run.results.contact_name, 1))"
},
{
"type": "reply",
"type": "send_msg",
"uuid": "aafb505c-603d-4025-864d-471345ed237d",
"text": "Great, pleased to meet you @contact.fields.first_name"
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/flowrunner/testdata/flows/dynamic_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "7bd8b3bf-0a3c-4928-bc46-df416e77ddf4",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "gender",
"label": "Gender"
Expand All @@ -21,7 +21,7 @@
},
{
"uuid": "ee4cd27e-1296-40fd-ac9c-8cd43e9fb8b5",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "age",
"label": "Age"
Expand All @@ -30,23 +30,23 @@
},
{
"uuid": "f01d693b-2af2-49fb-9e38-146eb00937e9",
"type": "reply",
"type": "send_msg",
"text": "Current groups: @contact.groups"
},
{
"uuid": "bc94b3ba-4aad-410a-ae71-1861f69da0fe",
"type": "add_urn",
"type": "add_contact_urn",
"scheme": "tel",
"path": "+250781234567"
},
{
"uuid": "5bc4894f-9ef4-430e-a040-e688fd2dd578",
"type": "reply",
"type": "send_msg",
"text": "Current groups: @contact.groups"
},
{
"uuid": "4ecf6abd-e8c8-424b-aef6-e904cf5b4fbe",
"type": "save_contact_field",
"type": "set_contact_field",
"field": {
"key": "age",
"label": "Age"
Expand All @@ -55,7 +55,7 @@
},
{
"uuid": "279b0215-c9d5-4a90-b7df-f371812bcc78",
"type": "reply",
"type": "send_msg",
"text": "Current groups: @contact.groups"
}
]
Expand Down
6 changes: 3 additions & 3 deletions cmd/flowrunner/testdata/flows/no_contact.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "ad154980-7bf7-4ab8-8728-545fd6378912",
"type": "add_label",
"type": "add_input_labels",
"labels": [
{
"uuid": "3f65d88a-95dc-4140-9451-943e94e06fea",
Expand All @@ -22,7 +22,7 @@
},
{
"uuid": "ad154980-7bf7-4ab8-8728-545fd6378912",
"type": "add_to_group",
"type": "add_contact_groups",
"groups": [
{
"uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817",
Expand All @@ -35,7 +35,7 @@
},
{
"uuid": "ca5138c1-2a26-44c6-a29c-6ef695bc67ee",
"type": "add_urn",
"type": "add_contact_urn",
"scheme": "twitter",
"path": "@(replace(lower(contact.name), \" \", \"_\"))"
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/flowrunner/testdata/flows/node_loop.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"uuid": "32bc60ad-5c86-465e-a6b8-049c44ecce49",
"actions": [
{
"type": "reply",
"type": "send_msg",
"uuid": "9d9290a7-3713-4c22-8821-4af0a64c0821",
"text": "Hi! What is your name?"
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/flowrunner/testdata/flows/subflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "49f6c984-620f-4d9b-98c4-8ead1d1ef4f6",
"type": "reply",
"type": "send_msg",
"text": "This is the parent flow"
},
{
Expand Down Expand Up @@ -61,7 +61,7 @@
"actions": [
{
"uuid": "5d51eae6-be0f-4cc7-9402-150aa1ed80a1",
"type": "reply",
"type": "send_msg",
"text": "Flow succeeded, they said @child.results.name"
}
]
Expand All @@ -71,7 +71,7 @@
"actions": [
{
"uuid": "d80b2a5c-3b5c-47cd-b6ea-2f59bf2bb477",
"type": "reply",
"type": "send_msg",
"text": "Flow failed"
}
]
Expand All @@ -92,7 +92,7 @@
"actions": [
{
"uuid": "e5a03dde-3b2f-4603-b5d0-d927f6bcc361",
"type": "reply",
"type": "send_msg",
"text": "What is your name?"
}
],
Expand Down Expand Up @@ -130,7 +130,7 @@
"actions": [
{
"uuid": "d63929fe-e999-42ef-abf1-4b281f58891e",
"type": "reply",
"type": "send_msg",
"text": "Got it!"
}
]
Expand Down
6 changes: 3 additions & 3 deletions cmd/flowrunner/testdata/flows/subflow_loop.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"actions": [
{
"uuid": "49f6c984-620f-4d9b-98c4-8ead1d1ef4f6",
"type": "reply",
"type": "send_msg",
"text": "This is the parent flow"
},
{
Expand All @@ -36,7 +36,7 @@
"actions": [
{
"uuid": "5d51eae6-be0f-4cc7-9402-150aa1ed80a1",
"type": "reply",
"type": "send_msg",
"text": "Flow succeeded"
}
]
Expand All @@ -57,7 +57,7 @@
"actions": [
{
"uuid": "e5a03dde-3b2f-4603-b5d0-d927f6bcc361",
"type": "reply",
"type": "send_msg",
"text": "This is the child flow"
},
{
Expand Down
Loading

0 comments on commit 8e2c466

Please sign in to comment.