Open NathanC opened 2 years ago
Have you checked displayname_template
in the config?
do you have any news?
Have you checked
displayname_template
in the config?
I have configiration like this: displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)" But contacts appear only when someone texts me on Whatsapp. What wrong? (bridge ver. 0.8.0)
I have used spantaleev/matrix-docker-ansible-deploy to setup the bridge.
In their template they have this configuration Line config.yaml#L95.
I also enabled backfilling support and when the contacts were synced after login most of them were just <international number> (WA)
I have the same problem. Used the Ansible but none of the configs seem to work. I added "|" before "bridge:" and tried many different display_template versions but none worked. Sometimes I get an error in the script because of typo but I don't know what to change.
matrix_mautrix_whatsapp_configuration_extension_yaml:` |
bridge:
delivery_receipts: true
history_sync:
backfill: true
user_avatar_sync: true
archive_tag: m.lowpriority
# displayname_template: "{{or .FullName .PushName .JID}} -W"
# displayname_template: "{{ '{{.FullName}} ' }}"
# The following variables are also available, but will cause problems on multi-user instances:
# {{ '{{.FullName}}' }} - full name from contact list
# {{ '{{.FirstName}}' }} - first name from contact list
# displayname_template: "{{ '{{if .BusinessName}}{{.BusinessName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)' }}"
# Should the bridge create a space for each logged-in user and add bridged rooms to it?
displayname_template: "{{ '{{if .FullName}}{{.FullName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)' }}"
# displayname_template: "{{ '{{if .BusinessName}}{{.BusinessName}}{{else if .PushName}}{{.PushName}}{{else}}{{.JID}}{{end}} (WA)' }}"
# displayname_template: "{{.Short}}"
# displayname_template: "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)"
# displayname_template: "{{if .PushName}}{{.PushName}}{{else if .BusinessName}}{{.BusinessName}}{{else}}{{.JID}}{{end}} (WA)"
I have used spantaleev/matrix-docker-ansible-deploy to setup the bridge. In their template they have this configuration Line config.yaml#L95. I also enabled backfilling support and when the contacts were synced after login most of them were just
<international number> (WA)
`
I simply used
displayname_template: "{{or .FullName .BusinessName .PushName .JID}} (WA)"
and it works like a charm.
I simply used
displayname_template: "{{or .FullName .BusinessName .PushName .JID}} (WA)"
and it works like a charm.
Thank you for your suggestion. I tried it, when I run the Ansible script it says
msg: |-
The task includes an option with an undefined variable. The
error was: {{ matrix_mautrix_whatsapp_configuration_yaml | fro
m_yaml | combine(matrix_mautrix_whatsapp_configuration_extensio
n, recursive=True) }}: {{ matrix_mautrix_whatsapp_configuration
_extension_yaml | from_yaml if matrix_mautrix_whatsapp_configur
ation_extension_yaml | from_yaml is mapping else {} }}: bridge:
delivery_receipts: true
history_sync:
backfill: true
user_avatar_sync: true
archive_tag: m.lowpriority
displayname_template: "{{or .FullName .BusinessName .Push
Name .JID}} (WA)"
: 'or' is undefined
Then I only used .FullName: displayname_template: "{{.FullName}} -W" and got this Error message:
ERROR! We were unable to read either as JSON nor YAML, these ar
e the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/work/inventory/host_vars/matrix.8t
om.de/vars.yml': line 53, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
# displayname_template: "{{or .FullName .PushName .JID}} -W"
displayname_template: "{{.FullName}} -W"
^ here
We could be wrong, but this one looks like it might be an issue
with
missing quotes. Always quote template expression brackets when
they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
Then I tried displayname_template: "{{ '{{.FullName}}' }}" and got also an Error:
ERROR! We were unable to read either as JSON nor YAML, these ar
e the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/work/inventory/host_vars/matrix.8t
om.de/vars.yml': line 54, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
# displayname_template: "{{.FullName}} -W"
displayname_template: "{{ '{{.FullName}}' }}"
^ here`ERROR! We were unable to read either as JSON nor YAML, these ar
e the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/work/inventory/host_vars/matrix.8t
om.de/vars.yml': line 54, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
# displayname_template: "{{.FullName}} -W"
displayname_template: "{{ '{{.FullName}}' }}"
^ here
Seems Syntax related but I have no clue 😓
Ansible is treating {{or .FullName .BusinessName .PushName .JID}}
as an Ansible (in fact, Jinja) template and trying to process it.
To keep Ansible from processing that (so it is written exactly like that in the configuration file), you might need to enclose it between {% raw %}
and {% endraw %}
(see an example here).
Thank you @avm99963 I issued the problem also at the GitHub Ansible matrix: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2962
With the tips from here and from them I got following solution:
displayname_template: "{{or .FullName .PushName .JID}} (WA)"
needs to enclosed by {% raw %} and {% endraw %} :
displayname_template: {% raw %}{{or .FullName .PushName .JID}} (WA){% endraw %}
Hello, I am also running matrix-docker-ansible-deploy.
When I enabled the bridge and logged in with the qr code it started backfilling all my chats, most of my DM had a name.
The when it completed the backfill almost the entirety of my contacts was renamed with the phone number, the all show something like this:
After reading this issue I changed my displayname_template
to '{{or .FullName .BusinessName .PushName .Phone}} (WA)'
(validated looking at the config file in the docker container) but nothing changed.
I have all my contacts with a name in my iPhone, but it does not show up on matrix.
A few of them (maybe 10) have a name that is likely the PushName
.
Is changing the displayname_template
and restartinfg the bridge enough to refresh the names or should I do something elese, 'cause nothing seems to change the names.
So is it no longer possible to create your own individual name in the matrix room?
I don't have any contacts stored on my dedicated WhatsApp phone, why should I? New WA contacts are created via the bridge bot with start-chat
.
But if someone calls themselves .
or something similar, it's rather unattractive.
I have a working syncing now, but I made several changes simultaneously, so I can't tell which one fixed it.
Here is what I did:
logout <login ID>
delete-all-portals
login qr
Now it's a few days and my contact names are stable.
I just set up the bridge. If I list all my contacts, it shows the picture + full name + number. However, the display name for the user is just the number followed by
(WA)
.Is it possible to get the display name to be the contact name +
(WA)
? If so, how?