Skip to content
Development

Customize OneSignal prompt text: acceptButton, cancelButton

Change the OneSignal permission prompt wording: which option names apply to the slide prompt and the old popup, and why your text may not change.

By WP24×7 engineers4 min readPublished August 29, 2021Updated November 29, 2026

At a glance

OneSignal asks visitors for permission to send push notifications. If your custom button text does not appear, the usual cause is the wrong option name for the prompt type. The slide prompt uses acceptButton and cancelButton inside a text object under promptOptions. This guide shows the code, a checklist of why the text does not change, tips on wording and languages, and how to test.

Updated November 29, 2026 · For WordPress developers using OneSignal push notifications

  • For developers customising OneSignal prompt wording on WordPress sites
  • Slide prompt use text.acceptButton and text.cancelButton inside slidedown.prompts
  • Old popup prompt used acceptButtonText and cancelButtonText, now largely obsolete
  • Cannot change the browser's native Allow and Block dialog
  • Check first wrong option names, dashboard overrides, cached script, two inits
  • Caveat OneSignal changes its SDK; compare option names with current documentation

OneSignal asks visitors for permission to send push notifications. If your custom button text does not appear, the usual cause is the wrong option name for the type of prompt you are using. The slide prompt uses `acceptButton` and `cancelButton` inside a `text` object. This guide is about the prompt wording, separate from the service worker setup in our OneSignal and PWA guide.

Which prompts does OneSignal show?

PromptCan you edit it?Notes
Browser native permission dialogNoThe browser owns the Allow or Block box
Slide prompt (slidedown)YesOneSignal's banner that asks first, then triggers the native dialog
Older HTTP or popup promptYes, with Text suffix optionsLargely obsolete since all sites should use HTTPS

Customising the wrong one explains many "it does nothing" reports. Earlier documentation mixed these up, which is why acceptButtonText on a slide prompt silently failed.

What is the code for the slide prompt?

Inside your OneSignal.init() call, set promptOptions:

window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(async function (OneSignal) {
	await OneSignal.init({
		appId: "YOUR-APP-ID",
		promptOptions: {
			slidedown: {
				prompts: [
					{
						type: "push",
						autoPrompt: true,
						text: {
							actionMessage: "Get a short alert when we publish something new.",
							acceptButton: "Yes, notify me",
							cancelButton: "No thanks"
						},
						delay: {
							pageViews: 2,
							timeDelay: 10
						}
					}
				]
			}
		}
	});
});
OptionWhat it does
type: "push"The prompt for push notifications (others cover email and SMS categories)
autoPrompt: trueShows it automatically once the delay rules are met; false to show it from a button
actionMessageThe question; keep it short and honest
acceptButton, cancelButtonThe two button labels
delay.pageViews, delay.timeDelayPostpone the prompt (seconds for timeDelay)

If the WordPress plugin initialises OneSignal for you, look for these prompt settings in its screens first. If you need code, turn off the plugin's initialisation, otherwise you will get two inits.

Why does the text not change?

  1. Wrong option names

    Slide prompts use acceptButton and cancelButton; names ending in Text belong to the older popup.

  2. Wrong location

    The text object must be inside the prompt object, inside slidedown.prompts.

  3. Dashboard overrides

    Prompts configured in OneSignal's dashboard may apply instead of your code. Change them in one place.

  4. Cached script

    A caching or optimisation plugin may serve an old init script. Clear it and exclude OneSignal scripts from minification and delay.

  5. Already subscribed or dismissed

    Test in a private window or clear site data.

  6. Two inits

    Check the page source for more than one OneSignal.init.

  7. Invalid config

    A stray comma or quote breaks the script; check the browser console.

How should I write good prompt text?

Short and specific beats clever. Tell visitors what they will get and how often, for example "Get an email-free alert when we post new guides." A clear cancel label such as "Not now" keeps the choice friendly. Do not mislead with fake system styling or imply that notifications are required. Browsers may drop sites with poor permission practices, and a high Block rate can reduce your future ability to ask. If the site is in the EU or UK, remember consent and privacy notice requirements, and ask your legal adviser how push subscriptions are treated for your business. Delay the prompt, or show it after a meaningful action such as finishing an article.

Ask first with your own prompt, then the browser's dialog

What about several languages?

Set the prompt text per language. OneSignal's SDK supports localised prompt text, and you can pick the language from your multilingual plugin's current locale in PHP and print the matching strings into the init script with wp_json_encode(). Keep translations short, because slide prompts have limited space, and test the longest language on a phone.

How do I test it?

  1. Open a private window, to avoid saved dismissals.

  2. Visit enough pages to satisfy delay.pageViews.

  3. Confirm the slide prompt shows your text.

  4. Click accept and check the browser's native dialog appears, which is expected.

  5. Check Application, Service Workers in DevTools for an active worker, and that the subscription appears in OneSignal's Audience list.

If the manifest or install banner gives separate errors, see the guide on the PWA manifest short_name.

Want push notifications integrated and tested?

Our team integrates them and tests across browsers.

FAQ

Questions people ask

12 answers. Can't find yours? Ask an engineer.

Why does my custom prompt text not change?

Usually the option name does not match the prompt type. Slide prompts use acceptButton and cancelButton, while older HTTP popup prompts used acceptButtonText and cancelButtonText.

Link to this answer
Can I change the text of the browser's own permission dialog?

No. The native Allow and Block dialog is controlled by the browser. You can only customise the OneSignal prompt that appears before it.

Link to this answer
Where do I put the code?

In the init call for the OneSignal SDK that you load from a child theme or small plugin, or in the plugin's own prompt settings if it offers them.

Link to this answer
What is the slide prompt?

OneSignal's own banner, also called slidedown, that asks first and then triggers the native dialog. You can change its message and buttons.

Link to this answer
What do delay.pageViews and delay.timeDelay do?

They postpone the prompt so it does not interrupt a first-time visitor. pageViews waits for a number of page views and timeDelay waits a number of seconds.

Link to this answer
My dashboard settings and my code disagree. Which wins?

Prompts configured in OneSignal's dashboard may apply instead of your code, depending on the SDK version. Change them in one place.

Link to this answer
Why does the prompt not show on repeat tests?

OneSignal remembers a dismissal or an existing subscription. Test in a private window or clear site data, then reload.

Link to this answer
The plugin already initialises OneSignal. What do I do?

Look for prompt settings in the plugin's own screens first. If you need code, turn off the plugin's initialisation, otherwise you get two inits.

Link to this answer
How do I write good prompt text?

Short and specific. Tell visitors what they will get and how often, use a friendly cancel label such as Not now, do not imply notifications are required, and delay the prompt until after a meaningful action.

Link to this answer
Can I translate the prompt?

OneSignal's SDK supports localised prompt text. Pick the language from your multilingual plugin's locale in PHP and print the strings into the init script with wp_json_encode, keeping translations short.

Link to this answer
Can you integrate push notifications for me?

Yes. Our WordPress development team integrates push notifications and tests them across browsers, and the plugin development service can build custom prompt logic.

Link to this answer

Keep reading

Want an engineer on it?

Tell us what is wrong in plain words. A person reads it, today.