Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

Set up title for in-app message via api

Stefan Richter

How can I set up title for in-app message via API when send request to push notification?

Example of my request

$client->post('push', [
\GuzzleHttp\RequestOptions::JSON => [
'audience' => [
'named_user' => '123-test-test',
],
'notification' => [
'alert' => '123',
'actions' => [
'open' => [
'type' => 'deep_link',
'content' => json_encode([
'path' => 'order',
'params' => [
'id' => 123
],
]),
],
],
'ios' => [
'alert' => 'Hello iOS!',
'title' => 'Insert title here',
],
'android' => [
'alert' => 'Hello iOS!',
'title' => 'Insert title here',
],
],
'device_types' => ['ios', 'android', 'web'],
'in_app' => [
'alert' => 'test',
'display_type' => 'banner',
'expiry' => \Carbon\Carbon::now()->addDays(7)->format('Y-m-d\TH:i:s'),
'display' => [
'position' => 'top',
],
'actions' => [
'add_tag' => 'in-app',
'open' => [
'type' => 'deep_link',
'content' => json_encode([
'path' => 'order',
'params' => [
'id' => 123
],
]),
],
],
]
]
]);


Please sign in to leave a comment.

0
Avatar

Hi Stefan,

You have this in your request:

[ 'alert' => 'Hello iOS!', 'title' => 'Insert title here', ]

This seems to allow you to add the title. Have you tried executing it and if so, do you have any errors or error messages you can show me?

Kind regards,
Chilun Liu
Senior Technical Support Engineer
Airship

The Embassy Tea House, 195-205 Union Street, London, SE1 0LN
Portland | San Francisco | London | Paris | New York | New Delhi

 

chilun liu 0 votes
0
Avatar

Chilun Liu, these parameters applied to push notification, but not for in-app message.

Stefan Richter 0 votes
0
Avatar

Hi Stefan,

I've just checked this and it seems that the "title" field is not there according to the documentation/help repository, link below:

https://docs.airship.com/api/ua/#schemas/inappobject

However, after testing the following example, the 'alert' field ('This part appears in-app!') seems to do the job of the title that you have asked earlier. May I ask if you can test using the 'alert' field and let me know if this works for you?

{
   "audience": "all",
   "device_types": [ "ios", "android" ],
   "notification": { "alert": "This part appears on the lockscreen" },
   "in_app": {
      "alert": "This part appears in-app!",
      "display_type": "banner",
      "expiry": "2015-04-01T12:00:00",
      "display": {
         "position": "top"
      },
      "actions": {
         "add_tag": "in-app"
      }
   }
}
chilun liu 0 votes
0
Avatar

How can I edit my alert in push notification with html tags? I want to send an alert with two separate lines of text.

For example, 'alert' => 'Hi {First Name}! <br/> Some info text.'

Thank you in advance.

 

Stefan Richter 0 votes