Skip to content

Instantly share code, notes, and snippets.

@crimnolan
Last active May 20, 2025 05:43
Show Gist options
  • Save crimnolan/95d10e0238a61bf824edc0c5bd4add9e to your computer and use it in GitHub Desktop.
Save crimnolan/95d10e0238a61bf824edc0c5bd4add9e to your computer and use it in GitHub Desktop.
{
"nodes": [
{
"parameters": {
"authentication": "headerAuth",
"url": "https://canvas.instructure.com/api/v1/courses/{{course_id}}/assignments",
"responseFormat": "json",
"headers": {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
},
"name": "Fetch Assignments",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [450, 250]
},
{
"parameters": {
"sms": {
"body": "Your assignment '{{json.name}}' is due soon. Reply YES to submit automatically.",
"from": "YOUR_TWILIO_NUMBER",
"to": "{{json.phone_number}}"
}
},
"name": "Send SMS Consent",
"type": "n8n-nodes-base.twilio",
"typeVersion": 1,
"position": [650, 250]
},
{
"parameters": {
"url": "http://localhost:5000/webhook/sms",
"responseMode": "onReceived"
},
"name": "Wait for Webhook Response",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [850, 250]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "{{json.response}}",
"value2": "YES"
}
]
}
},
"name": "Consent Given?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [1050, 250]
},
{
"parameters": {
"functionCode": "return [{ json: { prompt: `Write a discussion post about ${$json.name}` } }];"
},
"name": "Generate AI Content",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [1250, 250]
},
{
"parameters": {
"authentication": "headerAuth",
"url": "https://canvas.instructure.com/api/v1/courses/{{course_id}}/assignments/{{assignment_id}}/submissions",
"responseFormat": "json",
"headers": {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
"jsonParameters": true,
"options": {},
"bodyParametersJson": {
"submission": {
"submission_type": "online_text_entry",
"body": "{{json.content}}"
}
}
},
"name": "Submit Assignment",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [1450, 250]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment