Applies To: ■ PoliteMail Desktop ■ PoliteMail Online ■ PoliteMail M365
Version: □ 4.94 □ 4.97 ■ 5.x
Message Tags and the PoliteMail API
Under SentMessages, there are three POST API calls that refer to Message Tags:
- GetByTag
- AddTag
- RemoveTag
Below is some sample code to show how these might be used. Please note that the code below is written specifically for version 5+ of PoliteMail, but the API calls are also available on version 4.972.
varmyHeaders=newHeaders(); myHeaders.append("Authorization", "Basic REPLACE WITH API KEY"); myHeaders.append("Content-Type", "application/json"); varraw=JSON.stringify({ "tag": "Tag Group Test: test" }); varrequestOptions= { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("/api/odata/SentMessages/GetByTag", requestOptions) .then(response=>response.text()) .then(result=>console.log(result)) .catch(error=>console.log('error', error)); varraw=JSON.stringify({ "tag": "Tag Group3: Hello Email", "messageGuid": "B56C9A4E-3D1F-4060-A384-01D6D3F27DE6", "groupId": 2 }); varrequestOptions= { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("/api/odata/SentMessages/AddTag", requestOptions) .then(response=>response.text()) .then(result=>console.log(result)) .catch(error=>console.log('error', error)); varraw=JSON.stringify({ "tag": "Tag Group3: dasdahtr" }); varrequestOptions= { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("/api/odata/SentMessages(12)/RemoveTag", requestOptions) .then(response=>response.text()) .then(result=>console.log(result)) .catch(error=>console.log('error', error));