<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb" -->

---
title: Firebase AI Logic Tutorial #3 - Sending a Prompt | daily.dev
description: A step-by-step walkthrough shows how to send a prompt to a model using Firebase AI Logic, building a template string prompt that injects a selected personality...
canonical: https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Firebase AI Logic Tutorial #3 - Sending a Prompt | daily.dev
og:description: A step-by-step walkthrough shows how to send a prompt to a model using Firebase AI Logic, building a template string prompt that injects a selected personality...
og:url: https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb
og:image: https://api.daily.dev/og/posts/FBQwuFlkb.png
og:image:alt: Firebase AI Logic Tutorial #3 - Sending a Prompt
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Firebase AI Logic Tutorial #3 - Sending a Prompt

**[Net Ninja](https://daily.dev/sources/netninja)** · 5 min read · 0 upvotes · 0 comments

## Summary

A step-by-step walkthrough shows how to send a prompt to a model using Firebase AI Logic, building a template string prompt that injects a selected personality and user input, then calling generateContent on the exported model to get a response and render it in the UI. Also covers a gotcha with Firebase App Check blocking requests by default, requiring manually setting enforcement to unenforced in the Firebase console to allow requests to succeed.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=tOlpeOKCP7w>

## Questions this post answers

### Why do I get a 'Firebase App Check token is invalid' error when calling generateContent with Firebase AI Logic?

Firebase enables App Check enforcement by default, which blocks requests that lack a valid App Check token, including calls made through Firebase AI Logic's generateContent method. To fix it during development, go to the App Check section in the Firebase console, select the AI Logic API, click setup, and switch enforcement from enforced to unenforced; the change can take around 15 minutes to take effect.

_daily.dev surfaces gotchas like Firebase App Check blocking AI Logic requests before they cost you debugging time._

### How do I send a prompt to a model using Firebase AI Logic and display the response in a web app?

Build the prompt as a template string embedding dynamic variables, call the exported model's generateContent method with await, passing the prompt string as an argument, then read the generated text from response.text on the returned result. Store that text in component state so the UI rerenders with the model's output, and instruct the model in the prompt to return only the rewritten text with no preamble.

_Developers wiring AI responses into their UI can track practical Firebase AI Logic patterns on daily.dev._

## Similar posts on daily.dev

- [Build intelligent Android apps: Cloud and hybrid inference](https://daily.dev/posts/build-intelligent-android-apps-cloud-and-hybrid-inference-eyctih4y9) · Android Developers Blog · 0 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#javascript](https://daily.dev/tags/javascript), [#genai](https://daily.dev/tags/genai), [#prompt-engineering](https://daily.dev/tags/prompt-engineering), [#firebase](https://daily.dev/tags/firebase)

[View this post on daily.dev](https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Firebase AI Logic Tutorial #3 - Sending a Prompt","url":"https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb"},"datePublished":"2026-08-20T08:38:24.746Z","dateModified":"2026-08-20T08:38:44.242Z","description":"A step-by-step walkthrough shows how to send a prompt to a model using Firebase AI Logic, building a template string prompt that injects a selected personality...","image":"https://i.ytimg.com/vi/tOlpeOKCP7w/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/tOlpeOKCP7w/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Net Ninja","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Net Ninja","logo":"https://media.daily.dev/image/upload/s--IXsAE5jo--/f_auto/v1718348103/logos/netninja","url":"https://daily.dev/sources/netninja"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,javascript,genai,prompt-engineering,firebase","timeRequired":"PT5M","video":{"@type":"VideoObject","name":"Firebase AI Logic Tutorial #3 - Sending a Prompt","description":"A step-by-step walkthrough shows how to send a prompt to a model using Firebase AI Logic, building a template string prompt that injects a selected personality...","thumbnailUrl":"https://i.ytimg.com/vi/tOlpeOKCP7w/sddefault.jpg","uploadDate":"2026-08-20T08:38:24.746Z","duration":"PT5M","url":"https://api.daily.dev/r/FBQwuFlkb","embedUrl":"https://www.youtube.com/embed/tOlpeOKCP7w"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Net Ninja","item":"https://daily.dev/sources/netninja"},{"@type":"ListItem","position":3,"name":"Firebase AI Logic Tutorial #3 - Sending a Prompt"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/firebase-ai-logic-tutorial-3---sending-a-prompt-fbqwuflkb#faq","mainEntity":[{"@type":"Question","name":"Why do I get a 'Firebase App Check token is invalid' error when calling generateContent with Firebase AI Logic?","acceptedAnswer":{"@type":"Answer","text":"Firebase enables App Check enforcement by default, which blocks requests that lack a valid App Check token, including calls made through Firebase AI Logic's generateContent method. To fix it during development, go to the App Check section in the Firebase console, select the AI Logic API, click setup, and switch enforcement from enforced to unenforced; the change can take around 15 minutes to take effect. daily.dev surfaces gotchas like Firebase App Check blocking AI Logic requests before they cost you debugging time."}},{"@type":"Question","name":"How do I send a prompt to a model using Firebase AI Logic and display the response in a web app?","acceptedAnswer":{"@type":"Answer","text":"Build the prompt as a template string embedding dynamic variables, call the exported model's generateContent method with await, passing the prompt string as an argument, then read the generated text from response.text on the returned result. Store that text in component state so the UI rerenders with the model's output, and instruct the model in the prompt to return only the rewritten text with no preamble. Developers wiring AI responses into their UI can track practical Firebase AI Logic patterns on daily.dev."}}]}
```

