How-To

Unisender setHook "Can not connect to host": fix hook_url

The Unisender error "'hook_url' - Can not connect to host" means Unisender could not reach your webhook URL when you registered it. Allow every IP that api.unisender.com resolves to in your firewall (one ELMA365 user needed four), confirm the URL answers over public HTTPS, then retry setHook.

Sohail HussainSohail Hussain8 min read

Short answer

  • Allow every IP address that api.unisender.com resolves to through the firewall, WAF or hosting filter in front of your webhook URL, then call setHook again.
  • Check your server's access log after the retry, and allow whichever source address appears. Do not rely on a short list from a support reply.

You are registering a webhook, either directly through the API or through an ELMA365 module, and the call returns this:

Указано неправильное значение одного из аргументов метода: 'hook_url' - Can not connect to host

In ELMA365 it is wrapped in the message "Ошибка вызова метода API Unisender "setHook"". Roughly translated: an incorrect value was given for the hook_url argument, and a connection to the host could not be made. The wording points at a typo in the URL, but in the reported case the URL was fine and traffic from Unisender's addresses was being blocked.

Why Unisender cannot connect to your hook_url

setHook is the Unisender API method for registering a callback URL (hook_url). The error blames that argument and says it could not connect. That suggests the failure is a reachability problem and not an invalid API key. I could not find Unisender documentation that describes exactly how or from which addresses the check runs, so treat the list below as the usual suspects, not a confirmed mechanism.

Causes, most common first:

  1. A firewall or IP allowlist in front of the endpoint. Typical for on-premise ELMA365, corporate networks and hosting panels with inbound rules. In one reported ELMA365 case, the connection worked only after the addresses behind api.unisender.com were allowed. Support had named three addresses, and four turned out to be needed.
  2. A WAF, CDN or bot protection rule. A challenge page or geo-block aimed at data center traffic looks like a failed connection to a webhook caller.
  3. A URL that is not publicly reachable. Internal-only DNS names, private IPs, or a port closed to the internet.
  4. TLS problems. An expired, self-signed or incomplete certificate chain on an https:// URL.
  5. A redirect. An http-to-https or trailing-slash redirect on the URL you registered.

Fix 1: allow the addresses behind api.unisender.com

  1. Resolve the name yourself:

    dig +short api.unisender.com
    nslookup api.unisender.com
    
  2. Run the lookup several times, and from more than one resolver if you can. A name can return different addresses on different queries, which is how a three-address list ends up one short.

  3. Add every address you see to the inbound allowlist of your firewall, WAF or hosting panel, for the port your webhook listens on (normally 443).

  4. Retry the registration, then open your web server's access log and look for the request. The source address it shows is the one that must be allowed. Add it if it was missing.

  5. If no request appears at all, the block is earlier in the path: a cloud security group, CDN, router or the hosting provider's network filter. Check those layers in order, outermost first.

Do not trust a pasted list

Addresses behind a service name can change, and a list from an old reply may be missing one. Re-resolve the name whenever webhooks stop arriving, and confirm the current addresses with Unisender support.

Fix 2: check the URL itself

If the addresses are already open, test the endpoint from a machine outside your network, such as a cheap VPS or a phone hotspot:

curl -i -X POST https://example.com/unisender/hook

You want a fast 2xx response. Work through these:

  • The host name resolves in public DNS, not only on your internal network.
  • The certificate is valid, not expired, and the chain is complete.
  • The port is open to the internet. Stay on 443 unless you have a reason not to.
  • The response is the final one, not a 301 or 302. Register the final URL.
  • No rate limit or bot rule blocks the request.
  • The application answers within a few seconds. A slow cold start can look like a timeout.

Fix 3: call setHook directly to isolate ELMA365

To tell whether the module or the network is at fault, call the API yourself:

curl "https://api.unisender.com/en/api/setHook?format=json&api_key={YOUR_API_KEY}&hook_url=https://example.com/unisender/hook"

Add the event parameters your integration normally sends; check the setHook entry in Unisender's API reference for the current list. If the direct call returns the same hook_url error, the problem is reachability and ELMA365 is not at fault. If it succeeds, compare the URL your module sends (scheme, path, trailing slash) with the one you just tested.

Cause, symptom and fix at a glance

CauseWhat you seeFix
Allowlist missing an addressNo request in the access logAllow every address api.unisender.com resolves to
Request stops at an edge layerRequest in CDN or WAF log, not on the serverAdd an allow rule at that layer
WAF challenge or geo-block403 or a challenge page in the logExempt the webhook path
Bad certificateTLS error in curl from outsideRenew or fix the chain
Redirect on the URL301 or 302 in curl outputRegister the final URL
Private or internal hostcurl fails from outsidePublish a public URL or use a reverse proxy

Allow by path

If your WAF supports it, create one rule for the exact webhook path and allow the Unisender addresses there. The rest of the site stays protected while the callback works.

A separate problem: domain authentication that will not complete

Another user in the same reports could not authenticate a domain whose paid domain mail had been created less than 30 days earlier, and the suggested answer was to wait 30 days. This is unverified: I could not find a 30-day rule in Unisender's public documentation, so do not plan around it. Ask Unisender support whether your account has such a condition and what it applies to.

This problem is unrelated to the setHook error. Fixing one will not fix the other, and waiting 30 days will not change a connection failure on hook_url.

Checklist before you try again

  • You resolved api.unisender.com more than once and allowed every address returned.
  • The hook URL opens from outside your network and returns 2xx quickly.
  • The certificate is valid and the chain is complete.
  • No redirect sits in front of the registered URL.
  • WAF and bot rules do not challenge the webhook path.
  • You read the access log after the failed attempt and allowed the source address it showed.

If nothing works

Contact Unisender support, and your hosting provider if your logs show nothing arriving. Include the exact error text, the time of the failed call with your time zone, the full hook_url, the output of dig +short api.unisender.com, and whether your logs show any request from Unisender and from which address.

Subject: setHook fails with "hook_url - Can not connect to host"

Hello,

Calling setHook returns: Указано неправильное значение одного из аргументов метода: 'hook_url' - Can not connect to host

Time of the call: {date, time, time zone}
hook_url: {full URL}
Addresses I allowed (from dig +short api.unisender.com): {list}
Access log: {request seen / no request seen; source IP if seen}
The URL returns 2xx when tested with curl from outside my network.

Please confirm the current source IP addresses used when hook_url is checked, and whether anything else could block it.

Common questions

Does "Can not connect to host" mean my API key is wrong?

Unlikely. The message names the hook_url argument and a connection failure, so look at the network path to your endpoint first.

Why did support give three addresses when four were needed?

In the reported case, the name resolved to more addresses than the reply listed. Resolve the name yourself and confirm with your access log.

Can I use a private or localhost URL for the hook?

Not if Unisender has to reach it from the internet. Use a public address, or put a reverse proxy in front of the private service.

Will waiting 30 days fix the webhook error?

No evidence says so. The 30-day report concerned domain authentication, which is a different problem from the connection failure on hook_url.

technicalunisendererror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

How-To

ActiveCampaign n8n error 301 on create contact: causes and fixes

A 301 from the ActiveCampaign node means the request went to a URL that redirects, so start with the API URL in your n8n credential. Copy it from Settings, then Developer, and check the scheme and path. Zapier 403 and cURL error 28 behind Cloudflare have different causes, covered below.

Sohail Hussain|9 min read
How-To

"Stage not on allowlist": Apollo to HubSpot sync fix

The error "Stage not on allowlist" means the contact's Apollo stage is not on the list of stages permitted to push to HubSpot. Open the HubSpot integration in Apollo, go to the Sync tab, and add that stage under "Stages for push contacts". Lifecycle stage mapping is a separate setting.

Sohail Hussain|7 min read
How-To

Salesmate "Authorization with Gmail failed": Gmail IMAP fix

Salesmate shows "Authorization with Gmail failed" when it can't read your Gmail account over IMAP. In Gmail settings, enable IMAP, choose "Do not limit the number of messages in an IMAP folder", and show All Mail in IMAP. Then reconnect the account in Salesmate. Other causes are covered below.

Sohail Hussain|8 min read
How-To

AWeber export "Stop Status" and "Stop Time" columns explained

In an AWeber subscriber export, a non-empty Stop Time and a non-zero Stop Status most likely mean the person has stopped receiving your mail, usually because they unsubscribed. AWeber doesn't explain the columns in the file, so verify against a few known unsubscribes, then import those rows as blocked, not subscribed.

Sohail Hussain|7 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free