# Contacts on BOT

> From the adapterProvider, we can utilize the store property to fetch all contacts, store them in a variable, and subsequently display them to the user. This property has the following signature:
>
> - **Canonical URL:** https://www.builderbot.app/en/providers/baileys/delete-on-bot
> - **Documentation Index:** https://www.builderbot.app/llms.txt
> - **Full Corpus:** https://www.builderbot.app/llms-full.txt

From the adapterProvider, we can utilize the store property to fetch all contacts, store them in a variable, and subsequently display them to the user. This property has the following signature:

```
(property) BaileysProvider.store?: {
    chats: KeyedDB<Chat, string>;
    contacts: {
        [_: string]: Contact;
    };
    messages: {
        [_: string]: {
            array: proto.IWebMessageInfo[];
            get: (id: string) => proto.IWebMessageInfo;
            ... 7 more ...;
            fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
        };
    };
    ... 18 more ...;
    readFromFile: (path: string) => void;
}
```
<strong>Contact</strong> structure:
```
Contact {
    id: string;
    lid?: string;
    name?: string;
    notify?: string;
    verifiedName?: string;
    imgUrl?: string | null | 'changed';
    status?: string;
}
```

```ts (app.ts)
import { createBot, createProvider, createFlow, addKeyword, EVENTS } from '@builderbot/bot'
import { BaileysProvider as Provider } from '@builderbot/provider-baileys'
import { MemoryDB as Database } from '@builderbot/bot'
import { config } from 'dotenv'
config()

const PHONE_NUMBER = process.env.PHONE_NUMBER
let contacts = {}

const welcomeFlow = addKeyword<Provider, Database>(EVENTS.WELCOME)
    .addAnswer(`💡 Example *Contacts on BOT*`)
    .addAction(
        async (_, { flowDynamic }) => {
            const contactsBot = Object.entries(contacts)
                .map(([id, data]) => ({ id, name: data }))
            await flowDynamic(`Total contacts: ${contactsBot.length}`)
            const messages: string[] = []
            for (const grupo of contactsBot) {
                const message = `${grupo.name ? 'Object:' : ''} ${JSON.stringify(grupo?.name, null, 5) || ''}\n*id:* ${grupo.id}`
                messages.push(message);
            }
            const concatenatedMessages = messages.join('\n\n')
            await flowDynamic(concatenatedMessages);
        }
    )

const main = async () => {
    const adapterFlow = createFlow([welcomeFlow])

    const adapterProvider = createProvider(Provider, { usePairingCode: true, phoneNumber: PHONE_NUMBER })
    const adapterDB = new Database()

    const { handleCtx, httpServer } = await createBot(
        {
            flow: adapterFlow,
            provider: adapterProvider,
            database: adapterDB,
        }
    )

    try {
        adapterProvider.on("ready", () => {
            if (adapterProvider.store && adapterProvider.store.contacts) {
                contacts = adapterProvider.store.contacts
            }
        })
    } catch (error) {
        console.log(error)
    }
}

main()

```

<img style= className="rounded-2xl bg-zinc-900 w-full shadow-md dark:ring-1 dark:ring-white/10" src="/assets/examples/contactsOnBot.png" alt="API Call Example" />

---
