In app notification clarification

Hello,

I have the Data source hook set to send a push notification. I have added this code to the settings section of the data source, under “data source hook” and it works perfectly!

[
  {
    "type": "push",
    "appId": 12569,
    "runOn": [
      "insert"
    ],
    "payload": {
      "body": "{{{Body}}}",
      "title": "{{{Title}}}",
      "custom": {
        "customData": {
          "page": 381770,
          "action": "screen"
        }
      }
    }
  },
  {
    "type": "operations",
    "runOn": [
      "beforeSave",
      "beforeQuery"
    ],
    "payload": {},
    "widgetInstanceId": 4430921
  }
]

The page ID it is currently set to is a custom made list from data source, not the “in app” notifications screen. (This was a temporary solution)

Now I need to add the “In app” notification to it - is this the same place I would add coding for “In app” notifications? (Data source hook section)

What is needed to send “in app” notifications as well, and where would I put that coding?
Thank you

Hi Chase,

Unfortunately our DS hook system cannot send in-app notifications. It can only send push notifications. If you want to send an in app notification then you will need to add custom code. It depends on which user action triggers a notification for example submitting a form. Then you will need to use a form submit hook to trigger a notification. Here is an example:

Fliplet.Hooks.on("afterFormSubmit", function (response) {
  var instance = Fliplet.Notifications.init({});
  instance.insert({
    status: "published",
    data: {
     //Change title and message below if you want to access the form fields 
      title: "Greetings",
      message: "Hi John!",
      navigate: {
        action: "screen",
        page: 123,
        query: "?weather=sunny",
      },
    },
  });
});

Hope this helps,
Deb

1 Like

It makes perfect sense
YOU got it to work!

How can I pull from the form?

From column is called Title and Body to make it easy

Hi Chase,

You can use something like this:

Fliplet.Hooks.on("afterFormSubmit", function (response) {
  var instance = Fliplet.Notifications.init({});
  instance.insert({
    status: "published",
    data: {
     //Change title and message below if you want to access the form fields 
      title: response.result.data.Title,
      message: response.result.data.Body,
      navigate: {
        action: "screen",
        page: 123,
        query: "?weather=sunny",
      },
    },
  });
});

Thank you! Works perfectly!

Hello, I have run the same coding on another app of mine.

  1. I used the correct App ID for the data hook (this was for the Push notification portion) - This worked perfectly on my published app.

  2. I used the coding above for the “In-App” notification - but it didn’t work.
    Double-checked to see if everything was Identical.

I was thinking - A while back when I made the app, I remember publishing the app but also getting some sort of certificate for that app to allow notifications.

My question is, is there a certification process I need to do to allow in-app notifications?
Through apple or through google?

Just trying to figure out why it works on one app but not another. Thank you!