#Expo Notifications and Convex

7 messages · Page 1 of 1 (latest)

abstract bronze
#

@small glacier I have a react native expo app, and looking for opinions on running expo notifications from the server.

should i use convex actions to run the notifications service or run a more traditional backend for it?

small glacierBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Convex is designed to simplify the development of web applications by providing a global state management system that runs in the cloud. This allows developers to easily build interactive and collaborative applications without managing backend infrastructure.

With Convex, you effectively create an API, and call that API from any clients you wish. This means you can use Convex to manage your notifications service. Convex's cloud functions could be used to handle the logic for sending notifications.

However, the decision between using Convex actions or a more traditional backend depends on your specific needs and the complexity of your notifications service. If your notifications logic is simple and you're already using Convex for other parts of your app, it might be easier and more efficient to use Convex. On the other hand, if your notifications service requires complex backend logic, a traditional backend might be more suitable.

Here are some resources that might help you make your decision:

Remember, the best choice depends on your specific use case and requirements.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@abstract bronze kapa.ai is still learning and improving, please let us know how it did by reacting below

abstract bronze
#

@small glacier show me a few examples of how i would create apis for a expo notification service

small glacierBOT
#

Let me check the knowledge base for you. One moment! :books:

#

I'm sorry, but the provided knowledge sources do not contain specific examples of creating APIs for an Expo notification service using Convex. However, I can guide you on how you might structure your Convex functions to handle notifications.

In general, you would create a Convex function for each distinct operation your notification service needs to perform. For example, you might have one function to create a notification, another to send a notification, and another to mark a notification as read.

Here's a general example of how you might define a Convex function:

import { ConvexClient } from "convex/browser";  
import { anyApi } from "convex/server";  
  
const CONVEX_URL = "<http://your-convex-url";>  
const client = new ConvexClient(CONVEX_URL);  

// Define a function to create a notification
client.mutation(anyApi.notifications.create, {  
  title: "Your notification title",
  message: "Your notification message",
  recipient: "Recipient's ID",
});

In this example, anyApi.notifications.create would be a Convex function you've defined on the server to handle creating a notification. The second argument to client.mutation is the data you're passing to the function.

Please note that this is a very general example and the actual implementation would depend on the specifics of your application and notification service.

For more information on using Convex, you can refer to the Convex documentation (https://docs.convex.dev/).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: