Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ export function getSidebar() {
text: 'Run iApp without ProtectedData',
link: '/guides/use-iapp/run-iapp-without-ProtectedData',
},
{
text: 'Integrate Web3 Messaging',
link: '/guides/use-iapp/web3-messaging',
},
],
},
],
Expand Down Expand Up @@ -566,10 +570,7 @@ export function getSidebar() {
},
],
},
{
text: 'Integration Guide',
link: '/references/web3telegram/integration-guide',
},

{
text: 'Advanced Configuration',
link: '/references/web3telegram/advanced-configuration',
Expand Down
128 changes: 128 additions & 0 deletions src/guides/use-iapp/web3-messaging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
title: Integrate Web3 Messaging (Web3Mail & Web3Telegram)

Check notice on line 2 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L2

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 2, "column": 33}}}, "severity": "INFO"}
description:
End-to-end guide to send messages with Web3Mail (email) and Web3Telegram
(Telegram) using iExec — protect identifiers, grant access, and send securely
---

# Integrate Web3 Messaging

Check warning on line 8 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L8

[Google.Headings] 'Integrate Web3 Messaging' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Integrate Web3 Messaging' should use sentence-style capitalization.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 8, "column": 3}}}, "severity": "WARNING"}

This guide covers both Web3Mail (email) and Web3Telegram (Telegram) toolkit. The

Check notice on line 10 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L10

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 10, "column": 33}}}, "severity": "INFO"}
flow is the same, except that:

- For Web3Mail, you only need the user's email address.
- For Web3Telegram, you only need the user's Telegram Chat ID.

## Overview

1. (Telegram only) Get a Chat ID from the iExec bot

Check notice on line 18 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L18

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 18, "column": 4}}}, "severity": "INFO"}
2. Create the Protected Data using DataProtector Toolkit
3. Grant access of your Protected Data
4. Send the message using the relevant SDK ( Web3Mail / Web3Telegram )

Check notice on line 21 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L21

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 21, "column": 44}}}, "severity": "INFO"}

## 1. Retrieve the Telegram Chat ID (Telegram only)

Check warning on line 23 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L23

[Google.Headings] '1. Retrieve the Telegram Chat ID (Telegram only)' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '1. Retrieve the Telegram Chat ID (Telegram only)' should use sentence-style capitalization.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 23, "column": 4}}}, "severity": "WARNING"}

Check notice on line 23 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L23

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 23, "column": 37}}}, "severity": "INFO"}

Ask the recipient to open Telegram and start a conversation with
[@IExecWeb3TelegramBot](https://t.me/IExecWeb3TelegramBot). The bot replies with
a unique Chat ID.

::: tip

- Once the Chat ID is protected, all messages will arrive within this bot

Check notice on line 31 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L31

[Google.Passive] In general, use active voice instead of passive voice ('is protected').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is protected').", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 31, "column": 20}}}, "severity": "INFO"}

Check warning on line 31 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L31

[Google.Will] Avoid using 'will'.
Raw output
{"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 31, "column": 47}}}, "severity": "WARNING"}
conversation.
- The recipient can leave the conversation at any time to stop receiving
messages.

:::

## 2. Create the Protected Data

Check warning on line 38 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L38

[Google.Headings] '2. Create the Protected Data' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '2. Create the Protected Data' should use sentence-style capitalization.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 38, "column": 4}}}, "severity": "WARNING"}

Protect the email address or Chat ID using DataProtector Core.

::: code-group

```ts twoslash [Web3Mail]
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
const web3Provider = getWeb3Provider('PRIVATE_KEY');
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);

const protectedData = await dataProtectorCore.protectData({
data: {
email: 'user@example.com',
},
});
```

```ts twoslash [Web3Telegram]
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
const web3Provider = getWeb3Provider('PRIVATE_KEY');
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);

const protectedData = await dataProtectorCore.protectData({
data: {
telegram_chatId: '12345678',
},
});
```

:::

## 3. Grant Access

Check warning on line 70 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L70

[Google.Headings] '3. Grant Access' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '3. Grant Access' should use sentence-style capitalization.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 70, "column": 4}}}, "severity": "WARNING"}

Grant permission for a sender and/or an app to contact the user.

```ts twoslash
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
const web3Provider = getWeb3Provider('PRIVATE_KEY');
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);

const grantedAccess = await dataProtectorCore.grantAccess({
protectedData: '0x123abc...',
authorizedApp: '0x456def...',
authorizedUser: '0x789cba...',
pricePerAccess: 3,
numberOfAccess: 10,
});
```

## 4. Send the Message

Check warning on line 88 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L88

[Google.Headings] '4. Send the Message' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] '4. Send the Message' should use sentence-style capitalization.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 88, "column": 4}}}, "severity": "WARNING"}

::: code-group

```ts twoslash [Web3Mail]
import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';

const web3Provider = getWeb3Provider('PRIVATE_KEY');
const web3mail = new IExecWeb3mail(web3Provider);

const sendEmail = await web3mail.sendEmail({
protectedData: '0x123abc...',
emailSubject: 'My email subject',
emailContent: 'My email content',
// useVoucher: true,
});
```

```ts twoslash [Web3Telegram]
import { IExecWeb3telegram, getWeb3Provider } from '@iexec/web3telegram';

const web3Provider = getWeb3Provider('PRIVATE_KEY');
const web3telegram = new IExecWeb3telegram(web3Provider);

const sendTelegram = await web3telegram.sendTelegram({
protectedData: '0x123abc...',
senderName: 'Arthur',
telegramContent: 'My telegram message content',
});
```

:::

## Payment

Each message sent through Web3Mail or Web3Telegram requires payment in RLC

Check notice on line 123 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L123

[Google.Acronyms] Spell out 'RLC', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'RLC', if it's unfamiliar to the audience.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 123, "column": 72}}}, "severity": "INFO"}
tokens.

For detailed information about payment methods, pricing, and voucher usage, see
our comprehensive guide:

Check warning on line 127 in src/guides/use-iapp/web3-messaging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/use-iapp/web3-messaging.md#L127

[Google.We] Try to avoid using first-person plural like 'our'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "src/guides/use-iapp/web3-messaging.md", "range": {"start": {"line": 127, "column": 1}}}, "severity": "WARNING"}
[How to pay for executions](/guides/use-iapp/how-to-pay-executions)
4 changes: 2 additions & 2 deletions src/references/web3telegram.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ telegram chat ID recipients through use of Ethereum addresses.
iExec's protocol the telegram chat ID as a `protectedData` entity using
[iExec Data Protector](/references/dataProtector). Through this mechanism, users
have complete control over which applications may use their
[chat ID](/references/web3telegram/integration-guide#_1-get-your-users-to-retrieve-their-chat-id)
for sending communications.
[chat ID](/guides/use-iapp/web3-messaging#retrieve-chat-id) for sending
communications.

Sending a user a message, therefore, requires knowledge of the Ethereum address
of their `protectedData` as well as an explicit authorization for your account
Expand Down
112 changes: 0 additions & 112 deletions src/references/web3telegram/integration-guide.md

This file was deleted.