Presets API
createPreset
Anchor link toPOST https://api.pushwoosh.com/json/1.3/createPreset
สร้าง preset ใหม่
Request Body
Anchor link to| Name | Type | Description |
|---|---|---|
| auth* | string | API access token จาก Pushwoosh Control Panel |
| name* | string | ชื่อ Preset |
| applicationCode* | string | Pushwoosh application code |
| campaignCode | string | รหัสของแคมเปญ ที่คุณต้องการกำหนดให้กับ preset นี้ |
| content* | object | พารามิเตอร์เนื้อหาข้อความ |
| content.message* | string | String หรือ array เนื้อหาข้อความ ในกรณีที่เป็น string จะใช้ภาษา “Default” |
| content.action | object | พารามิเตอร์ custom action ดูตัวอย่างด้านล่าง |
| content.userData | array | ข้อมูลผู้ใช้แบบกำหนดเอง จะถูกส่งเป็นพารามิเตอร์ “u” ใน payload (แปลงเป็น JSON string) |
| content.properties | array | เนื้อหาเฉพาะสำหรับแพลตฟอร์มต่างๆ ดูตัวอย่างด้านล่าง |
| scheduling.sendRate | integer | การจำกัดความเร็ว (Throttling) ค่าที่ใช้ได้คือตั้งแต่ 100 ถึง 1000 push ต่อวินาที |
| segmentation | object | พารามิเตอร์การแบ่งกลุ่ม (Segmentation) |
| segmentation.filter | string | ชื่อ Segment (filter) |
| segmentation.platforms* | array | Array ของจำนวนเต็ม รายการของ platform ID: 1 - iOS, 3 - Android, 7 - Mac OS X, 8 - Windows, 9 - Amazon, 10 - Safari, 11 - Chrome, 12 - Firefox |
{ "status_code": 200, "status_message": "OK"}{ "request": { "auth": "yxoPUlwqm…………pIyEX4H", // จำเป็น API access token จาก Pushwoosh Control Panel "name": "PRESET_NAME", // จำเป็น "applicationCode": "XXXXX-XXXXX", // จำเป็น Pushwoosh application code "applicationGroupCode": "AAAAA-BBBBB", // ไม่จำเป็น สามารถใช้แทน "applicationCode" ได้ "campaignCode": "CCCCC-DDDDD", // ไม่จำเป็น รหัสแคมเปญ "content": { // จำเป็น ประกอบด้วยข้อมูลข้อความ "message": { // จำเป็น string หรือ object เนื้อหาข้อความ ในกรณีที่เป็น "en": "English message", // string จะใช้ภาษา default "fr": "French message" // เนื้อหาข้อความที่แปลเป็นภาษาต่างๆ }, // ใช้รหัสภาษาตามมาตรฐาน ISO 639-1:2002 เท่านั้น "title": { // ไม่จำเป็น string หรือ object สำหรับหลายภาษา ให้ตั้งค่า title "en": "English title", // สำหรับแต่ละภาษาใน object จะถูกละเลยหาก "fr": "French title" // มีการระบุ title เฉพาะของแพลตฟอร์ม (เช่น }, // 'ios_title', 'android_header' ฯลฯ; ดูตัวอย่าง // พารามิเตอร์เฉพาะของแพลตฟอร์มใน // API /createMessage) "subtitle": { // ไม่จำเป็น string หรือ object สำหรับหลายภาษา ให้ตั้งค่า title "en": "English subtitle", // สำหรับแต่ละภาษาใน object จะถูกละเลยหาก "fr": "French subtitle" // มีการระบุ subtitle เฉพาะของแพลตฟอร์ม (เช่น }, // 'ios_subtitle' ฯลฯ; ดูตัวอย่างพารามิเตอร์ // เฉพาะของแพลตฟอร์มใน API /createMessage) "action": { // ไม่จำเป็น การดำเนินการที่จะทำเมื่อผู้ใช้เปิดข้อความ "type": "url", // ไม่จำเป็น ประเภทของการดำเนินการ ประเภทที่ใช้ได้: "url", "deepLink", // "richMedia", "openApp"(ค่าเริ่มต้น) "options": { // ไม่จำเป็น ตัวเลือกสำหรับประเภทการดำเนินการ จำเป็นสำหรับทุกประเภท // การดำเนินการยกเว้น "openApp" "url": "https://example.com", // จำเป็นสำหรับประเภทการดำเนินการ "url", string จะถูกย่อ // หากมีการกำหนดตัวย่อลิงก์ "shortener": 2, // ไม่จำเป็น ค่าที่ใช้ได้: 0 - ไม่ย่อ, 2 - bit.ly // หากไม่ระบุตัวย่อลิงก์ จะใช้ bit.ly // เป็นค่าเริ่มต้น "richMediaCode": "BBBBB-AAAAA", // จำเป็นสำหรับประเภทการดำเนินการ "richMedia", string // รหัส Rich Media จาก Pushwoosh Control Panel "id": 123, // จำเป็นสำหรับประเภทการดำเนินการ "deepLink", integer รหัส Deep Link "params": { // ไม่จำเป็น, พารามิเตอร์กำหนดเอง, จำเป็นสำหรับประเภทการดำเนินการ "deepLink", array "param1": "value1", "param2": "value2" } } }, "userData": { // ไม่จำเป็น ข้อมูลผู้ใช้แบบกำหนดเอง จะถูกส่งเป็นพารามิเตอร์ "u" "CustomData": "value" // ใน payload (แปลงเป็น JSON string) }, "platforms": { "ios": { "sound": "default", "silent": 1, "ttl": 604800, "rootParams": { "rule_id": "12345", "screen_id": "34567" }, "interruptionLevel": "active" }, "android": { "rootParams": { "rule_id": "12345", "screen_id": "34567" } } } }, "scheduling": { // ไม่จำเป็น ตัวเลือกการกำหนดเวลา "sendRate": 1000 // ไม่จำเป็น การจำกัดความเร็ว ค่าที่ใช้ได้คือ 100 ถึง 1000 push ต่อวินาที }, "segmentation": { // จำเป็น ตัวเลือกการแบ่งกลุ่ม "filter": "FILTER NAME", // ไม่จำเป็น ชื่อ Filter จาก Pushwoosh Control Panel ของคุณ "platforms": [1, 3] // จำเป็น รายการของ platform ID: 1 — iOS; 3 — Android; // 7 — Mac OS X; 8 — Windows; 9 — Amazon; 10 — Safari; // 11 — Chrome; 12 — Firefox; } }}getPreset
Anchor link toPOST https://api.pushwoosh.com/json/1.3/getPreset
ดึงพารามิเตอร์ของ push preset ที่ระบุ
Request Body
Anchor link to| Name | Type | Description |
|---|---|---|
| auth* | string | API access token จาก Pushwoosh Control Panel |
| preset_code* | string | รหัส preset ของ Push เพื่อดึงข้อมูล |
{ "status_code": 200, "status_message": "OK", "response": { "preset": { "code": "XXXXX-XXXXX", "name": "Full preset", "page_id": 26, "url": null, "content": { "en": "Some message", "de": "Eine Nachricht" }, "properties": { "ignore_user_timezone": 1, "ios_badges": "5", "ios_sound": "default", "ios_ttl": "43200", "android_sound": "Sound1.wav", "android_custom_icon": "icon.png", "android_header": "android_header", "android_gcm_ttl": "43200", "wns_type": "toast", "wns_content": { "template": "ToastImageAndText02", "lang-en": { "headlinetext": "Title", "bodytext": "super text" }, "languages": ["en", "zh", "it", "sv", "de", "fr", "pt", "nl", "es"], "lang-zh": { "headlinetext": "", "bodytext": "" }, "lang-it": { "headlinetext": "", "bodytext": "" }, "lang-sv": { "headlinetext": "", "bodytext": "" }, "lang-de": { "headlinetext": "", "bodytext": "" }, "lang-fr": { "headlinetext": "", "bodytext": "" }, "lang-pt": { "headlinetext": "", "bodytext": "" }, "lang-nl": { "headlinetext": "", "bodytext": "" }, "lang-es": { "headlinetext": "", "bodytext": "" }, "imagesource": "https:\/\/image.com\/jpg" }, "adm_sound": "song", "adm_custom_icon": "i5.bmp", "adm_header": "Amazon Header", "adm_ttl": "7200", "safari_title": "Safari title", "safari_action": "OK", "safari_url_args": ["hello.com", ""], "safari_ttl": "43200", "userdata": "{\"custom\":\"data\"}", "created_via": "CP", "user_id": 2, "filter_id": "1" }, "platforms": [1, 3, 7, 10, 11] } }}{ "request":{ "auth": "yxoPUlwqm…………pIyEX4H", // จำเป็น API access token จาก Pushwoosh Control Panel "preset_code": "AAAAA-BBBBB" // จำเป็น รหัส push preset เพื่อดึงข้อมูล }}listPresets
Anchor link toPOST https://api.pushwoosh.com/json/1.3/listPresets
ดึงรายการ presets ที่สร้างขึ้นสำหรับแอป
Request Body
Anchor link to| Name | Type | Description |
|---|---|---|
| auth* | string | API access token จาก Pushwoosh Control Panel |
| application* | string | Pushwoosh application code |
{ "status_code": 200, "status_message": "OK", "response": { "presets": [] }}{ "status_code": 200, "status_message": "OK", "response": { "presets": [{ "name": "test", "code": "AAAAA-BBBBB" }] }}{ "request": { "auth": "yxoPUlwqm…………pIyEX4H", // จำเป็น API access token จาก Pushwoosh Control Panel "application": "XXXXX-XXXXX" // จำเป็น Pushwoosh application code }}deletePreset
Anchor link toPOST https://api.pushwoosh.com/json/1.3/deletePreset
ลบ preset ออกจากบัญชีของคุณ
Request Body
Anchor link to| Name | Type | Description |
|---|---|---|
| auth* | string | API access token จาก Pushwoosh Control Panel |
| preset_code* | string | รหัส Preset ที่ดึงมาจาก Pushwoosh Control Panel หรือการตอบกลับของ API /listPresets |
{ "status_code": 200, "status_message": "OK", "response": null}{ "request": { "auth": "yxoPUlwqm…………pIyEX4H", // จำเป็น API access token จาก Pushwoosh Control Panel "preset_code": "AAAAA-BBBBB" // จำเป็น รหัสของ preset ที่จะลบ }}