# integrating Django-postman

**URL:** <https://forum.djangoproject.com/t/integrating-django-postman/28077>\
**Category:** Async/Channels\
**Created:** [February 14, 2024, 2:52pm UTC](https://forum.djangoproject.com/t/integrating-django-postman/28077 "2024-02-14T14:52:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 14, 2024, 3:32pm UTC](https://forum.djangoproject.com/t/integrating-django-postman/28077/6 "2024-02-14T15:32:36Z")

</div>

> [@silentmike9211](#):
>
> `async_to_sync(channel_layer.send)('notifications', {`

This is attempting to send to a channel named “notifications”.

Unless you have a worker process associated with that name, there’s no place to deliver the message to.

If you’re looking to send a message to a specific user, you need to “locate” that user.

The method that I use, is that every user logging on joins a group named `user_<username>`. (e.g. `user_ken`).

Any other channels client can send a message to me by sending a message to the _group_ `user_ken`.  
Example from what you have above:

```auto
def send_notification(message):
 # This will print the message to the console
    print(f"Sending message: {message}")

    # assume that the target username is in `message.username`
    group_name = f'user_{message.username}'
    # This will send the message to the client.
    async_to_sync(channel_layer.group_send)(group_name, {
        'type': 'notification.message',
        'message': message
    })

```

Otherwise, you would need to know the precise channel name for that user in order to direct the message to that user.

---

_[View the full topic](https://forum.djangoproject.com/t/integrating-django-postman/28077)._
