开发者

ATT API Notification Resource

开发者 https://www.devze.com 2023-04-12 10:22 出处:网络
When I issue a POST to a notification resource using the Javascript SDK I get back an id. <script type=\"text/javascript\">

When I issue a POST to a notification resource using the Javascript SDK I get back an id.

<script type="text/javascript">
ATT.Request(
    "notification",
    "post",
    function(){ //do stuff here },
    {"access_token" : my_access_token_here},
    {
      "interfaces": [
                {
                          "interface_id": 1
                        },
                {
                          "interface_id": 2
                },
                {
                          "interface_id": 3
                },
                {
                          "interface_id": 4
                }
      ],
      "custom_body": "This is a wonderful trip!",
      "target_response_info_type": "activity",
      "message_type": "22",
      "interfaces_custom_body": [
                {
                          "interface_id": 1,
                          "custom_subject": "none",
                          "custom_body": "This is a wonderful trip!"
                },
                {
                          "interface_id": 2,
                          "custom_subject": "none",
                          "custom_body": "This is a wonderful trip!"
                },
                {
                          "interface_id": 3,
                          "custom_subject": "none",
                          "custom_body": "This is a wonderful trip!"
                },
                {
                          "interface_id": 4,
                          "custom_subject": "none",
                          "custom_body": "This is a won开发者_如何学Cderful trip!"
                }
      ],
      "do_not_send": "0"
   } 
); 
</script>

Then when I issue a GET request to trip/5/messages, it does not show up.

<script type="text/javascript">
ATT.Request(
    "trip/13427/messages",
    "get",
    replaceWithYourOwnCallback,
    {"access_token" : "197d39aeb300c0a4b5e0b6a4d9624d0a"},
    postparams = null
);
</script>

What am I doing wrong?


In order to link the message to your trip you must include that trip in the related_object_type and related_object_id:

https://addtotrip.co/home/Resource?resource=notification

The post data should look like this:

{"access_token" : my_access_token_here},
{
  "related_object_type": "trip",
  "related_object_id": "13427",
  "interfaces": [
            {
                      "interface_id": 1
                    },
            {
                      "interface_id": 2
            },
            {
                      "interface_id": 3
            },
            {
                      "interface_id": 4
            }
  ],
  "custom_body": "This is a wonderful trip!",
  "target_response_info_type": "activity",
  "message_type": "22",
  "interfaces_custom_body": [
            {
                      "interface_id": 1,
                      "custom_subject": "none",
                      "custom_body": "This is a wonderful trip!"
            },
            {
                      "interface_id": 2,
                      "custom_subject": "none",
                      "custom_body": "This is a wonderful trip!"
            },
            {
                      "interface_id": 3,
                      "custom_subject": "none",
                      "custom_body": "This is a wonderful trip!"
            },
            {
                      "interface_id": 4,
                      "custom_subject": "none",
                      "custom_body": "This is a wonderful trip!"
            }
  ],
  "do_not_send": "0"

}

0

精彩评论

暂无评论...
验证码 换一张
取 消