A reusable Power Platform snippet
icanhazdadjoke - Fetch a random dad joke (Action with AI Generated Message)
This is a snippet that demonstrates how to use the icanhazdadjoke - fetch a random dad joke action in an action.

- Last updated
- Jul 9, 2024
- Category
- Community snippet
From idea to implementation
Make it your own.
Check this snippet's prerequisites, permissions, and licensing before using it. The documentation below comes directly from the snippet README.
This is a snippet that demonstrates how to use the icanhazdadjoke - fetch a random dad joke action in an action. It uses an AI generated message as an output.

Authors
| Snippet | Author(s) |
|---|---|
| icanhazdadjoke - Fetch a random dad joke (Action with AI Generated Message) | Daniel Laskewitz (@laskewitz) |
Minimal path to awesome
Open a copilot in Copilot Studio
Select Actions
Select + Add an action
Search for Fetch a random dad joke and select the Search button
Select the Fetch a random dad joke action from the icanhazdadjoke (Independent Publisher) connector
Scroll down a little and select Copilot author authentication under End user authentication
Select Next
Select Finish
Select the icanhazdadjoke (Independent Publisher) - Fetch a random dad joke action in the list (select the name)
Select ... More in the upper right corner and select Open code editor
Make sure to copy the name of the connection reference and keep it somewhere safe (you need it later)

Replace the code in the code editor with the contents of the YAML-file
Replace { REPLACE-WITH-CONNECTION-REFERENCE-NAME } with the connection reference name you copied earlier
Save the action
Select Settings
Select Generative AI
Select Generative (preview) in the How should your copilot decide how to respond? section
Select the Save button at the top
Test out the action by using the Test copilot pane

Disclaimer
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.