-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alerts_twilio
script, and prepare alerts_gcs
script for future usage in a Windmill Flow
#59
base: main
Are you sure you want to change the base?
Conversation
…into alerts-twilio
@@ -53,6 +55,21 @@ schema: | |||
will be retrieved. This ID is used to filter and process relevant | |||
alerts. | |||
default: null | |||
territory_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced on this variable name, as it is ambiguous.
A community operator might misunderstand this to refer to the real name of their territory, not the GC subdomain slug e.g. {slug}.guardianconnector.net
.
On the other hand, "slug" is not a commonly known term for non-technical users.
Maybe "subdomain" is a better choice.
5437e99
to
71550de
Compare
alerts_twilio
script, and prepare alerts_gcs
script for future usage in a Windmill Flow
Goal
Closes #32.
The vision here is that these two scripts will be chained together with the CoMapeo alerts script in a Windmill Flow via a future PR:
alerts_gcs
runs. If new rows are written to the alerts or metadata tables, then the script returns analerts_statistics
dictionary; if not, it will return None.comapeo_alerts
runs. Dependent on Add script to post alerts to CoMapeo Cloud API #60 being merged.alerts_twilio
runs. I expect that in the Flow I can configure this not to run ifalert_gcs
does not return anything.Screenshots
A WhatsApp message I received from our Twilio service bot:
What I changed
twilio_message_template
twilio_message_template
resource type.twilio
resource in windmill because this resource only providesauth_token
andaccount_sid
arguments, whereas we also needcontent_sid
and could provide an additionalmessage_service_sid
for metrics tracking.origin_number
andrecipients
so as to bundle all of the relevant Twilio config parameters in one resource: to me, it seems more logical to configure all of the Twilio config (including phone numbers that will be receiving the message) in one screen, rather than to parse those between a resource and the script itself.alerts_gcs
alert_statistics
inprepare_alerts_metadata()
, consisting of values that are inserted in the Twilio message.iloc[0]
.new_alerts_data
which is set to true if any alerts rows or metadata rows were written.new_alerts_data
is true, then the script as a whole returnsalerts_statistics
, with the expectation that thealerts_twilio
script will be able to use this as the next step in a Flow.alerts_twilio
alerts_statistics
objecttwilio
object referring to the above resource typeterritory_name
string that represents the slug used for subdomains. For example,demo
for the demo, andm**a
,t**p
, ...send_twilio_message
function which leverages the Twilio client library to send a message to the API with the expected variables.Tests
alerts_statistics
nevertheless returns values from this new row (to test the Pandas Dataframe sorting behavior).alerts_gcs
e2e test now checks to see the script returns analerts_statistics
the first time, and None the second time (since this second run will update 0 alerts and alerts__metadata rows, so the script should not return anything).What I'm not doing here
alerts_gcs
, the CoMapeo POST alerts script to be merged from Add script to post alerts to CoMapeo Cloud API #60, andalerts_twilio
. When I do that, I expect that I will make some changes to whatalerts_gcs
actually returns in order to trigger runs for the other two scripts.