-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
171 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
backend/files/misc/sqlite/migrations/0038-add-name-to-questions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
alter table questions add column name varchar(40) null; | ||
|
3 changes: 3 additions & 0 deletions
3
backend/files/misc/sqlite/migrations/0039-add-action-to-questionnaires.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
alter table questionnaires add column action varchar(40) null; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
backend/files/system/openai/magic.startup/magic.questionnaires.action.sendgrid-subscribe.hl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
/* | ||
* Subscribes the specified [name] and [email] to a newsletter using SendGrid account. | ||
*/ | ||
slots.create:magic.questionnaires.action.sendgrid-subscribe | ||
|
||
// Sanity checking invocation. | ||
validators.mandatory:x:@.arguments/*/name | ||
validators.mandatory:x:@.arguments/*/email | ||
validators.email:x:@.arguments/*/email | ||
|
||
// Invoking SendGrid to create recipient. | ||
.auth | ||
set-value:x:@.auth | ||
strings.concat | ||
.:"Bearer " | ||
config.get:"magic:sendgrid:api-key" | ||
config.get:"magic:sendgrid:chatbot-list" | ||
set-name:x:./*/http.put/**/full_name | ||
config.get:"magic:sendgrid:full_name_id" | ||
.:e1_T | ||
unwrap:x:+/** | ||
http.put:"https://api.sendgrid.com/v3/marketing/contacts" | ||
convert:true | ||
headers | ||
Authorization:x:@.auth | ||
Content-Type:application/json | ||
payload | ||
list_ids | ||
.:x:@config.get | ||
contacts | ||
. | ||
email:x:@.arguments/*/email | ||
custom_fields | ||
full_name:x:@.arguments/*/name | ||
|
||
// Sanity checking invocation. | ||
if | ||
neq:x:@http.put | ||
.:int:202 | ||
.lambda | ||
|
||
// Oops ...!! | ||
lambda2hyper:x:@http.put/*/content | ||
log.error:Could not add new contact to list | ||
email:x:@.arguments/*/email | ||
name:x:@.arguments/*/name | ||
stack:x:@lambda2hyper | ||
|
||
else | ||
|
||
// Doing some basic logging | ||
log.info:Successfully added contact to SendGrid automation | ||
name:x:@.arguments/*/name | ||
email:x:@.arguments/*/email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
/* | ||
* Invokes the specified [action] with the specified [values]. | ||
*/ | ||
.arguments | ||
action:string | ||
values:* | ||
.description:Invokes the specified [action] with the specified [values] | ||
|
||
// Sanity checking invocation. | ||
validators.mandatory:x:@.arguments/*/action | ||
|
||
// Figuring out what slot to invoke. | ||
.slot | ||
set-value:x:@.slot | ||
strings.concat | ||
.:magic.questionnaires.action. | ||
get-value:x:@.arguments/*/action | ||
|
||
// Parametrising slot. | ||
add:x:./*/signal | ||
get-nodes:x:@.arguments/*/values/* | ||
|
||
// Invoking slot. | ||
signal:x:@.slot | ||
|
||
// Returning success to caller. | ||
return | ||
result:success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters