Skip to main content

App Mention Triggers

App mention triggers let your app respond to Reddit events even when those events happen outside the subreddit where your app is installed. App mention triggers are limited to app usernames.

Devvit currently supports one global trigger: onMentionInCommentCreate

note

This is a limited-access feature. Fill out this form to request access.

Example usage

Configure an app mention trigger the same way you configure other trigger events: declare the event in devvit.json, map it to an internal endpoint, then handle requests at that endpoint.

"triggers": {
"onMentionInCommentCreate": "/internal/triggers/on-mention-in-comment-create"
}

Then handle the app mention trigger event in your server:

server/index.ts
import type {
OnMentionInCommentCreateRequest,
TriggerResponse,
} from '@devvit/web/shared';

app.post('/internal/triggers/on-mention-in-comment-create', async (c) => {
console.log('Handle event for on-mention-in-comment-create!');
const input = await c.req.json<OnMentionInCommentCreateRequest>();
const commentId = input.comment?.id;
console.log('Comment ID:', commentId);
return c.json<TriggerResponse>({ status: 'ok' });
});

Playtesting app mention triggers

During development, you can playtest app mention trigger events only when the triggering event occurs in the playtest subreddit. Events from other subreddits do not invoke your app while you are playtesting.

Responding to app mention trigger events across Reddit

To receive app mention trigger events across Reddit, your app version must:

  • Be published and approved.
  • Be installed to the app's profile subreddit.

Profile subreddit installations

Some app versions can be installed to the app's profile subreddit. An app version is eligible when it has been approved and uses at least one app mention trigger event.

Eligible app versions appear in the Profile installation section of your app's settings page at developers.reddit.com/apps/your-app-slug.

Limitations

Apps do not receive app mention trigger events when:

  • The event does not pass safety checks, such as checks for illegal content. Events may contain NSFW content.