Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmtp.chat deeplink #13

Merged
merged 8 commits into from
Jan 26, 2025
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Result:

> Learn more about [`lookup`](/packages/lookup/) library

## Quickstart
## Development

```bash
# clone the repository
Expand Down
2 changes: 1 addition & 1 deletion examples/gated-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const agent = await xmtpClient({
);
console.log("Group created", group?.id);
await client.send({
message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://converse.xyz/group/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`,
message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat/conversations/${group?.id}: \n- This url will deeplink to the group created\n- Once in the other group you can share the invite with your friends.`,
originalMessage: message,
});
return;
Expand Down
5 changes: 2 additions & 3 deletions examples/gated-group/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ async function main() {
message.sender.address,
client.address as string,
);
console.log("Group created", group?.id);
await client.send({
message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://converse.xyz/group/${group?.id}: \n- This url will deelink to the group inside Converse\n- Once in the other group you can share the invite with your friends.`,
message: `Group created!\n- ID: ${group?.id}\n- Group URL: https://xmtp.chat/conversations/${group?.id}: \n- This url will deeplink to the group created\n- Once in the other group you can share the invite with your friends.`,
originalMessage: message,
metadata: {},
});
Expand Down Expand Up @@ -68,7 +67,7 @@ async function main() {
);
});
console.log(
`XMTP client initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`,
`XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function main() {
});

console.log(
`XMTP agent initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`,
`XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gpt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function main() {
});

console.log(
`XMTP client initialized on ${client.address}\nSend a message on https://xmtp.chat/dm/${client.address}`,
`XMTP agent initialized on ${client.address}\nSend a message on http://xmtp.chat/dm/${client.address}`,
);
}

Expand Down
28 changes: 28 additions & 0 deletions packages/agent-starter/tests/Deeplink.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { XMTP } from "@xmtp/agent-starter";
import { describe, expect, test } from "vitest";

describe("Deeplink Tests", () => {
test("If no dm created, create one", async () => {
const xmtp = new XMTP();
await xmtp.init();

if (!xmtp.address) {
expect(xmtp.address).toBeUndefined();
return;
}
const inboxId = await xmtp.client?.getInboxIdByAddress(xmtp.address);
if (!inboxId) {
expect(inboxId).toBeUndefined();
return;
}

let dm = xmtp.client?.conversations.getDmByInboxId(inboxId);
console.log("dm", dm);
if (!dm) {
const dmGroup = await xmtp.client?.conversations.newDm(xmtp.address);
dm = dmGroup;
}
console.log("dm", dm?.id);
expect(dm?.id).toBeDefined();
}, 25000);
});
Loading