Kogno
  • Introduction
  • Getting Started
    • Configuration
    • Starting the Server
    • Messenger Configuration
    • Telegram Configuration
    • WhatsApp Configuration
    • NLP Configuration
  • Conversation Class
  • Contexts
    • Blocks
      • before_anything
      • postback
      • deep_link
      • command
      • any_attachment
      • regular_expression
      • keyword
      • any_number
      • any_text
      • intent
      • entity
      • membership
      • recurring_notification
      • everything_else
      • after_all
    • Sub Contexts
    • Routing
    • Sequences
    • Conversational Forms
  • Replies / Notifications
    • text
    • button
    • quick_reply
    • raw
    • list
    • carousel
    • url
    • typing
    • image
    • video
    • html
    • markdown
    • contact
    • location
    • recurring_notification_request
    • messenger_generic_template
    • whatsapp_template
  • Templates
  • Models
    • User model
  • Scheduled Messages
  • Telegram Inline Query
  • Command Line
  • Global Methods
  • Internationalization
Powered by GitBook
On this page
  • recurring_notification_request(request=Hash)
  • Platforms
  • Usage
  • On-Demand
  • Reply
  • request param
  • Subscription Status
  • Sending Notifications

Was this helpful?

  1. Replies / Notifications

recurring_notification_request

Sends a subscription request for recurring notifications in Messenger, which can be: daily, weekly and monthly.

recurring_notification_request(request=Hash)

Platforms

Platform
Supported

Messenger

WhatsApp

Telegram

Usage

On-Demand

user = User.where(platform: :messenger).first
user.notification.recurring_notification_request(
    {
        title: "Want to get daily notifications from us?",
        image_url: "https://previews.123rf.com/images/aquir/aquir1909/aquir190907932/129839413-bot%C3%B3n-de-suscripci%C3%B3n-suscr%C3%ADbete-letrero-rojo-redondeado-suscribir.jpg?fj=1",
        payload: :subscribe,
        frequency: :daily,
        reoptin: true
    }
)
user.notification.send

Reply

class MainContext < Conversation

  def actions

    payload :get_started do
    
      @reply.text "Welcome!"
      @reply.recurring_notification_request(
        {
          title: "Whould you like to receive weekly notifications from us?",
          image_url: "https://previews.123rf.com/images/aquir/aquir1909/aquir190907932/129839413-bot%C3%B3n-de-suscripci%C3%B3n-suscr%C3%ADbete-letrero-rojo-redondeado-suscribir.jpg?fj=1",
          payload: :subscribe,
          frequency: :weekly,
          reoptin: true
        }
      )
    end
    
  end
  
end

request param

Name
Description

title String

Required.

The invitation/request title. The character limit is 65.

image_url String

Optional. The URL of the image to display.

payload String/Symbol

frequency Enum

Required. :daily, :weekly or :monthly.

reoptin Boolean

Optional. If true, sends a re opt-in template to the user after the set period for Recurring Notifications ends. By default false

timezone String

Action Block recurring_notification

Subscription Status

The user's subscription status can be verified by calling the messenger_recurring_notification_data() method on the User model.

user = User.where(platform: :messenger).first
user.messenger_recurring_notification_data
=> {:token=>"XXXXXXX", :frecuency=>"daily", :expires_at=>2022-11-21 18:06:31 UTC, :token_status=>"NOT_REFRESHED", :timezone=>"UTC", :status=>:active} 

Sending Notifications

To send a notification using the recurring notification token, just call send_using_token() method instead of send().

user = u = User.where(platform: "messenger").first
user.notification.text "Hello World!"
user.notification.send_using_token()
PreviouslocationNextmessenger_generic_template

Last updated 2 years ago

Was this helpful?

Required. After perms granted/removed event, a will be called if exists in the context.

Optional. Can be set by Pages which determine when they can send Recurring Notifications after user opt-in. If Pages do not specify a timezone, the default timezone is UTC. Please see the .

To capture the subscription and unsubscription events with this .

Learn more about Messenger Recurring Notification in the .

action block
official documentation
postback action block
list of valid time zones