On app platform, how can we send an event on a URL click for the mobile SDK?

We have configured URLs inside of carousel cards and want to send an event when a user clicks on it.

The event will need to be sent to the mobile SDK.

Hi @Shraeyas
Try using Postback.

1 Like

What data will need to be added in postback?

Must be a code text, once you click the button the code comes back through some event in main function, from there you can do whatever you want based on the code implying what you have clicked.
I dont recall clearly, but this is what is was by in large.

1 Like

{
“title”: “View Status”,
“buttonDefault”: “url”,
“url”: “https://www.example.com/services/status”,
“postback”: “test-event”,
}

Got it. But right now, if I am adding any text in postback, it is trying to trigger a journey with that text and no events are being sent.

Hi @Shraeyas Are you saying if it were text instead of url, the text is triggering some other journey??

In that case,

  1. Use a text that doesnt meet minConfidence, or
  2. [Don’t Recommend]: Use customEntityRecognizer to override the prediction to 0.
1 Like

@Subhrajit_Gupta We are using a url only. The following is the json we are using for the particular button in a card.

{
  “title”: “View Status”,
  “buttonDefault”: “url”,
  “url”: “https://www.example.com/services/status”,
  “postback”: “test-event”,
}

I was saying inside of postback if we add some text, it is not sending an event, but tries to trigger an intent with that text.

Hi @Shraeyas,
This is the test code Im using to send Cards in app

return new Promise(resolve => {
    app.sendCards([
        {
            title: "check",
            text: "check texyt",
            actions: [
                {
                    'title': 'View Status',
                    'buttonDefault': 'url',
                    'url': 'https://www.example.com/services/status',
                    'postback': 'status-event',
                }
            ]
        }
    ]).then(()=>{
        return resolve()
    })
});

I cross verified previous development, it will come by message and not event.
So, make sure you have a unique postback text that will never be entered by anyone.
Ex: @@postback_key1
In main function

if (app.data.message == 'status-event') {
        app.sendQuickReplies({
            title: "TEST",
            options: []
        });
        return;
    }

Now youre saying its triggerring with > minConfidence to another intent.
So please choose the postback key with no confidence or you can override confidence[not recommended].

Hope this helps

1 Like