Webhook demo
Tags: #naas #webhook #snippet #operations
Running this command will add your this notebook to the "⚡️ Production" folder.
You can then, trigger it with the generated URL.
import naas
naas.webhook.add()
Running this command will delete your webhook
naas.webhook.delete()
Use the webhook feature to get data and trigger action from any tool.
Example of UMSO - Nocode website builder : https://www.umso.com/
import naas
Add "parameters" tag in cells => Code will be injected after this cell
# Parameters
params = {}
body = {
"Domain": "www.naas.ai",
"Email": "[email protected]",
"Name": "Jeremy",
"Site_ID": "jtci2pxwjczr",
"Submitted_At": "March 20, 2021 16:55 UTC",
}
headers = {
"host": "public.naas.ai",
"x-request-id": "e6b994eb9a83b9cac794c0d9e57c1533",
"x-real-ip": "10.0.87.40",
"x-forwarded-for": "10.0.87.40",
"x-forwarded-host": "public.naas.ai",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-scheme": "https",
"accept": "application/json",
"content-type": "application/json",
"user-agent": "landen-webhook-agent",
"accept-encoding": "gzip",
"connection": "close",
"content-length": "142",
"accept-charset": "utf-8",
}
naas.webhook.add()
naas.webhook.get_output()
Inject it in the blank cell in Step 1 to build your pipeline.
EMAIL = body.get("Email")
EMAIL
In this example, I want to send an email with the notebook template to the subscriber.
Setup a notification system.
import naas
email_to = ["[email protected]", EMAIL]
subject = "Get Naas Webhook tutorial template"
content = f"Hey {EMAIL},<br>Here is the Naas webhook tutorial template : https://public.naas.ai/amVyZW15LTJFbmFhczQyLTQwZ21haWwtMkVjb20=/asset/7c9359cbc967afd01d8e45b68659b3b0db4179582561f6fab70f156c460a"
naas.notifications.send(email_to=email_to, subject=subject, html=content)
naas.assets.add()
Last modified 1mo ago