1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "messages": [
12 {
13 "id": "promo-1",
14 "text": "FLASH SALE!!! 40% off everything today only – shop now: bit.ly/3xAmPle",
15 "brand": "Example Shoes"
16 },
17 {
18 "id": "welcome-1",
19 "messageType": "optInConfirmation",
20 "brand": "Example Shoes",
21 "text": "Example Shoes: Thanks for joining! Reply STOP to cancel."
22 },
23 {
24 "id": "promo-2",
25 "text": "Example Shoes: Hi {{first_name}}, your account has been suspended. Verify your account at http://example-shoes-help.com",
26 "brand": "Example Shoes"
27 },
28 {
29 "id": "welcome-2",
30 "messageType": "optInConfirmation",
31 "brand": "Example Shoes",
32 "text": "Example Shoes: You're signed up for sale alerts. Up to 4 msgs/mo. Msg & data rates may apply. Reply HELP for help, STOP to cancel."
33 }
34 ]
35};
36
37
38const run = await client.actor("ultimatemc/sms-marketing-message-checker").call(input);
39
40
41console.log('Results from dataset');
42console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48