Skip to content

Commit 603b80b

Browse files
fix(docs): improve bulk processing documentation consistency
1 parent e65e618 commit 603b80b

File tree

9 files changed

+1393
-125
lines changed

9 files changed

+1393
-125
lines changed

.vitepress/sidebar.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ export function getSidebar() {
252252
text: 'processProtectedData',
253253
link: '/references/dataProtector/methods/processProtectedData',
254254
},
255+
{
256+
text: 'prepareBulkRequest',
257+
link: '/references/dataProtector/methods/prepareBulkRequest',
258+
},
259+
{
260+
text: 'processBulkRequest',
261+
link: '/references/dataProtector/methods/processBulkRequest',
262+
},
255263
{
256264
text: 'getResultFromCompletedTask',
257265
link: '/references/dataProtector/methods/getResultFromCompletedTask',

src/guides/use-iapp/integrate-web3-messaging.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ You can send messages in two modes:
118118
- **Single Processing**: Send to one recipient using `sendEmail` or
119119
`sendTelegram`
120120
- **Bulk Processing**: Send the same message to multiple recipients efficiently
121-
using `prepareEmailCampaign` + `sendEmailCampaign` or
122-
`prepareTelegramCampaign` + `sendTelegramCampaign`
121+
using a two-step process: first call `prepareEmailCampaign` or
122+
`prepareTelegramCampaign` to prepare the campaign, then call
123+
`sendEmailCampaign` or `sendTelegramCampaign` to send it
123124

124125
### Single Message Processing
125126

@@ -160,14 +161,16 @@ const sendTelegram = await web3telegram.sendTelegram({
160161
Send the same message to multiple recipients efficiently in a single
161162
transaction.
162163

163-
**How it works:**
164+
**To send a bulk campaign, follow these steps in order:**
164165

165166
1. **Fetch contacts** with bulk access capability using `fetchMyContacts` or
166167
`fetchUserContacts` with `bulkOnly: true`
167-
2. **Prepare the campaign** using `prepareEmailCampaign` or
168-
`prepareTelegramCampaign` to create a bulk request
169-
3. **Send the campaign** using `sendEmailCampaign` or `sendTelegramCampaign` to
170-
process the bulk request
168+
2. **Prepare the campaign** by calling `prepareEmailCampaign` (for Web3Mail) or
169+
`prepareTelegramCampaign` (for Web3Telegram). This creates a bulk request
170+
object that groups all recipients together
171+
3. **Send the campaign** by calling `sendEmailCampaign` (for Web3Mail) or
172+
`sendTelegramCampaign` (for Web3Telegram) with the prepared bulk request.
173+
This processes all recipients in one or more efficient transactions
171174

172175
::: warning Prerequisites
173176

@@ -197,11 +200,9 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
197200
});
198201

199202
// Step 3: Send the bulk campaign
200-
const result = await web3mail.sendEmailCampaign({
203+
const { tasks } = await web3mail.sendEmailCampaign({
201204
campaignRequest: emailCampaign.campaignRequest,
202205
});
203-
204-
console.log(`Campaign sent! Created ${result.tasks.length} tasks`);
205206
```
206207

207208
```ts twoslash [Web3Telegram - Bulk]
@@ -222,11 +223,9 @@ const telegramCampaign = await web3telegram.prepareTelegramCampaign({
222223
});
223224

224225
// Step 3: Send the bulk campaign
225-
const result = await web3telegram.sendTelegramCampaign({
226+
const { tasks } = await web3telegram.sendTelegramCampaign({
226227
campaignRequest: telegramCampaign.campaignRequest,
227228
});
228-
229-
console.log(`Campaign sent! Created ${result.tasks.length} tasks`);
230229
```
231230

232231
:::

src/references/dataProtector/dataProtectorCore.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ DataProtector Core module contains the following set of methods:
4040
user for a protected data
4141
- **processProtectedData** — process a protected data with a specified iExec
4242
application
43+
- **prepareBulkRequest** — prepare a bulk request for processing multiple
44+
protected data items efficiently
45+
- **processBulkRequest** — process a prepared bulk request to execute bulk
46+
processing of multiple protected data items

0 commit comments

Comments
 (0)