An API that connects multiple Microsoft services, enabling data access and automation across platforms
Application permissions are ONLY supported when team is under migration mode as the documentation lists here https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http
Your request above failed because it using application-only permissions and not delegated permissions.
You need to use delegated permissions.
You can automate with delegated permissions as well. One such way is using Power Automate. Otherwise if you want to build an app yourself you need to use offline_access (https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#offline_access) scope in addition to other required scopes. That way when the user sign ins and the token is acquired you will get additional refresh tokens which are long lived.
For atmentioning users - https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-2--a-user-in-a-channel-message
atmentioning channel - https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-7---a-channel-in-a-channel-message
atmentioning tag - https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-beta&tabs=http#example-9---a-tag-in-a-channel-message (this is in beta only at the moment)
@Siarhei Sintsou The same answer applies for your case as well as mentioned in the other question. You need a user to signin into your app and then make the calls on their behalf.